Footer
nswds-ui/footerFreeComponent
End-of-page contentinfo landmark with acknowledgement of Country, legal links, ownership and social channels, themeable across 13 token-based surface colours.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/digitalnsw/nswds-ui/main/apps/registry/public/r/footer.jsonSource
1import { cva, type VariantProps } from 'class-variance-authority'2import React from 'react'34import { cn } from '@/lib/utils'56import { ButtonLink, type IconSlot } from '@/components/button'7import { Link } from '@/components/link'8import { Separator } from '@/components/separator'910/**11 * Surface colours the footer can be themed with. Each one names its LIGHT-mode12 * surface; dark mode deepens it onto the same family's dark steps (see the13 * `color` variants below), so `color` expresses tonal weight rather than a14 * literal colour.15 *16 * Every light pair clears WCAG 2.2 AA (1.4.3, 4.5:1) for the footer's smallest17 * text and 11 of the 13 also clear AAA (1.4.6, 7:1). The two AA-only pairs are18 * `primary-600` (4.57:1) and `accent-600` (5.18:1), both with white ink; prefer19 * the `-800` steps when a service is held to AAA. In dark mode all thirteen20 * clear AAA (worst 13.6:1).21 *22 * Unlike `Masthead` — which is restricted to verified AAA pairs because it is23 * legally-mandated identification — the footer carries supporting content, so24 * the full tonal range is offered here.25 */26const footerColors = [27 'primary-800',28 'primary-600',29 'primary-400',30 'primary-200',31 'grey-800',32 'grey-600',33 'grey-400',34 'grey-200',35 'accent-800',36 'accent-600',37 'accent-400',38 'accent-200',39 'white',40] as const4142type FooterColor = (typeof footerColors)[number]4344// Shared by cva's defaultVariants and the data-color attribute, so the two45// can't drift apart.46const DEFAULT_FOOTER_COLOR: FooterColor = 'white'4748const footerVariants = cva(49 [50 'w-full',51 // Every derived colour in the footer resolves from a single --footer-ink52 // token, so a colour variant only has to declare the surface utilities and53 // that one value. The derivations are written literally here (once) rather54 // than per-variant: Tailwind scans source text for class names, so a55 // template-built arbitrary property would never be emitted.56 //57 // Mirrors the color-mix derivation in link.tsx (--link-halo).58 '[--footer-border:color-mix(in_oklch,var(--footer-ink)_15%,transparent)]',59 '[--footer-halo:color-mix(in_oklch,var(--footer-ink)_10%,transparent)]',60 '[--footer-halo-active:color-mix(in_oklch,var(--footer-ink)_18%,transparent)]',61 ],62 {63 variants: {64 // Ink values use the RAW masterbrand tokens (--primary-800, --grey-800,65 // --accent-800) rather than Tailwind's --color-* bridge aliases. Tailwind66// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from @nswds/ui
All 46 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Aspect Ratioaspect-ratio | @nswds/ui | Components | Free | 2 deps · 2 files | |
| Badgebadge | @nswds/ui | Components | Free | 4 deps · 2 files | |
| Buttonbutton | @nswds/ui | Components | Free | 4 deps · 2 files | |
| Cardcard | @nswds/ui | Components | Free | 2 deps · 2 files | |
| Collapsiblecollapsible | @nswds/ui | Components | Free | 1 dep | |
| Drawerdrawer | @nswds/ui | Components | Free | 3 deps · 2 files | |
| Expandable Searchexpandable-search | @nswds/ui | Components | Free | 3 deps · 2 files | |
| Fieldfield | @nswds/ui | Components | Free | 4 deps · 2 files |
