# Site footer

A large marketing footer: the brand with a short line and a newsletter signup that validates, four link columns, and a bottom bar with the copyright, legal links, a language `Select` and icon links to the company elsewhere. On a phone the columns fold into disclosures.

**Example: Harbor footer** (`examples/recipes/site-footer.tsx`)

```tsx
'use client'

import { Badge, Button, Field, Select, Stack, Text } from '@blocks/design-system'
import { AtSign, ChevronDown, Globe, type LucideIcon, Mail, MessageCircle, Rss } from 'lucide-react'
import { type FormEvent, useId, useRef, useState } from 'react'
import styles from './site-footer.module.css'

const columns: { title: string; links: { label: string; badge?: string }[] }[] = [
  { title: 'Product', links: [{ label: 'Features' }, { label: 'Pricing' }, { label: 'Integrations' }, { label: 'Changelog' }, { label: 'Status' }] },
  { title: 'Developers', links: [{ label: 'API reference' }, { label: 'Webhooks' }, { label: 'SDKs' }, { label: 'Sandbox' }] },
  { title: 'Resources', links: [{ label: 'Guides' }, { label: 'Templates' }, { label: 'Webinars' }, { label: 'Community' }] },
  { title: 'Company', links: [{ label: 'About' }, { label: 'Careers', badge: 'Hiring' }, { label: 'Press' }, { label: 'Contact' }] },
]

const languages = [
  { value: 'en', label: 'English' },
  { value: 'es', label: 'Español' },
  { value: 'fr', label: 'Français' },
  { value: 'de', label: 'Deutsch' },
  { value: 'ja', label: '日本語' },
]

const socials: { label: string; href: string; icon: LucideIcon }[] = [
  { label: 'Harbor community forum', href: '#site-footer-forum', icon: MessageCircle },
  { label: 'Harbor on the fediverse', href: '#site-footer-social', icon: AtSign },
  { label: 'Harbor blog feed', href: '#site-footer-rss', icon: Rss },
  { label: 'Email Harbor', href: '#site-footer-email', icon: Mail },
]

const slug = (text: string) => text.toLowerCase().replaceAll(' ', '-')

function Newsletter() {
  const [error, setError] = useState('')
  const [subscribed, setSubscribed] = useState(false)
  const confirmation = useRef<HTMLParagraphElement>(null)

  function submit(event: FormEvent<HTMLFormElement>) {
    event.preventDefault()
    const email = String(new FormData(event.currentTarget).get('email')).trim()
    const problem = !email
      ? 'Enter your email address.'
      : !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)
        ? 'Enter an email address like name@example.com.'
        : ''
    setError(problem)
    if (problem) return
    setSubscribed(true)
    // The form is replaced, so focus moves to the confirmation that replaces it.
    requestAnimationFrame(() => confirmation.current?.focus())
  }

  if (subscribed) {
    return (
      <Text as="p" ref={confirmation} tabIndex={-1} fontSize="sm" role="status" margin="none" dangerouslySetClassName={styles.success}>
        You’re on the list. The next issue lands on the first Tuesday of the month.
      </Text>
    )
  }

  return (
    <form noValidate onSubmit={submit} aria-label="Newsletter">
      <Field name="email" invalid={Boolean(error)}>
        <Field.Label>The Harbor newsletter, once a month</Field.Label>
        <div className={styles.subscribe}>
          <Field.Control type="email" autoComplete="email" placeholder="you@company.com" onValueChange={() => setError('')} />
          <Button type="submit" variant="primary">
            Subscribe
          </Button>
        </div>
        {error && <Field.Error match>{error}</Field.Error>}
      </Field>
    </form>
  )
}

// A marketing footer. On a phone each link column folds into a disclosure;
// on wider containers the toggles hide and every column is open.
export default function SiteFooter() {
  const [open, setOpen] = useState<string[]>([])
  const id = useId()

  const toggle = (title: string) => setOpen((current) => (current.includes(title) ? current.filter((entry) => entry !== title) : [...current, title]))

  return (
    <footer className={styles.footer}>
      <div className={styles.top}>
        <Stack gap="lg">
          <Stack gap="sm">
            <a href="#site-footer-home" className={styles.logo}>
              <svg viewBox="0 0 24 24" aria-hidden className={styles.mark}>
                <path d="M4 15c2.5 2 5.5 2 8 0s5.5-2 8 0" />
                <path d="M4 19c2.5 2 5.5 2 8 0s5.5-2 8 0" />
                <path d="M12 3v9M8 7h8" />
              </svg>
              Harbor
            </a>
            <Text fontSize="sm" color="text-muted">
              Shared inboxes for support teams who’d rather be helping than sorting.
            </Text>
          </Stack>
          <Newsletter />
        </Stack>

        <nav className={styles.columns} aria-label="Footer">
          {columns.map((column) => {
            const listId = `${id}-${slug(column.title)}`
            const expanded = open.includes(column.title)
            return (
              <div key={column.title} className={styles.column} data-open={expanded || undefined}>
                <h3 className={styles.columnTitle}>
                  <button type="button" className={styles.toggle} aria-expanded={expanded} aria-controls={listId} onClick={() => toggle(column.title)}>
                    {column.title}
                    <ChevronDown aria-hidden size={16} className={styles.chevron} />
                  </button>
                  <span className={styles.staticTitle}>{column.title}</span>
                </h3>
                <ul id={listId} className={styles.links}>
                  {column.links.map((link) => (
                    <li key={link.label}>
                      <a href={`#site-footer-${slug(link.label)}`}>{link.label}</a>
                      {link.badge && <Badge tone="accent">{link.badge}</Badge>}
                    </li>
                  ))}
                </ul>
              </div>
            )
          })}
        </nav>
      </div>

      <div className={styles.bottom}>
        <div className={styles.bottomGroup}>
          <Text fontSize="xs" color="text-muted">
            © 2026 Harbor Labs, Inc.
          </Text>
          <ul className={styles.legal} aria-label="Legal">
            <li>
              <a href="#site-footer-privacy">Privacy</a>
            </li>
            <li>
              <a href="#site-footer-terms">Terms</a>
            </li>
            <li>
              <a href="#site-footer-cookies">Cookie settings</a>
            </li>
          </ul>
        </div>
        <div className={styles.bottomGroup}>
          <div className={styles.language}>
            <Globe aria-hidden size={14} />
            <Select items={languages} defaultValue="en">
              <Select.Trigger aria-label="Language" size="sm" dangerouslySetClassName={styles.languageTrigger} />
              <Select.Content>
                {languages.map((language) => (
                  <Select.Item key={language.value} value={language.value}>
                    {language.label}
                  </Select.Item>
                ))}
              </Select.Content>
            </Select>
          </div>
          <ul className={styles.socials} aria-label="Harbor elsewhere">
            {socials.map(({ label, href, icon: Icon }) => (
              <li key={href}>
                <a href={href} aria-label={label} className={styles.social}>
                  <Icon aria-hidden size={16} />
                </a>
              </li>
            ))}
          </ul>
        </div>
      </div>
    </footer>
  )
}
```

## How it works

- Each column heading holds a disclosure button (`aria-expanded`, `aria-controls`) and the same title as plain text. A container query shows one or the other: below 30rem the button shows and opens its list, and wider, the plain title shows and every list is open. Whichever is hidden is `display: none`, so a screen reader meets the title once.
- The newsletter form validates on submit with `Field`’s `invalid` and `Field.Error`, and a confirmation that takes focus replaces it when the address is good.
- The social links are icons only, so each has an `aria-label` naming where it goes. The language `Select` is labelled “Language” and the globe beside it is decoration.

## App-owned CSS

`examples/recipes/site-footer.module.css`:

```css
.footer {
  container-type: inline-size;
  padding: var(--ds-space-xl) var(--ds-space-lg) var(--ds-space-lg);
  background-color: var(--ds-color-bg-subtle);
  border: var(--ds-border-width-sm) solid var(--ds-color-border-subtle);
  border-radius: var(--ds-border-radius-xl);

  & a {
    color: var(--ds-color-text-muted);
    text-decoration: none;

    &:hover {
      color: var(--ds-color-text);
      text-decoration: underline;
    }

    &:focus-visible {
      outline: var(--ds-border-width-md) solid var(--ds-color-focus-ring);
      outline-offset: var(--ds-space-xs);
      border-radius: var(--ds-border-radius-sm);
    }
  }
}

.top {
  display: grid;
  gap: var(--ds-space-xl);
}

.footer .logo {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-md);
  font-size: var(--ds-font-size-lg);
  font-weight: var(--ds-font-weight-bold);
  color: var(--ds-color-text);
  text-decoration: none;
}

.mark {
  inline-size: var(--ds-control-height-md);
  block-size: var(--ds-control-height-md);
  padding: var(--ds-space-sm);
  box-sizing: border-box;
  fill: none;
  stroke: var(--ds-color-accent-fg);
  stroke-width: 2;
  stroke-linecap: round;
  background-color: var(--ds-color-accent);
  border-radius: var(--ds-border-radius-md);
}

.subscribe {
  display: flex;
  gap: var(--ds-space-sm);

  & input {
    flex: 1;
    min-inline-size: 0;
  }
}

.success {
  padding: var(--ds-space-md) var(--ds-space-lg);
  background-color: var(--ds-color-success-subtle);
  border-radius: var(--ds-border-radius-md);

  &:focus {
    outline: none;
  }
}

.columns {
  display: grid;
}

.columnTitle {
  margin: 0;
  font-size: var(--ds-font-size-sm);
  font-weight: var(--ds-font-weight-semibold);
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  inline-size: 100%;
  padding: var(--ds-space-md) 0;
  font: inherit;
  color: var(--ds-color-text);
  background: transparent;
  border: none;
  cursor: pointer;

  &:focus-visible {
    outline: var(--ds-border-width-md) solid var(--ds-color-focus-ring);
    outline-offset: var(--ds-space-xs);
    border-radius: var(--ds-border-radius-sm);
  }
}

.chevron {
  color: var(--ds-color-text-muted);
  transition: rotate var(--ds-duration-normal) var(--ds-easing-standard);

  .column[data-open] & {
    rotate: 180deg;
  }
}

.links,
.legal,
.socials {
  margin: 0;
  padding: 0;
  list-style: none;
}

.links {
  display: grid;
  gap: var(--ds-space-md);
  font-size: var(--ds-font-size-sm);

  & li {
    display: flex;
    align-items: center;
    gap: var(--ds-space-sm);
  }
}

/* Phone: each column is a disclosure, closed until its button opens it */
@container (width < 30rem) {
  .column {
    border-bottom: var(--ds-border-width-sm) solid var(--ds-color-border-subtle);
  }

  .column:first-child {
    border-top: var(--ds-border-width-sm) solid var(--ds-color-border-subtle);
  }

  .staticTitle {
    display: none;
  }

  .links {
    display: none;
    padding-bottom: var(--ds-space-lg);
  }

  .column[data-open] .links {
    display: grid;
  }

  /* The last column's border already divides the bottom bar */
  .footer .bottom {
    margin-top: var(--ds-space-lg);
    padding-top: 0;
    border-top: none;
  }
}

/* Wide: brand beside four open columns, no toggles */
@container (width >= 30rem) {
  .top {
    grid-template-columns: minmax(0, 1fr);
  }

  .columns {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--ds-space-lg);
  }

  .toggle {
    display: none;
  }

  .columnTitle {
    margin-bottom: var(--ds-space-md);
  }
}

@container (width >= 56rem) {
  .top {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }
}

.bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-md) var(--ds-space-lg);
  margin-top: var(--ds-space-xl);
  padding-top: var(--ds-space-lg);
  border-top: var(--ds-border-width-sm) solid var(--ds-color-border-subtle);
}

.bottomGroup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-md) var(--ds-space-lg);
}

.legal {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-md);
  font-size: var(--ds-font-size-xs);
}

.language {
  display: flex;
  align-items: center;
  gap: var(--ds-space-sm);
  color: var(--ds-color-text-muted);
}

.languageTrigger {
  inline-size: 8rem;
}

.socials {
  display: flex;
  gap: var(--ds-space-xs);
}

.footer .social {
  display: grid;
  place-items: center;
  inline-size: var(--ds-control-height-md);
  block-size: var(--ds-control-height-md);
  border-radius: var(--ds-border-radius-circle);

  &:hover {
    background-color: var(--ds-color-surface-hover);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chevron {
    transition: none;
  }
}
```
