# Footer with collapsible sitemap

> Sitemap footer with visible link columns on desktop and expandable groups on smaller screens.

- Kind: block · Category: Footer · Interactivity: native
- Install: `npx shadcn@latest add @haze/footer-accordion`
- File: `src/components/haze/blocks/footer-accordion.astro`
- npm dependencies: @lucide/astro
- Registry dependencies: @haze/logo-mark, @haze/utils
- Docs page: https://hazeui.com/blocks/footer-accordion

## Use when
- A long footer needs to stay compact on phones
- Visitors use the footer to jump into another part of the site

## Avoid when
- The site has only a handful of secondary links. Use footer-compact.
- The main footer action is signing up for updates. Use footer-newsletter.

## Alternatives
- [footer-columns](https://hazeui.com/blocks/footer-columns.md)
- [footer-compact](https://hazeui.com/blocks/footer-compact.md)
- [footer-newsletter](https://hazeui.com/blocks/footer-newsletter.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| brand | `string` | "Fieldwork" | no | Wordmark text. |
| homeHref | `string` | "/" | no | Destination of the linked wordmark. |
| tagline | `string` | Demo description | no | Short supporting copy under the wordmark. |
| groups | `{ title: string; links: Link[] }[]` | Library, Resources, Explore | no | Named sections of sitemap links. Links accept an optional current flag. |
| legal | `Link[]` | License and usage | no | Links in the legal row. |
| navLabel | `string` | "Sitemap" | no | Accessible name for the sitemap landmark. |
| legalLabel | `string` | "Legal" | no | Accessible name for the legal landmark. |
| backToTop | `Link \| null` | { label: "Back to top", href: "#" } | no | Link to the top of the page. Pass null to omit it. |
| copyright | `string` | "© 2026 Fieldwork" | no | Copyright or attribution text. |
| class | `string` |  | no | Additional classes on the footer. |

## Accessibility
- Native disclosures expose their open state and hide their links until expanded.
- Only one sitemap presentation is visible and keyboard reachable at each width.
- Key Enter / Space: Toggle the focused footer section on small screens.
- Key Tab: Move through the visible sitemap and legal links.

## Agent prompts

### Install and use

Install the Haze UI block "Footer with collapsible sitemap" with `npx shadcn@latest add @haze/footer-accordion`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import FooterAccordion from "@/components/haze/blocks/footer-accordion.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/blocks/footer-accordion.md

### Customize with real content

Adapt the Haze footer-accordion block for our product. Replace the demo values of these props with our real content: brand, homeHref, tagline, groups, legal, navLabel, legalLabel, backToTop, copyright, class. Keep the layout, the heading level rules and these accessibility details: Native disclosures expose their open state and hide their links until expanded. Only one sitemap presentation is visible and keyboard reachable at each width. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using footer-accordion, check it fits: use it when a long footer needs to stay compact on phones; visitors use the footer to jump into another part of the site. Avoid it when the site has only a handful of secondary links. use footer-compact.; the main footer action is signing up for updates. use footer-newsletter.. Alternatives: @haze/footer-columns, @haze/footer-compact, @haze/footer-newsletter.

## Example requests that should lead here
- Make a footer with a three-column sitemap that collapses into sections on mobile
- Add legal links and a back-to-top shortcut to the mobile sitemap footer

## Source

```astro
---
import { ArrowUp, ChevronDown } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";
import LogoMark from "../ui/logo-mark.astro";

interface Link { label: string; href: string; current?: boolean }
interface Group { title: string; links: Link[] }
interface Props {
  brand?: string;
  homeHref?: string;
  tagline?: string;
  groups?: Group[];
  legal?: Link[];
  navLabel?: string;
  legalLabel?: string;
  backToTop?: Link | null;
  copyright?: string;
  class?: string;
}

const {
  brand = "Fieldwork",
  homeHref = "/",
  tagline = "A library for building thoughtful web interfaces.",
  groups = [
    { title: "Library", links: [
      { label: "UI components", href: "/browse?kind=ui" },
      { label: "Page blocks", href: "/browse?kind=block" },
      { label: "All patterns", href: "/browse/" },
    ] },
    { title: "Resources", links: [
      { label: "Quickstart", href: "/docs/" },
      { label: "What’s new", href: "/browse?cat=changelog" },
      { label: "FAQ patterns", href: "/browse?cat=faq" },
    ] },
    { title: "Explore", links: [
      { label: "Forms", href: "/browse?cat=forms" },
      { label: "Navigation", href: "/browse?cat=navigation" },
      { label: "Layout and media", href: "/browse?cat=layout" },
    ] },
  ],
  legal = [{ label: "License and usage", href: "/docs/" }],
  navLabel = "Sitemap",
  legalLabel = "Legal",
  backToTop = { label: "Back to top", href: "#" },
  copyright = "© 2026 Fieldwork",
  class: className,
} = Astro.props;

const linkClass = "inline-flex min-h-8 max-w-full items-center rounded-sm text-sm/5 wrap-anywhere text-muted-foreground transition-colors duration-150 hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring aria-[current=page]:font-semibold aria-[current=page]:text-foreground";
---

<footer class={cn("border-t border-border bg-muted/40 px-4 pt-8 pb-5 sm:px-6 sm:pt-12", className)}>
  <div class="mx-auto max-w-6xl">
    <div class="grid gap-6 lg:grid-cols-[minmax(0,15rem)_minmax(0,1fr)] lg:gap-12">
      <div class="min-w-0 wrap-anywhere">
        <a href={homeHref} aria-label={`${brand} home`} class="inline-flex min-h-8 items-center rounded-md focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring">
          <LogoMark name={brand} shape="square" class="text-foreground [&_svg]:shrink-0" />
        </a>
        <p class="mt-2 max-w-xs text-sm/6 text-muted-foreground">{tagline}</p>
      </div>
      {groups.length > 0 && (
        <nav aria-label={navLabel} class="min-w-0">
          <div class="grid border-y border-border lg:hidden">
            {groups.map((group) => (
              <details class="group border-b border-border last:border-b-0">
                <summary class="flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-md px-1 py-2 text-sm/5 font-medium wrap-anywhere focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring [&::-webkit-details-marker]:hidden">
                  {group.title}
                  <ChevronDown class="size-4 shrink-0 text-muted-foreground transition-[rotate] duration-200 ease-snappy group-open:rotate-180" aria-hidden="true" />
                </summary>
                <ul role="list" class="grid gap-0.5 px-1 pb-2">
                  {group.links.map((link) => <li><a href={link.href} aria-current={link.current ? "page" : undefined} class={linkClass}>{link.label}</a></li>)}
                </ul>
              </details>
            ))}
          </div>
          <div class="hidden gap-x-8 gap-y-6 lg:grid lg:grid-cols-[repeat(auto-fit,minmax(min(100%,9rem),1fr))]">
            {groups.map((group) => (
              <div class="min-w-0">
                <p class="mb-2 text-sm/5 font-semibold wrap-anywhere">{group.title}</p>
                <ul role="list" class="grid gap-0.5">
                  {group.links.map((link) => <li><a href={link.href} aria-current={link.current ? "page" : undefined} class={linkClass}>{link.label}</a></li>)}
                </ul>
              </div>
            ))}
          </div>
        </nav>
      )}
    </div>
    <div class="mt-5 flex flex-wrap items-center justify-between gap-x-5 gap-y-2 lg:mt-8 lg:border-t lg:border-border lg:pt-4">
      <p class="text-[0.8125rem]/5 wrap-anywhere text-muted-foreground">{copyright}</p>
      {legal.length > 0 && (
        <nav aria-label={legalLabel}>
          <ul role="list" class="flex flex-wrap gap-x-4">
            {legal.map((link) => <li><a href={link.href} class={cn(linkClass, "text-[0.8125rem]/5")}>{link.label}</a></li>)}
          </ul>
        </nav>
      )}
      {backToTop && <a href={backToTop.href} class={cn(linkClass, "gap-1.5 text-[0.8125rem]/5")}><ArrowUp class="size-3.5 shrink-0" aria-hidden="true" />{backToTop.label}</a>}
    </div>
  </div>
</footer>
```
