Heading Block
A stack of icon, heading, description, and actions that stands in for missing content, or sits beside an image.
Installation
npx shadcn@latest add https://ui.mattdowney.com/r/lockup.jsonUsage
import {
Lockup, LockupMedia, LockupEyebrow, LockupTitle, LockupDescription, LockupBody, LockupActions,
} from "@/components/ui/lockup"Examples
Default
The empty state: an icon, what happened, and a way forward. Always give it LockupActions; without one the message is a dead end.
No matching invoices
Nothing came back for that search in the last 90 days. Try a shorter phrase, or widen the date range.
Eyebrow
The kicker that names a section, above the title. The caps, tracking, weight, and size all live in the component, so nothing is set at the call site. It is muted by default; pass className="text-accent" for the marketing treatment. It adds no gap of its own.
Why super templates?
Everything your team needs to ship a page, already decided
Layout, type, and spacing come pre-resolved, so the only thing left to choose is the words.
Quieter section
subsection heads a band one step below its neighbours: a 20px title over 14px copy, with no inset of its own. Use it for a secondary band, never for the page's main sections.
Complete the set
Pieces cut from the same batch of clay, glazed to match what you just ordered.
Chapter heading
A display-size band heading for a page where each band is a chapter: lg with align="start" inside a Section, which drops its own padding. dot puts an accent dot before the eyebrow.
Chapter two
How the work gets made
Every piece is thrown, trimmed and fired in the same small studio.
As a section label
On its own it is the kit's small caps label for a group of controls or facts in a side rail, with no title or description beside it. Give it an id and point the group at it with aria-labelledby. The 8px gap to the group is yours to set.
Status
People
Sizes
One message at all six sizes. Only the media, type, and gaps change; the parts and their order never do. subsection, section and page head real content rather than standing in for missing content, so none of them pads itself.
Your inbox is clear
Nothing needs your attention right now.
Your inbox is clear
Nothing needs your attention right now.
Your inbox is clear
Nothing needs your attention right now.
Your inbox is clear
Nothing needs your attention right now.
Your inbox is clear
Nothing needs your attention right now.
Your inbox is clear
Nothing needs your attention right now.
Alignment
The same lockup inside a card, left-aligned and centered. Left reads better when the card is narrow enough that centered text leaves ragged edges on both sides. align defaults to center, so the second card passes nothing.
No shared files
Files people share with you land here.
No shared files
Files people share with you land here.
Side by side
layout="side" puts the media beside the copy, for a success screen with art. align places the pair; the copy stays left-aligned beside the media. Under 24rem of lockup width it stacks and follows align.
You’re in.
Your spot is saved. We’ll email you the moment your invite is ready.
Surface
An empty state in a tall pane has nothing holding it. dashed marks a space content will fill; muted is a quieter filled panel. Both span the container.
No post yet
Write one from the source.
No replies yet
Replies land here as they come in.
Tones
Tone tints the media chip and its glyph. It never changes the box, the type, or the layout.
Nothing here yet
Neutral reads as a resting state, not a problem.
No results
Accent is the default: an ordinary, expected outcome.
Import finished
Success confirms work that just completed.
Connection lost
Destructive is for a failure the reader has to act on.
Full page
The lg size, sized for a route that has nothing else on it. Set level={1} so the message is the page's heading, and step the buttons up to size="lg" to match the display-size title.
The run failed
The run was stopped, usually because the dev server restarted. Your transcript is saved.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| sizeLockup | "sm" | "md" | "subsection" | "section" | "page" | "lg" | "md" | Scales the media, type, gaps, and the description's width cap. Every part reads this off the root, so you set it once. section is for heading a page section and subsection for a quieter band (20px title, 14px copy); page is a page's own headline sharing the viewport with other content; lg is a full, empty page. On a phone, section, page and lg titles drop one step (20 / 24 / 28px), and page and lg copy drops to 15.5px. |
| alignLockup | "center" | "start" | "end" | "center" | start left-aligns the text and the action row, and is the choice for a section heading; end right-aligns them. With layout="side" it places the media and copy together, and defaults to start. Uses logical alignment, so it flips under RTL. |
| layoutLockup | "stack" | "side" | "stack" | side puts LockupMedia in a column of its own and the other parts in a column beside it. Under 24rem of lockup width it stacks instead. The media must be a direct child. |
| sideAlignLockup | "start" | "center" | "start" | Side layout only. start lines the copy up with the top of the media; center with its middle. |
| surfaceLockup | "none" | "dashed" | "muted" | "none" | Boxes the lockup at the container's full width, for an empty state that would float in a tall pane. dashed is a space content will fill, with AddTile's edge; muted is a quieter filled panel. The size's own padding becomes the inset. |
| toneLockupMedia | "neutral" | "accent" | "success" | "destructive" | "accent" | Colors the glyph, and the chip behind it when variant is tinted. Nothing else changes. |
| variantLockupMedia | "tinted" | "bare" | "tinted" | bare drops the chip and steps the glyph up one size, since an icon with nothing behind it needs more size to hold the same weight. Use it in tight containers, or when the media is an avatar or an image. |
| levelLockupTitle | 1 | 2 | 3 | 4 | 5 | 6 | 2 | Heading rank. A full-page lockup is usually the page's h1; one inside a card is usually an h3. |
| classNameLockupEyebrow | string | None | The kicker above the title, and the system's one sanctioned uppercase surface in page content. Its case, tracking and weight read --eyebrow-case, --eyebrow-tracking and --eyebrow-weight. Muted by default so it stays subordinate to the title; pass text-accent for the marketing treatment. Sized for section, page, and lg. |
| dotLockupEyebrow | boolean | false | An accent dot before the label, for a page where each band is a chapter. Decoration only, hidden from screen readers. |
| childrenLockupBody | React.ReactNode | None | Content that belongs to the message, between the description and LockupActions: an install command, an email field. Takes the same space above it as the action row and follows the lockup's alignment. |
sizeLockup"sm" | "md" | "subsection" | "section" | "page" | "lg" = "md"Scales the media, type, gaps, and the description's width cap. Every part reads this off the root, so you set it once. section is for heading a page section and subsection for a quieter band (20px title, 14px copy); page is a page's own headline sharing the viewport with other content; lg is a full, empty page. On a phone, section, page and lg titles drop one step (20 / 24 / 28px), and page and lg copy drops to 15.5px. |
alignLockup"center" | "start" | "end" = "center"start left-aligns the text and the action row, and is the choice for a section heading; end right-aligns them. With layout="side" it places the media and copy together, and defaults to start. Uses logical alignment, so it flips under RTL. |
layoutLockup"stack" | "side" = "stack"side puts LockupMedia in a column of its own and the other parts in a column beside it. Under 24rem of lockup width it stacks instead. The media must be a direct child. |
sideAlignLockup"start" | "center" = "start"Side layout only. start lines the copy up with the top of the media; center with its middle. |
surfaceLockup"none" | "dashed" | "muted" = "none"Boxes the lockup at the container's full width, for an empty state that would float in a tall pane. dashed is a space content will fill, with AddTile's edge; muted is a quieter filled panel. The size's own padding becomes the inset. |
toneLockupMedia"neutral" | "accent" | "success" | "destructive" = "accent"Colors the glyph, and the chip behind it when variant is tinted. Nothing else changes. |
variantLockupMedia"tinted" | "bare" = "tinted"bare drops the chip and steps the glyph up one size, since an icon with nothing behind it needs more size to hold the same weight. Use it in tight containers, or when the media is an avatar or an image. |
levelLockupTitle1 | 2 | 3 | 4 | 5 | 6 = 2Heading rank. A full-page lockup is usually the page's h1; one inside a card is usually an h3. |
classNameLockupEyebrowstringThe kicker above the title, and the system's one sanctioned uppercase surface in page content. Its case, tracking and weight read --eyebrow-case, --eyebrow-tracking and --eyebrow-weight. Muted by default so it stays subordinate to the title; pass text-accent for the marketing treatment. Sized for section, page, and lg. |
| dotLockupEyebrowboolean = falseAn accent dot before the label, for a page where each band is a chapter. Decoration only, hidden from screen readers. |
childrenLockupBodyReact.ReactNodeContent that belongs to the message, between the description and LockupActions: an install command, an email field. Takes the same space above it as the action row and follows the lockup's alignment. |
import * as React from "react"
import { cn } from "@/registry/lib/utils"
/**
* Lockup: the stack of media, title, description, and actions that stands in
* for content. Empty results, an error, a success screen, an onboarding prompt.
*
* Size is picked by the CONTAINER, not by taste:
* sm - inside a card, a table body, a small panel
* md - a modal, a side panel, an in-page empty region
* subsection - a quieter section heading, a band one step below its
* neighbours (20px title, 14px copy), left-aligned over content
* section - the heading stack that INTRODUCES a page section
* page - a page's own headline sharing the viewport with other content:
* a split-layout hero, a landing header
* lg - a full page: an empty viewport the block floats in alone.
* Inside a Section it drops its own padding, so `lg` with
* `align="start"` is also the display-size chapter heading for a
* band. There is no size between `section` and `lg` for that.
*
* `surface` gives an empty state its own edge when it would otherwise float in
* a tall pane with nothing to hold it: `dashed` for a space content will fill,
* `muted` for a quieter filled panel. Either one spans the container's width.
*
* Center the block when it is short and has nothing beside it: a hero, a
* closing call to action, or a lockup standing in for content. Everything else
* left-aligns with `align="start"`: a `section` heading over the band's real
* content, and a lockup inside a small tile or side panel.
*
* Every part reads its scale off the root's `data-size`, so the component ships
* with no context and no client boundary: a server page with zero rows can
* render it directly.
*/
type LockupSize = "sm" | "md" | "subsection" | "section" | "page" | "lg"
type LockupAlign = "center" | "start" | "end"
type LockupTone = "neutral" | "accent" | "success" | "destructive"
type LockupLayout = "stack" | "side"
/**
* The gap under whatever introduces the title from above: `LockupMedia`, or a
* plain child placed before `LockupTitle` (a Badge, a pill). It is not part of
* the title's line pair, so it sits well clear of the title-to-description
* step: 12 / 16 / 16 / 20 / 24 / 24px in all (sm, md, subsection, section,
* page, lg), at least twice that step at every size. The root's own gap
* (4px at sm and md, 8px above) plus the margin below makes those totals.
* LockupMedia sets the same margins on itself; this selector reaches any
* other child that comes before the title and is not a Lockup part, so an
* eyebrow stays bound to its title and nothing below the title moves.
*/
const INTRODUCER_GAP = [
"data-[size=sm]:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-2",
"data-[size=md]:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-3",
"data-[size=subsection]:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-2",
"data-[size=section]:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-3",
"data-[size=page]:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-4",
"data-[size=lg]:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-4",
]
// The same, for the copy column of `layout="side"`, which reads the size off
// the root instead of carrying it. Written out in full, not built from a
// template, so Tailwind's scanner sees every class.
const INTRODUCER_GAP_SIDE = [
"group-data-[size=sm]/lockup:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-2",
"group-data-[size=md]/lockup:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-3",
"group-data-[size=subsection]/lockup:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-2",
"group-data-[size=section]/lockup:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-3",
"group-data-[size=page]/lockup:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-4",
"group-data-[size=lg]/lockup:[&>:not([data-slot^=lockup]):has(~[data-slot=lockup-title])]:mb-4",
]
type LockupSideAlign = "start" | "center"
type LockupSurface = "none" | "dashed" | "muted"
// @use-when a heading, a line of copy and an action stacked as one block: a
// marketing page's hero (`size="lg"`, or `size="page"` beside a product
// panel), the intro to a page section
// (`size="section" align="start"`, or `subsection` for a band one step
// quieter), an empty result, an error, a success
// screen, or a sign-in gate. It owns the eyebrow, title, description and
// action rhythm, so no call site sets a gap. Any heading, text and action
// block is Lockup, not PageHeader, whose `action` is a control at the end of
// its title row rather than a call to action under the copy. With an image
// or illustration BESIDE the copy rather than above it (a success screen with
// art on the left), it is still Lockup, with `layout="side"`. A small caps
// section label that names a group of controls or facts in a side rail, with no
// title or description beside it, is `LockupEyebrow` on its own.
function Lockup({
size = "md",
align,
layout = "stack",
sideAlign = "start",
surface = "none",
className,
children,
...props
}: React.ComponentProps<"div"> & {
/** Match this to the container, not to the importance of the message. */
size?: LockupSize
/** `center` for a hero, a closing call to action, or a stand-in for content.
* `start` for a section heading and inside cards and side panels. `end`
* for a block that sits against the far edge. Defaults to `center`, or to
* `start` with `layout="side"`, where it places the media-and-copy pair. */
align?: LockupAlign
/** `side` puts `LockupMedia` in its own column and the rest of the parts in
* a column beside it. Falls back to the stack when the lockup is narrow. */
layout?: LockupLayout
/** Side layout only: line the copy up with the top of the media (`start`)
* or with its middle (`center`). */
sideAlign?: LockupSideAlign
/** `dashed` or `muted` boxes the lockup at the container's full width, for
* an empty state that would float in a tall pane. The size's own padding
* becomes the box's inset. */
surface?: LockupSurface
}) {
// Only the sizes that float alone in a container (an empty state, a
// full-page message) keep text off its edges with a side inset. `section`
// and `page` head content that sits beside them, so an inset there pushed
// the heading 16px in from the cards or list under it. A plain class, not a
// data-size one, so a `px-*` in className still wins.
const floats = size === "sm" || size === "md"
// `lg` floats too, unless a Section holds it: then it is a hero, and the
// band's own padding and gutter already space it, so its py-16 and px-4
// stacked on top. Every hero in a Section carried `px-0 py-0!` to undo
// them, and agents copied the override onto pages that needed neither.
// Inside `:where()`, so it weighs nothing and a `px-*` or `py-*` in
// className still wins, the same as the plain inset above.
const lgOwnSpace =
"[:where(&[data-size=lg]:not([data-slot=section]_*))]:px-4 [:where(&[data-size=lg]:not([data-slot=section]_*))]:py-16"
// The box. Full width, because a box hugging a short title reads as a
// button. Dashed matches AddTile's edge, the kit's other "fills later"
// space; muted is the filled panel for a quieter pane.
const surfaceBox = cn(
"data-[surface=dashed]:w-full data-[surface=dashed]:rounded-lg data-[surface=dashed]:border data-[surface=dashed]:border-dashed data-[surface=dashed]:border-border",
"data-[surface=muted]:w-full data-[surface=muted]:rounded-lg data-[surface=muted]:bg-muted"
)
// Side layout. `align` places the media-and-copy PAIR at the start, centre
// or end of the lockup's width. The copy inside it start-aligns whatever
// `align` says: centred text beside a picture has no edge to read from.
// The parts stay flat children at the call site, the same as the stack;
// Lockup lifts the media out into its own column and groups everything
// else, so the copy keeps its stack rhythm as one block.
// Only a DIRECT `LockupMedia` child is lifted. One wrapped in a fragment or
// another component stays in the copy column.
//
// The switch reads the lockup's OWN width (a container query), not the
// screen's, so a side lockup in a narrow card or modal stacks too. Below
// 24rem (the kit's `@md`) it is the stack with the same `align`: media on
// top, copy under it.
if (layout === "side") {
const parts = React.Children.toArray(children)
const isMedia = (child: React.ReactNode) =>
React.isValidElement(child) && child.type === LockupMedia
return (
<div
data-slot="lockup"
data-size={size}
data-align={align ?? "start"}
data-layout="side"
data-side-align={sideAlign}
data-surface={surface}
className={cn(
// `w-full` because the container query needs a width that does not
// come from the content: a query container cannot size to fit, and
// inside a centring parent it collapsed to its own padding. The row
// inside fits its content, so the root's own alignment places it.
"group/lockup @container/lockup flex w-full flex-col",
floats && "px-4",
"data-[align=start]:items-start data-[align=center]:items-center data-[align=end]:items-end",
// The same padding the stack carries at each size, for the same
// reasons (see below).
"data-[size=sm]:py-8",
"data-[size=md]:py-12",
lgOwnSpace,
surfaceBox,
className
)}
{...props}
>
<div
data-slot="lockup-row"
className={cn(
"flex max-w-full flex-col items-start",
// Stacked (narrow), the media and copy follow `align`. A max-width
// query, not an override at @md, because a group-data class
// outranks a plain one and would win at every width.
"group-data-[align=center]/lockup:@max-md/lockup:items-center",
"group-data-[align=end]/lockup:@max-md/lockup:items-end",
"@md/lockup:flex-row",
"group-data-[side-align=center]/lockup:@md/lockup:items-center",
// Stacked (narrow): the gap from media to title is the stack's own,
// root gap plus the media's margin (12 / 16 / 16 / 20 / 24 / 24), so a
// side lockup that has fallen back looks exactly like
// `align="start"`. Side by side: a column gap that grows with the
// media beside it, always wider than the copy's own steps so the
// two columns read as two.
"group-data-[size=sm]/lockup:gap-y-3 group-data-[size=sm]/lockup:gap-x-3",
"group-data-[size=md]/lockup:gap-y-4 group-data-[size=md]/lockup:gap-x-4",
"group-data-[size=subsection]/lockup:gap-y-4 group-data-[size=subsection]/lockup:gap-x-5",
"group-data-[size=section]/lockup:gap-y-5 group-data-[size=section]/lockup:gap-x-6",
"group-data-[size=page]/lockup:gap-y-6 group-data-[size=page]/lockup:gap-x-6",
"group-data-[size=lg]/lockup:gap-y-6 group-data-[size=lg]/lockup:gap-x-8"
)}
>
{parts.filter(isMedia)}
<div
data-slot="lockup-body"
className={cn(
"flex min-w-0 flex-1 flex-col items-start text-start",
"group-data-[align=center]/lockup:@max-md/lockup:items-center group-data-[align=center]/lockup:@max-md/lockup:text-center",
"group-data-[align=end]/lockup:@max-md/lockup:items-end group-data-[align=end]/lockup:@max-md/lockup:text-end",
// The stack's title-to-description step, as rungs: pair (4px) at
// sm and md, bind (8px) above.
"group-data-[size=sm]/lockup:gap-(--spacing-rhythm-pair)",
"group-data-[size=md]/lockup:gap-(--spacing-rhythm-pair)",
"group-data-[size=subsection]/lockup:gap-(--spacing-rhythm-bind)",
"group-data-[size=section]/lockup:gap-(--spacing-rhythm-bind)",
"group-data-[size=page]/lockup:gap-(--spacing-rhythm-bind)",
"group-data-[size=lg]/lockup:gap-(--spacing-rhythm-bind)",
// Anything else above the title (a Badge, a pill) is an
// introducer like the media and takes the same gap; see
// INTRODUCER_GAP.
INTRODUCER_GAP_SIDE
)}
>
{parts.filter((child) => !isMedia(child))}
</div>
</div>
</div>
)
}
return (
<div
data-slot="lockup"
data-size={size}
data-align={align ?? "center"}
data-layout="stack"
data-surface={surface}
className={cn(
// max-w-full: centred in a flex column, a lockup sizes to its widest
// line, so one unbreakable line (an install command) would push it
// past a phone's edge. Capped, that line scrolls inside its own box.
"group/lockup flex max-w-full flex-col",
floats && "px-4",
// text-start, not text-left, so the component survives RTL.
"data-[align=center]:items-center data-[align=center]:text-center",
"data-[align=start]:items-start data-[align=start]:text-start",
"data-[align=end]:items-end data-[align=end]:text-end",
// The root gap is the TITLE-to-DESCRIPTION step, the tightest pair in
// the stack. Media and actions are optional, so each owns the extra gap
// it introduces rather than the root guessing which parts are present.
// The empty-state sizes pad themselves because they float in an empty
// container (`lg` only outside a Section, see `lgOwnSpace`). `section`
// heads real content, and the section around it
// owns that rhythm, so it ships no vertical padding. (Also practical:
// a data-size py outranks a plain pb-0 from className, so shipping one
// would be unoverridable.) `page` shares that same reasoning: it heads
// a page's own content sharing the viewport with other things, so its
// container owns the rhythm too, and `subsection` is a quieter section.
"data-[size=sm]:gap-(--spacing-rhythm-pair) data-[size=sm]:py-8",
"data-[size=md]:gap-(--spacing-rhythm-pair) data-[size=md]:py-12",
"data-[size=subsection]:gap-(--spacing-rhythm-bind)",
"data-[size=section]:gap-(--spacing-rhythm-bind)",
"data-[size=page]:gap-(--spacing-rhythm-bind)",
"data-[size=lg]:gap-(--spacing-rhythm-bind)",
INTRODUCER_GAP,
lgOwnSpace,
surfaceBox,
className
)}
{...props}
>
{children}
</div>
)
}
/**
* The icon, avatar, or image above the title, or beside the copy in
* `layout="side"`.
*
* `tinted` (default) is the icon inside a filled chip. `bare` drops the chip
* and bumps the glyph a step, since an icon with nothing behind it needs more
* size to hold the same weight. Pass an avatar or an image with `bare`.
*
* Tone changes colour only. It never changes the box, the type, or the layout.
*/
function LockupMedia({
tone = "accent",
variant = "tinted",
className,
...props
}: React.ComponentProps<"div"> & {
tone?: LockupTone
variant?: "tinted" | "bare"
}) {
return (
<div
data-slot="lockup-media"
data-tone={tone}
data-variant={variant}
className={cn(
"flex shrink-0 items-center justify-center [&_svg]:shrink-0",
// The gap this part adds on top of the root's, so the media reads as
// its own tier rather than as the first line of the copy. Stack only:
// the side layout's row owns the gap in both directions, and a margin
// here would push a centred media off the copy's middle.
// Root gap plus this margin = INTRODUCER_GAP's totals.
"group-data-[layout=stack]/lockup:group-data-[size=sm]/lockup:mb-2",
"group-data-[layout=stack]/lockup:group-data-[size=md]/lockup:mb-3",
"group-data-[layout=stack]/lockup:group-data-[size=subsection]/lockup:mb-2",
"group-data-[layout=stack]/lockup:group-data-[size=section]/lockup:mb-3",
"group-data-[layout=stack]/lockup:group-data-[size=page]/lockup:mb-4",
"group-data-[layout=stack]/lockup:group-data-[size=lg]/lockup:mb-4",
// The chip. Sized only when tinted; `bare` has no box to size.
"data-[variant=tinted]:rounded-full",
"group-data-[size=sm]/lockup:data-[variant=tinted]:size-8",
"group-data-[size=md]/lockup:data-[variant=tinted]:size-12",
"group-data-[size=subsection]/lockup:data-[variant=tinted]:size-12",
"group-data-[size=section]/lockup:data-[variant=tinted]:size-14",
"group-data-[size=page]/lockup:data-[variant=tinted]:size-16",
"group-data-[size=lg]/lockup:data-[variant=tinted]:size-16",
// Glyph. `:not([class*='size-'])` leaves the door open for a caller
// who passes their own size on the icon.
"group-data-[size=sm]/lockup:data-[variant=tinted]:[&_svg:not([class*='size-'])]:size-4",
"group-data-[size=md]/lockup:data-[variant=tinted]:[&_svg:not([class*='size-'])]:size-5",
"group-data-[size=subsection]/lockup:data-[variant=tinted]:[&_svg:not([class*='size-'])]:size-5",
"group-data-[size=section]/lockup:data-[variant=tinted]:[&_svg:not([class*='size-'])]:size-6",
"group-data-[size=page]/lockup:data-[variant=tinted]:[&_svg:not([class*='size-'])]:size-7",
"group-data-[size=lg]/lockup:data-[variant=tinted]:[&_svg:not([class*='size-'])]:size-7",
"group-data-[size=sm]/lockup:data-[variant=bare]:[&_svg:not([class*='size-'])]:size-5",
"group-data-[size=md]/lockup:data-[variant=bare]:[&_svg:not([class*='size-'])]:size-6",
"group-data-[size=subsection]/lockup:data-[variant=bare]:[&_svg:not([class*='size-'])]:size-6",
"group-data-[size=section]/lockup:data-[variant=bare]:[&_svg:not([class*='size-'])]:size-7",
"group-data-[size=page]/lockup:data-[variant=bare]:[&_svg:not([class*='size-'])]:size-8",
"group-data-[size=lg]/lockup:data-[variant=bare]:[&_svg:not([class*='size-'])]:size-8",
// Tone. Alpha on the primitive scale (not on a semantic token), so a
// consumer who re-themes `--color-accent-500` gets a matching chip for
// free. Dark mode lifts the fill a step because the same wash reads
// weaker against a dark surface. Neutral lifts a step further still
// (neutral-800, matching dark `--muted`): dark `--card` is itself
// neutral-900, so a neutral chip needs to clear both the page
// background AND a card it's sitting on, not just the page.
"data-[tone=neutral]:text-muted-foreground",
"data-[tone=accent]:text-accent",
"data-[tone=success]:text-success-600 dark:data-[tone=success]:text-success",
"data-[tone=destructive]:text-destructive-600 dark:data-[tone=destructive]:text-destructive",
// On a tint the glyph steps past the fill, the way Badge's text does
// (-700 light, -200 dark on the accent -800, -300 on the other tones), because the tone colour itself sits at
// 2.5 to 2.7:1 on its own chip and an icon that carries meaning needs 3:1.
"data-[variant=tinted]:data-[tone=accent]:text-accent-700 dark:data-[variant=tinted]:data-[tone=accent]:text-accent-200",
"data-[variant=tinted]:data-[tone=success]:text-success-700 dark:data-[variant=tinted]:data-[tone=success]:text-success-300",
"data-[variant=tinted]:data-[tone=destructive]:text-destructive-700 dark:data-[variant=tinted]:data-[tone=destructive]:text-destructive-300",
"data-[variant=tinted]:data-[tone=neutral]:bg-neutral-100 dark:data-[variant=tinted]:data-[tone=neutral]:bg-neutral-800",
"data-[variant=tinted]:data-[tone=accent]:bg-accent-100 dark:data-[variant=tinted]:data-[tone=accent]:bg-accent-800",
"data-[variant=tinted]:data-[tone=success]:bg-success-100 dark:data-[variant=tinted]:data-[tone=success]:bg-success-950",
"data-[variant=tinted]:data-[tone=destructive]:bg-destructive-100 dark:data-[variant=tinted]:data-[tone=destructive]:bg-destructive-950",
className
)}
{...props}
/>
)
}
/**
* The kicker above the title: the small caps label that names the section.
* "WHY SUPER TEMPLATES?" over the headline.
*
* THE SYSTEM'S ONE SANCTIONED UPPERCASE SURFACE in page content, which is why
* the treatment lives here and not in a utility every consumer retypes. Caps
* need tracking to stay legible (`tracking-wide`, the kit's 0.08em, the same
* token the table header and nav group label already use) and they need to be
* small, because caps at size read as shouting rather than as a label.
*
* Muted, not accent. The eyebrow is a label for the title, so it must not
* outrank it; colour is the axis that keeps it subordinate while caps and
* tracking make it a distinct register. A marketing page that wants the
* accent-coloured version passes `className="text-accent"`, which is a
* deliberate call rather than the default.
*
* It introduces NO extra gap, and that is a decision rather than an omission.
* The root gap is already the tightest pair in the stack, and an eyebrow
* belongs TO the title the way a title belongs to its description; pushing it
* further away would read as a separate line of copy. `LockupMedia` and
* `LockupActions` add margin because they are separate tiers. This is not.
*
* Sized for `section`, `page`, and `lg`, which is where a kicker earns its
* place. It still renders at `sm` and `md` rather than refusing to, because a
* component that silently drops content is worse than one used slightly
* off-label, but a caps label above a 14px card title is noise: reach for it
* when the lockup is introducing a page or a section.
*/
function LockupEyebrow({
dot = false,
className,
children,
...props
}: React.ComponentProps<"p"> & {
/** A small accent dot before the label, for a page where each band is a
* chapter and the eyebrow marks it. Decoration only, hidden from readers. */
dot?: boolean
}) {
return (
<p
data-slot="lockup-eyebrow"
data-dot={dot || undefined}
className={cn(
// Case, tracking and weight read `--eyebrow-case`, `--eyebrow-tracking`
// and `--eyebrow-weight` (uppercase, 0.08em, 600), so a site with its
// own label treatment sets it once in `:root`.
"[text-transform:var(--eyebrow-case)] tracking-(--eyebrow-tracking) font-(--eyebrow-weight) text-muted-foreground",
// The base size, so the eyebrow also works on its own as a section label
// (a rail group, a list heading). The group variants below outrank it
// inside a Lockup.
"text-2xs",
"group-data-[size=sm]/lockup:text-2xs",
"group-data-[size=md]/lockup:text-2xs",
"group-data-[size=subsection]/lockup:text-2xs",
"group-data-[size=section]/lockup:text-2xs",
"group-data-[size=page]/lockup:text-1xs",
"group-data-[size=lg]/lockup:text-1xs",
// The dot centres on the line box, which on Geist is the cap band, so
// it sits level with the caps without a nudge.
"data-dot:inline-flex data-dot:items-center data-dot:gap-2",
className
)}
{...props}
>
{dot && <span aria-hidden className="size-1.5 shrink-0 rounded-full bg-accent" />}
{children}
</p>
)
}
/**
* The headline. Renders an `h2`; set `level` when the page's outline needs a
* different rank (a full-page error is usually the `h1`, a lockup inside a card
* is usually an `h3`).
*/
function LockupTitle({
level = 2,
className,
...props
}: React.ComponentProps<"h2"> & {
level?: 1 | 2 | 3 | 4 | 5 | 6
}) {
const Heading = `h${level}` as "h1" | "h2" | "h3" | "h4" | "h5" | "h6"
return (
<Heading
data-slot="lockup-title"
className={cn(
// A heading wraps short: it breaks into lines rather than stretching
// across the page. text-balance evens those lines out.
// Leading is overridden ONLY to tighten: sm/md/section/page sit above
// the display metric (text-sm ships 1.5, text-xl/text-2xl/text-3xl
// 1.35/1.35/1.25) so all four drop to leading-tight; lg keeps
// text-display's own 1.22, which is already tighter than any leading
// token, so it gets no override. Tracking works the same way: the
// display step carries its own -0.025em, so `lg` needs no class, while
// `section` and `page` still add `tracking-tight` by hand because
// text-2xl and text-3xl also set body headings (PageHeader, Prose),
// where the body's -0.01em is right.
//
// THE MEASURE SCALES WITH THE SIZE, like the type and the leading do.
// It shipped as a flat `measure-heading` (24ch) at every size, which is
// a DISPLAY measure: right for a three-word hero, but it strangles a
// full-sentence section title into four or five ragged lines. The
// narrower the type, the more characters a line can hold before the
// eye's return sweep gets long, so only `lg` keeps the tight cap and
// everything under it, including `page`, reads `measure-heading-relaxed`
// (32ch). The token itself is deliberately NOT widened: it is the
// heading measure for the whole system and moving it would move every
// heading.
// No `text-balance` utility here, on purpose: A CAP NEVER TRAVELS
// ALONE, and the pairing lives in CSS. `.max-w-measure-heading` and
// `.max-w-measure-heading-relaxed` both carry `text-wrap: balance` in
// `@layer components`, so the cap that creates the orphan risk brings
// its own fix and no call site retypes it.
//
// That is also the trap this hit. Adding the `-relaxed` cap without
// adding its rule to that layer silently dropped balance from every
// size but `lg`, and nothing catches it: the class is real, the width
// is right, and only the line breaks change. A new cap is only half a
// token until it is paired.
// NO `cap-trim` here, deliberately. The trim only travels with a gap
// that was tuned for a trimmed box, and Lockup's title-to-description
// step is a per-size rung on the root (`pair` at sm and md, `bind` above),
// hand-tuned against four different type steps rather than reading one
// rung. Trimming without re-tuning those four ate the title's
// below-baseline space, which is proportional to type size: roughly
// 3.7px at `sm`, 5.3 at `md`, 6.4 at `section` and 9.0 at `lg`, so the
// 36px hero lost more than half its gap (17px painted down to 8) and
// the titles collided with their descriptions. Shipped that way for one
// commit; do not re-add the class on its own. Making Lockup honest
// means giving it a size-ramped RUNG first, the way PageHeader has
// `heading-sm|md|lg`, and only then trimming.
//
// SIZE AND WEIGHT READ TOKENS, one pair per size (`--lockup-title-<size>`
// and `--lockup-title-<size>-weight`, plus `lg`'s own leading and
// tracking), so a site with its own hero ramp retunes them in `:root`
// instead of forcing the classes with `!`. They ship in `@layer base`,
// so a plain `:root` of yours wins whatever the load order. The paren
// form keeps each a live `var()`; a numbered utility like `text-display`
// is inlined at compile time and no override could reach it. Defaults
// equal the scale steps these used to name (14 / 20 / 20 / 24 / 28 / 36px).
//
// ON A PHONE (below 40rem) `section`, `page` and `lg` step down one rung
// of the type scale, to 20 / 24 / 28px. The step lives in the tokens
// (`base` redeclares those three inside `@media (width < 40rem)`), not
// in a class here, so the title still reads one live var. sm, md and
// subsection are already small enough and do not move.
"max-w-measure-heading-relaxed",
"group-data-[size=sm]/lockup:text-(length:--lockup-title-sm) group-data-[size=sm]/lockup:leading-tight group-data-[size=sm]/lockup:font-(--lockup-title-sm-weight)",
"group-data-[size=md]/lockup:text-(length:--lockup-title-md) group-data-[size=md]/lockup:leading-tight group-data-[size=md]/lockup:font-(--lockup-title-md-weight)",
"group-data-[size=subsection]/lockup:text-(length:--lockup-title-subsection) group-data-[size=subsection]/lockup:leading-tight group-data-[size=subsection]/lockup:font-(--lockup-title-subsection-weight)",
"group-data-[size=section]/lockup:text-(length:--lockup-title-section) group-data-[size=section]/lockup:leading-tight group-data-[size=section]/lockup:tracking-tight group-data-[size=section]/lockup:font-(--lockup-title-section-weight)",
"group-data-[size=page]/lockup:text-(length:--lockup-title-page) group-data-[size=page]/lockup:leading-tight group-data-[size=page]/lockup:tracking-tight group-data-[size=page]/lockup:font-(--lockup-title-page-weight)",
"group-data-[size=lg]/lockup:text-(length:--lockup-title-lg) group-data-[size=lg]/lockup:leading-(--lockup-title-lg-leading) group-data-[size=lg]/lockup:tracking-(--lockup-title-lg-tracking) group-data-[size=lg]/lockup:font-(--lockup-title-lg-weight) group-data-[size=lg]/lockup:max-w-measure-heading",
className
)}
{...props}
/>
)
}
/**
* The supporting line. Capped so it wraps to two or three short lines: the caps
* below land at roughly 51 to 55 characters at each size's type, deliberately
* narrower than the 68ch reading measure, because centred copy fragments if you
* let it run the full measure. No leading class: each size takes the line
* height its type step ships with (1.5 at 14 and 16px, 1.35 at 12 and 18px),
* so a wrapped description reads like any other copy at that size.
*/
function LockupDescription({ className, ...props }: React.ComponentProps<"p">) {
return (
<p
data-slot="lockup-description"
className={cn(
"text-muted-foreground text-pretty",
"group-data-[size=sm]/lockup:text-1xs group-data-[size=sm]/lockup:max-w-sm",
"group-data-[size=md]/lockup:text-sm group-data-[size=md]/lockup:max-w-md",
"group-data-[size=subsection]/lockup:text-sm group-data-[size=subsection]/lockup:max-w-md",
"group-data-[size=section]/lockup:text-base group-data-[size=section]/lockup:max-w-lg",
// On a phone (below 40rem) page and lg drop one step, 18px to 15.5px,
// with their titles (see LockupTitle). Section stays at text-base: it
// is already body size, and copy below that on a phone reads small.
"group-data-[size=page]/lockup:text-lg group-data-[size=page]/lockup:max-sm:text-base group-data-[size=page]/lockup:max-w-lg",
"group-data-[size=lg]/lockup:text-lg group-data-[size=lg]/lockup:max-sm:text-base group-data-[size=lg]/lockup:max-w-lg",
className
)}
{...props}
/>
)
}
/**
* Content that belongs to the message, between the description and the
* actions: an install command, an email field, a short list. It takes the same
* space above it as the action row does, so the block keeps one rhythm, and it
* follows the lockup's alignment.
*/
function LockupBody({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="lockup-body"
className={cn(
"flex w-full max-w-full flex-col",
"group-data-[align=center]/lockup:items-center",
"group-data-[align=start]/lockup:items-start",
"group-data-[align=end]/lockup:items-end",
"group-data-[size=sm]/lockup:mt-2",
"group-data-[size=md]/lockup:mt-3",
"group-data-[size=subsection]/lockup:mt-3",
"group-data-[size=section]/lockup:mt-4",
"group-data-[size=page]/lockup:mt-4",
"group-data-[size=lg]/lockup:mt-4",
className
)}
{...props}
/>
)
}
/**
* The action row: one primary button, optionally a secondary beside it. Wraps
* on narrow screens rather than overflowing.
*/
function LockupActions({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="lockup-actions"
className={cn(
"flex flex-wrap items-center",
"group-data-[align=center]/lockup:justify-center",
"group-data-[align=start]/lockup:justify-start",
"group-data-[align=end]/lockup:justify-end",
// Same rule as the media: the gap this part adds sits on the part.
"group-data-[size=sm]/lockup:mt-2 group-data-[size=sm]/lockup:gap-2",
"group-data-[size=md]/lockup:mt-3 group-data-[size=md]/lockup:gap-2",
"group-data-[size=subsection]/lockup:mt-3 group-data-[size=subsection]/lockup:gap-2",
"group-data-[size=section]/lockup:mt-4 group-data-[size=section]/lockup:gap-2",
"group-data-[size=page]/lockup:mt-4 group-data-[size=page]/lockup:gap-3",
"group-data-[size=lg]/lockup:mt-4 group-data-[size=lg]/lockup:gap-3",
className
)}
{...props}
/>
)
}
export {
Lockup,
LockupBody,
LockupMedia,
LockupEyebrow,
LockupTitle,
LockupDescription,
LockupActions,
}