Mischief

52 / Blocks

Footer Columns

Labelled columns of links, with the column count and the link rendering left to you.

Installation

Copy the source into your project, or keep it behind a package.

npx shadcn@latest add Tinkerers-Labs/mischief-ui/footer-columns
import { FooterColumns } from "mischief-ui/footer-columns"

Or paste it in yourself. The source imports the shared cn helper from @/lib/utils, so point that at your own copy.

registry/default/footer-columns/footer-columns.tsx
import * as React from "react" import { cn } from "@/lib/utils" export type FooterLink = {  label: React.ReactNode  href: string  /** Opens in a new tab, and says so. */  external?: boolean} export type FooterColumn = {  label?: React.ReactNode  links: readonly FooterLink[]

Usage

export function Links() {
  return (
    <FooterColumns
      columnCount={4}
      columns={groups}
      renderLink={({ href, label }) => <Link href={href}>{label}</Link>}
    />
  )
}

How many columns

One column below the small breakpoint, two above it, and columnCount at the widest. Six groups in a three-column grid is a different footer from six groups in a row, and only you know which one you meant.

The count travels as a custom property rather than a class, because a class assembled from a variable is never generated: Tailwind reads class names as literal text.

<FooterColumns columnCount={6} columns={groups} />

API

columnsFooterColumn[]The groups, each with an optional label and its links.
columnCountnumberColumns at the widest size. Defaults to 3.
renderLink(link: FooterLink) => ReactNodeRenders every link, for your framework's link component.

FooterColumn

labelReactNodeThe small uppercase heading. Omit for an unlabelled group.
linksFooterLink[]The links in the column, in order.

FooterLink

labelReactNodeThe link text.
hrefstringWhere it goes.
externalbooleanOpens in a new tab, and says so to a screen reader.

Accessibility

Each group is a list, so a screen reader announces how many links it holds before reading them. Labels are plain text rather than headings, so a long directory does not litter the page outline. An external link says where it goes in its accessible name, led by a comma because a leading space is dropped when that name is computed.