Headline Card
Article or case study card for feature grids: an optional meta line, a display title, a muted description, a round arrow link at the top right and a byline pinned to the bottom so card rows align at equal height.
pnpm dlx shadcn add @01orbital/headline-cardimport type { ComponentProps } from "react"
import { ArrowRightIcon } from "@phosphor-icons/react/dist/ssr"
import { cn } from "cn"
import { buttonVariants } from "@/components/ui/button"
import {
Card,
CardAction,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
/**
* A card for a headline, such as an article or a case study. Compose it from
* its parts: a `HeadlineCardHeader` holding an optional `HeadlineCardMeta`,
* the `HeadlineCardTitle`, a `HeadlineCardDescription` and a
* `HeadlineCardLink`, then a `HeadlineCardFooter` pushed to the bottom. It is
* the kit's `Card`, styled; at least 320px tall, with padding that grows from
* 32px to 40px on screens 42rem and wider. The title steps from 24px to 30px
* once the card is 24rem wide, reading the stock `card-header` container.
*
* It uses the card background unless you pass a surface utility, such as
* `surface-frost`, in `className`. Every part takes `className` to restyle it.
*/
function HeadlineCard({ className, ...props }: ComponentProps<typeof Card>) {
return (
<Card
data-slot="headline-card"
className={cn(
"min-h-80 gap-8 [--card-spacing:--spacing(8)] min-[42rem]:[--card-spacing:--spacing(10)]",
className
)}
{...props}
/>
)
}
/**
* The card's top block, which holds the meta, title, description and link.
* The stock `card-header` container, so the title steps on its width. The copy is capped at 28rem and
* the link sits at the far edge.
*/
function HeadlineCardHeader({
className,
...props
}: ComponentProps<typeof CardHeader>) {
return (
<CardHeader
data-slot="headline-card-header"
className={cn(
"grid-cols-[minmax(0,var(--container-md))] justify-between gap-4 has-data-[slot=card-action]:grid-cols-[minmax(0,var(--container-md))_auto]",
className
)}
{...props}
/>
)
}
/**
* A line above the headline, such as a category and a date. It takes any
* content and has no styling of its own.
*/
function HeadlineCardMeta({ className, ...props }: ComponentProps<"div">) {
return <div data-slot="headline-card-meta" className={className} {...props} />
}
/**
* The headline, read as a level-3 heading, in the body font (Geist). Pass
* `aria-level` to change the level.
*/
function HeadlineCardTitle({
className,
...props
}: ComponentProps<typeof CardTitle>) {
return (
<CardTitle
data-slot="headline-card-title"
role="heading"
aria-level={3}
className={cn(
"text-2xl/8 font-[450] tracking-[-0.04em] text-pretty @sm/card-header:text-3xl/9",
className
)}
{...props}
/>
)
}
/** The text under the headline, at 75% of the card's text color. */
function HeadlineCardDescription({
className,
...props
}: ComponentProps<typeof CardDescription>) {
return (
<CardDescription
data-slot="headline-card-description"
className={cn("text-base/7 text-pretty text-current/75", className)}
{...props}
/>
)
}
/**
* The round arrow link at the top right of the header. Give it an
* `aria-label`, such as "Read guide: …", since it shows only an icon; `href`
* is where it goes. `className` goes on the link itself.
*/
function HeadlineCardLink({ className, ...props }: ComponentProps<"a">) {
return (
<CardAction>
<a
data-slot="button"
className={cn(
buttonVariants({ variant: "secondary", size: "icon-lg" }),
className
)}
{...props}
>
<ArrowRightIcon aria-hidden="true" />
</a>
</CardAction>
)
}
/**
* The card's bottom row, pushed to the bottom: a wrapping flex row with the
* items centered and spread apart, 24px by 8px gaps, in 12px text. Put a
* `Byline size="sm"` on the left and a button or link on the right.
*/
function HeadlineCardFooter({
className,
...props
}: ComponentProps<typeof CardFooter>) {
return (
<CardFooter
data-slot="headline-card-footer"
className={cn(
"mt-auto flex-wrap justify-between gap-x-6 gap-y-2 text-xs/5",
className
)}
{...props}
/>
)
}
export {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardLink,
HeadlineCardMeta,
HeadlineCardTitle,
}
"use client"
import { useState } from "react"
import {
Byline,
BylineDescription,
BylineName,
} from "@/components/byline/byline"
import {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardMeta,
HeadlineCardTitle,
} from "@/components/card/headline-card"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { StatValue } from "@/components/stats/stats"
import { Button } from "@/components/ui/button"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "Ostrelle / web performance",
title: "A smaller site. A faster first impression.",
description:
"How the Ostrelle team cut the weight of its product pages while keeping the details that made them theirs.",
client: "Ostrelle",
byline: "Sample case study · illustrative metric",
cta: "Save case study",
saved: "Saved",
metric: "−42%",
} as const
/**
* A case-study HeadlineCard on blue stock: a mono label and a large figure
* above the headline, both in Newsreader, and the client with a save
* button in the footer.
*/
export default function HeadlineCardCaseStudy() {
const [saved, setSaved] = useState(false)
return (
<HeadlineCard className="w-full max-w-md surface-sheen [--font-display:var(--font-serif)]">
<HeadlineCardHeader>
<HeadlineCardMeta>
<div className="grid gap-4">
<Eyebrow variant="mono" tone="ink">
{COPY.eyebrow}
</Eyebrow>
<StatValue className="font-display text-[5rem]/none tracking-[-0.05em]">
{COPY.metric}
</StatValue>
</div>
</HeadlineCardMeta>
<HeadlineCardTitle className="font-display font-normal tracking-[-0.025em]">
{COPY.title}
</HeadlineCardTitle>
<HeadlineCardDescription>{COPY.description}</HeadlineCardDescription>
</HeadlineCardHeader>
<HeadlineCardFooter>
<Byline size="sm">
<BylineName>{COPY.client}</BylineName>
<BylineDescription>{COPY.byline}</BylineDescription>
</Byline>
<Button
variant="outline"
aria-pressed={saved}
onClick={() => setSaved((v) => !v)}
>
{saved ? COPY.saved : COPY.cta}
</Button>
</HeadlineCardFooter>
</HeadlineCard>
)
}
import type { ComponentProps } from "react"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cn } from "cn"
type BylineSize = "md" | "sm"
type BylineState = { slot: "byline"; size: BylineSize }
type BylineAvatarState = { slot: "byline-avatar" }
/**
* A person's byline: an optional `BylineAvatar`, then `BylineName` with a
* `BylineDescription` under it, as a `div`. With an avatar it becomes two
* columns: the avatar spans both lines, 16px from the text. Under a quote,
* pass `render={<figcaption />}`; in a centered quote add `w-fit text-left` so it shrinks to fit
* and keeps its text left-aligned.
*
* At `size="md"` (the default) the name is 16px/24px semibold and the
* description 14px/20px muted, 2px apart; a 40px avatar matches the two
* lines. At `size="sm"` both lines are 12px/20px, the name in regular weight,
* the byline of a card footer.
*/
function Byline({
className,
size = "md",
render,
...props
}: useRender.ComponentProps<"div", BylineState> & {
/** The type size: `md` (the default) 16px over 14px, `sm` 12px over 12px for a card footer. */
size?: BylineSize
}) {
return useRender({
defaultTagName: "div",
render,
state: { slot: "byline", size },
props: mergeProps<"div">(
{
className: cn(
"group/byline grid items-center gap-x-4 gap-y-0.5 text-sm/5 has-data-[slot=byline-avatar]:grid-cols-[auto_1fr] data-[size=sm]:text-xs/5",
className
),
},
props
),
})
}
/**
* Holds the person's picture beside the name and description: a stock
* `Avatar`, an orb avatar or an image, 40px recommended. Use
* `render={<div />}` when the artwork has a block root.
*/
function BylineAvatar({
className,
render,
...props
}: useRender.ComponentProps<"span", BylineAvatarState>) {
return useRender({
defaultTagName: "span",
render,
state: { slot: "byline-avatar" },
props: mergeProps<"span">(
{ className: cn("row-span-2 flex", className) },
props
),
})
}
/** The person's name, 16px/24px semibold, held close to the line below; 12px regular in a `sm` byline. */
function BylineName({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-name"
className={cn(
"self-end text-base/6 font-semibold group-data-[size=sm]/byline:text-xs/5 group-data-[size=sm]/byline:font-normal",
className
)}
{...props}
/>
)
}
/**
* The second line under the name, such as a job title, a company, a handle
* or a date, in 14px/20px muted text; 12px in a `sm` byline.
*/
function BylineDescription({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-description"
className={cn("self-start text-muted-foreground", className)}
{...props}
/>
)
}
export { Byline, BylineAvatar, BylineName, BylineDescription }
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
// default is a quiet 14px line, cased as written; icon puts a 16px icon in
// front of it; mono is a 12px uppercase mono label for spec-sheet designs;
// caps is the same size in a sans face. tone picks the ink: muted (the
// default) or the surrounding text color, for a label over art or on a dark
// island where muted-foreground is too quiet.
const eyebrowVariants = cva("", {
variants: {
/**
* The label style. `default` (the default) is a 14px line at weight 500,
* cased as written. `icon` is the same line with a 16px icon, placed
* first among the children, 12px before the words. `mono` is a 12px
* uppercase mono label at weight 500 with 0.12em letter spacing. `caps`
* is the same label in the sans face, for a brand and series label such
* as "Studio Neri / Clay school". The color comes from `tone`.
*/
variant: {
default: "text-sm/5 font-medium",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
/**
* The ink. `muted` (the default) is `muted-foreground`. `ink` leaves the
* color to the surrounding text, for a label over art, on a dark island
* or anywhere the muted grey is too quiet to read.
*/
tone: {
muted: "text-muted-foreground",
ink: "",
},
},
defaultVariants: { variant: "default", tone: "muted" },
})
/**
* A short label set above a heading, such as a section name, rendered as a
* `<p>`. Leave 8px between it and the heading. Pass `render` to use another
* element.
*
* `default` is a 14px line at weight 500, cased as written. `icon` adds a
* 16px icon before the words: put the icon first, with `aria-hidden`. `mono`
* is a 12px uppercase mono label with 0.12em letter spacing; `caps` the same
* in the sans face, for a brand and series name such as "Studio Neri / Clay
* school". `tone="muted"` (the default) sets it in `muted-foreground`;
* `tone="ink"` takes the surrounding text color, for a label over art or on
* a dark island where the grey is too quiet.
*/
function Eyebrow({
className,
variant = "default",
tone = "muted",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant, tone },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant, tone }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import type { ComponentProps } from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
import { Grid, type GridProps } from "@/components/grid/grid"
/**
* A list of `Stat` items laid out by `Grid`, rendered as a `ul`. It defaults
* to 3 columns and the large gap. Like `Grid`, its columns follow the width
* it is given, so size its parent to narrow it. `className` lands on the
* list.
*/
function StatGroup({
cols = 3,
gap = "lg",
...props
}: ComponentProps<"ul"> & {
/**
* The most columns, 3 by default. They step up as the list's space
* widens, the way `Grid`'s do.
*/
cols?: GridProps["cols"]
/**
* Space between stats: `xs` 8px, `sm` 16px, `md` 24px, `lg` 40px, `xl` 64px, `px` 1px, `none` 0. `lg`
* is the default.
*/
gap?: GridProps["gap"]
}) {
return (
<Grid
data-slot="stat-group"
render={<ul role="list" />}
cols={cols}
gap={gap}
// Grid's props are typed for its default div; this group renders a list.
{...(props as Omit<GridProps, "cols" | "gap">)}
/>
)
}
// card sets the stat on a filled panel; rule sets a line down its left side.
const statVariants = cva("grid content-start gap-2", {
variants: {
/**
* The stat style. `default` (the default) adds nothing. `card` sets it
* on a `rounded-xl` panel with 32px padding, filled with `muted`, or
* with `card` and `card-foreground` text in dark mode. `rule` draws a
* 1px line in `border` down its left side, 24px from the text.
*/
variant: {
default: "",
card: "rounded-xl bg-muted p-8 dark:bg-card dark:text-card-foreground",
rule: "border-l border-border pl-6",
},
},
defaultVariants: { variant: "default" },
})
/**
* One figure and its label, as an `li` inside `StatGroup`. Holds a
* `StatValue` and a `StatLabel`, stacked with 8px gaps.
*
* `card` sets it on a filled, rounded panel with 32px padding. `rule` draws a
* line down its left side.
*/
function Stat({
className,
variant = "default",
...props
}: ComponentProps<"li"> & VariantProps<typeof statVariants>) {
return (
<li
data-slot="stat"
data-variant={variant}
className={cn(statVariants({ variant }), className)}
{...props}
/>
)
}
/** The figure itself, such as a number or a percentage, at 32px in the body font. */
function StatValue({ className, ...props }: ComponentProps<"p">) {
return (
<p
data-slot="stat-value"
className={cn("text-[2rem]/10 tracking-tight", className)}
{...props}
/>
)
}
/**
* The caption under the figure: what it measures, in a few words. Small
* muted text, 14px on a 20px line, so the number carries the weight. Longer
* explanation belongs in the section's lead or a note, not here.
*/
function StatLabel({ className, ...props }: ComponentProps<"p">) {
return (
<p
data-slot="stat-label"
className={cn("text-sm/5 text-pretty text-muted-foreground", className)}
{...props}
/>
)
}
export { StatGroup, Stat, StatValue, StatLabel }
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
const GRID_DEFAULTS = { cols: 3, gap: "lg" } as const
// Columns follow the screen, stepping at 40rem and 48rem (and 64rem for six). Gap sizes read the shared --gap-*
// values in globals.css. The grid fills its parent's width: without that, a
// grid given `mx-auto` or set inside a centering parent shrinks to fit its
// content, and a part built on it that is a container collapses to nothing.
const containerGridVariants = cva("grid w-full grid-cols-1", {
variants: {
/**
* The most columns. Below 40rem of screen width the grid is one
* column (two for `6`); it steps up at 40rem and 48rem: `2` is two
* columns from 40rem, `3` two then three, `4` two then four, `5` three
* then five, and `6` three, then four, then six from 64rem. The default
* is 3.
*/
cols: {
1: "",
2: "sm:grid-cols-2",
3: "sm:grid-cols-2 md:grid-cols-3",
4: "sm:grid-cols-2 md:grid-cols-4",
5: "sm:grid-cols-3 md:grid-cols-5",
6: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6",
},
/**
* Space between items: `xs` 8px, `sm` 16px, `md` 24px, `lg` 40px, `xl` 64px, `px` 1px, `none` 0. `lg`
* is the default. The sizes are the `--gap-*` values in globals.css.
*/
gap: {
xs: "gap-(--gap-xs)",
sm: "gap-(--gap-sm)",
md: "gap-(--gap-md)",
lg: "gap-(--gap-lg)",
xl: "gap-(--gap-xl)",
px: "gap-px",
none: "gap-0",
},
},
defaultVariants: GRID_DEFAULTS,
})
type GridState = { slot: "grid" } & VariantProps<typeof containerGridVariants>
type GridProps = useRender.ComponentProps<"div", GridState> &
VariantProps<typeof containerGridVariants>
// className, render and every other prop go to the grid. To narrow a Grid,
// pass a `max-w-*` class or size its parent.
function Grid({
className,
cols = GRID_DEFAULTS.cols,
gap = GRID_DEFAULTS.gap,
render,
...props
}: GridProps) {
const grid = useRender({
defaultTagName: "div",
render,
state: { slot: "grid", cols, gap },
props: mergeProps<"div">(
{ className: cn(containerGridVariants({ cols, gap }), className) },
props
),
})
return grid
}
export { Grid, type GridProps }
The example also uses byline, eyebrow and stats. Install them too:
pnpm dlx shadcn add @01orbital/byline @01orbital/eyebrow @01orbital/statsnpx shadcn add @01orbital/byline @01orbital/eyebrow @01orbital/statsyarn shadcn add @01orbital/byline @01orbital/eyebrow @01orbital/statsbunx --bun shadcn add @01orbital/byline @01orbital/eyebrow @01orbital/statsUsage
"use client"
import { useState } from "react"
import {
Byline,
BylineDescription,
BylineName,
} from "@/components/byline/byline"
import {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardMeta,
HeadlineCardTitle,
} from "@/components/card/headline-card"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { StatValue } from "@/components/stats/stats"
import { Button } from "@/components/ui/button"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "Ostrelle / web performance",
title: "A smaller site. A faster first impression.",
description:
"How the Ostrelle team cut the weight of its product pages while keeping the details that made them theirs.",
client: "Ostrelle",
byline: "Sample case study · illustrative metric",
cta: "Save case study",
saved: "Saved",
metric: "−42%",
} as const
/**
* A case-study HeadlineCard on blue stock: a mono label and a large figure
* above the headline, both in Newsreader, and the client with a save
* button in the footer.
*/
export default function HeadlineCardCaseStudy() {
const [saved, setSaved] = useState(false)
return (
<HeadlineCard className="w-full max-w-md surface-sheen [--font-display:var(--font-serif)]">
<HeadlineCardHeader>
<HeadlineCardMeta>
<div className="grid gap-4">
<Eyebrow variant="mono" tone="ink">
{COPY.eyebrow}
</Eyebrow>
<StatValue className="font-display text-[5rem]/none tracking-[-0.05em]">
{COPY.metric}
</StatValue>
</div>
</HeadlineCardMeta>
<HeadlineCardTitle className="font-display font-normal tracking-[-0.025em]">
{COPY.title}
</HeadlineCardTitle>
<HeadlineCardDescription>{COPY.description}</HeadlineCardDescription>
</HeadlineCardHeader>
<HeadlineCardFooter>
<Byline size="sm">
<BylineName>{COPY.client}</BylineName>
<BylineDescription>{COPY.byline}</BylineDescription>
</Byline>
<Button
variant="outline"
aria-pressed={saved}
onClick={() => setSaved((v) => !v)}
>
{saved ? COPY.saved : COPY.cta}
</Button>
</HeadlineCardFooter>
</HeadlineCard>
)
}Examples
Case Studyheadline-card-case-study
Example of the Headline Card as a case study on blue stock: a mono label and large serif figure above the headline, with the client and a save button in the footer.
pnpm dlx shadcn add @01orbital/headline-card-case-study"use client"
import { useState } from "react"
import {
Byline,
BylineDescription,
BylineName,
} from "@/components/byline/byline"
import {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardMeta,
HeadlineCardTitle,
} from "@/components/card/headline-card"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { StatValue } from "@/components/stats/stats"
import { Button } from "@/components/ui/button"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "Ostrelle / web performance",
title: "A smaller site. A faster first impression.",
description:
"How the Ostrelle team cut the weight of its product pages while keeping the details that made them theirs.",
client: "Ostrelle",
byline: "Sample case study · illustrative metric",
cta: "Save case study",
saved: "Saved",
metric: "−42%",
} as const
/**
* A case-study HeadlineCard on blue stock: a mono label and a large figure
* above the headline, both in Newsreader, and the client with a save
* button in the footer.
*/
export default function HeadlineCardCaseStudy() {
const [saved, setSaved] = useState(false)
return (
<HeadlineCard className="w-full max-w-md surface-sheen [--font-display:var(--font-serif)]">
<HeadlineCardHeader>
<HeadlineCardMeta>
<div className="grid gap-4">
<Eyebrow variant="mono" tone="ink">
{COPY.eyebrow}
</Eyebrow>
<StatValue className="font-display text-[5rem]/none tracking-[-0.05em]">
{COPY.metric}
</StatValue>
</div>
</HeadlineCardMeta>
<HeadlineCardTitle className="font-display font-normal tracking-[-0.025em]">
{COPY.title}
</HeadlineCardTitle>
<HeadlineCardDescription>{COPY.description}</HeadlineCardDescription>
</HeadlineCardHeader>
<HeadlineCardFooter>
<Byline size="sm">
<BylineName>{COPY.client}</BylineName>
<BylineDescription>{COPY.byline}</BylineDescription>
</Byline>
<Button
variant="outline"
aria-pressed={saved}
onClick={() => setSaved((v) => !v)}
>
{saved ? COPY.saved : COPY.cta}
</Button>
</HeadlineCardFooter>
</HeadlineCard>
)
}
import type { ComponentProps } from "react"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cn } from "cn"
type BylineSize = "md" | "sm"
type BylineState = { slot: "byline"; size: BylineSize }
type BylineAvatarState = { slot: "byline-avatar" }
/**
* A person's byline: an optional `BylineAvatar`, then `BylineName` with a
* `BylineDescription` under it, as a `div`. With an avatar it becomes two
* columns: the avatar spans both lines, 16px from the text. Under a quote,
* pass `render={<figcaption />}`; in a centered quote add `w-fit text-left` so it shrinks to fit
* and keeps its text left-aligned.
*
* At `size="md"` (the default) the name is 16px/24px semibold and the
* description 14px/20px muted, 2px apart; a 40px avatar matches the two
* lines. At `size="sm"` both lines are 12px/20px, the name in regular weight,
* the byline of a card footer.
*/
function Byline({
className,
size = "md",
render,
...props
}: useRender.ComponentProps<"div", BylineState> & {
/** The type size: `md` (the default) 16px over 14px, `sm` 12px over 12px for a card footer. */
size?: BylineSize
}) {
return useRender({
defaultTagName: "div",
render,
state: { slot: "byline", size },
props: mergeProps<"div">(
{
className: cn(
"group/byline grid items-center gap-x-4 gap-y-0.5 text-sm/5 has-data-[slot=byline-avatar]:grid-cols-[auto_1fr] data-[size=sm]:text-xs/5",
className
),
},
props
),
})
}
/**
* Holds the person's picture beside the name and description: a stock
* `Avatar`, an orb avatar or an image, 40px recommended. Use
* `render={<div />}` when the artwork has a block root.
*/
function BylineAvatar({
className,
render,
...props
}: useRender.ComponentProps<"span", BylineAvatarState>) {
return useRender({
defaultTagName: "span",
render,
state: { slot: "byline-avatar" },
props: mergeProps<"span">(
{ className: cn("row-span-2 flex", className) },
props
),
})
}
/** The person's name, 16px/24px semibold, held close to the line below; 12px regular in a `sm` byline. */
function BylineName({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-name"
className={cn(
"self-end text-base/6 font-semibold group-data-[size=sm]/byline:text-xs/5 group-data-[size=sm]/byline:font-normal",
className
)}
{...props}
/>
)
}
/**
* The second line under the name, such as a job title, a company, a handle
* or a date, in 14px/20px muted text; 12px in a `sm` byline.
*/
function BylineDescription({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-description"
className={cn("self-start text-muted-foreground", className)}
{...props}
/>
)
}
export { Byline, BylineAvatar, BylineName, BylineDescription }
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
// default is a quiet 14px line, cased as written; icon puts a 16px icon in
// front of it; mono is a 12px uppercase mono label for spec-sheet designs;
// caps is the same size in a sans face. tone picks the ink: muted (the
// default) or the surrounding text color, for a label over art or on a dark
// island where muted-foreground is too quiet.
const eyebrowVariants = cva("", {
variants: {
/**
* The label style. `default` (the default) is a 14px line at weight 500,
* cased as written. `icon` is the same line with a 16px icon, placed
* first among the children, 12px before the words. `mono` is a 12px
* uppercase mono label at weight 500 with 0.12em letter spacing. `caps`
* is the same label in the sans face, for a brand and series label such
* as "Studio Neri / Clay school". The color comes from `tone`.
*/
variant: {
default: "text-sm/5 font-medium",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
/**
* The ink. `muted` (the default) is `muted-foreground`. `ink` leaves the
* color to the surrounding text, for a label over art, on a dark island
* or anywhere the muted grey is too quiet to read.
*/
tone: {
muted: "text-muted-foreground",
ink: "",
},
},
defaultVariants: { variant: "default", tone: "muted" },
})
/**
* A short label set above a heading, such as a section name, rendered as a
* `<p>`. Leave 8px between it and the heading. Pass `render` to use another
* element.
*
* `default` is a 14px line at weight 500, cased as written. `icon` adds a
* 16px icon before the words: put the icon first, with `aria-hidden`. `mono`
* is a 12px uppercase mono label with 0.12em letter spacing; `caps` the same
* in the sans face, for a brand and series name such as "Studio Neri / Clay
* school". `tone="muted"` (the default) sets it in `muted-foreground`;
* `tone="ink"` takes the surrounding text color, for a label over art or on
* a dark island where the grey is too quiet.
*/
function Eyebrow({
className,
variant = "default",
tone = "muted",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant, tone },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant, tone }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import type { ComponentProps } from "react"
import { ArrowRightIcon } from "@phosphor-icons/react/dist/ssr"
import { cn } from "cn"
import { buttonVariants } from "@/components/ui/button"
import {
Card,
CardAction,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
/**
* A card for a headline, such as an article or a case study. Compose it from
* its parts: a `HeadlineCardHeader` holding an optional `HeadlineCardMeta`,
* the `HeadlineCardTitle`, a `HeadlineCardDescription` and a
* `HeadlineCardLink`, then a `HeadlineCardFooter` pushed to the bottom. It is
* the kit's `Card`, styled; at least 320px tall, with padding that grows from
* 32px to 40px on screens 42rem and wider. The title steps from 24px to 30px
* once the card is 24rem wide, reading the stock `card-header` container.
*
* It uses the card background unless you pass a surface utility, such as
* `surface-frost`, in `className`. Every part takes `className` to restyle it.
*/
function HeadlineCard({ className, ...props }: ComponentProps<typeof Card>) {
return (
<Card
data-slot="headline-card"
className={cn(
"min-h-80 gap-8 [--card-spacing:--spacing(8)] min-[42rem]:[--card-spacing:--spacing(10)]",
className
)}
{...props}
/>
)
}
/**
* The card's top block, which holds the meta, title, description and link.
* The stock `card-header` container, so the title steps on its width. The copy is capped at 28rem and
* the link sits at the far edge.
*/
function HeadlineCardHeader({
className,
...props
}: ComponentProps<typeof CardHeader>) {
return (
<CardHeader
data-slot="headline-card-header"
className={cn(
"grid-cols-[minmax(0,var(--container-md))] justify-between gap-4 has-data-[slot=card-action]:grid-cols-[minmax(0,var(--container-md))_auto]",
className
)}
{...props}
/>
)
}
/**
* A line above the headline, such as a category and a date. It takes any
* content and has no styling of its own.
*/
function HeadlineCardMeta({ className, ...props }: ComponentProps<"div">) {
return <div data-slot="headline-card-meta" className={className} {...props} />
}
/**
* The headline, read as a level-3 heading, in the body font (Geist). Pass
* `aria-level` to change the level.
*/
function HeadlineCardTitle({
className,
...props
}: ComponentProps<typeof CardTitle>) {
return (
<CardTitle
data-slot="headline-card-title"
role="heading"
aria-level={3}
className={cn(
"text-2xl/8 font-[450] tracking-[-0.04em] text-pretty @sm/card-header:text-3xl/9",
className
)}
{...props}
/>
)
}
/** The text under the headline, at 75% of the card's text color. */
function HeadlineCardDescription({
className,
...props
}: ComponentProps<typeof CardDescription>) {
return (
<CardDescription
data-slot="headline-card-description"
className={cn("text-base/7 text-pretty text-current/75", className)}
{...props}
/>
)
}
/**
* The round arrow link at the top right of the header. Give it an
* `aria-label`, such as "Read guide: …", since it shows only an icon; `href`
* is where it goes. `className` goes on the link itself.
*/
function HeadlineCardLink({ className, ...props }: ComponentProps<"a">) {
return (
<CardAction>
<a
data-slot="button"
className={cn(
buttonVariants({ variant: "secondary", size: "icon-lg" }),
className
)}
{...props}
>
<ArrowRightIcon aria-hidden="true" />
</a>
</CardAction>
)
}
/**
* The card's bottom row, pushed to the bottom: a wrapping flex row with the
* items centered and spread apart, 24px by 8px gaps, in 12px text. Put a
* `Byline size="sm"` on the left and a button or link on the right.
*/
function HeadlineCardFooter({
className,
...props
}: ComponentProps<typeof CardFooter>) {
return (
<CardFooter
data-slot="headline-card-footer"
className={cn(
"mt-auto flex-wrap justify-between gap-x-6 gap-y-2 text-xs/5",
className
)}
{...props}
/>
)
}
export {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardLink,
HeadlineCardMeta,
HeadlineCardTitle,
}
import type { ComponentProps } from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
import { Grid, type GridProps } from "@/components/grid/grid"
/**
* A list of `Stat` items laid out by `Grid`, rendered as a `ul`. It defaults
* to 3 columns and the large gap. Like `Grid`, its columns follow the width
* it is given, so size its parent to narrow it. `className` lands on the
* list.
*/
function StatGroup({
cols = 3,
gap = "lg",
...props
}: ComponentProps<"ul"> & {
/**
* The most columns, 3 by default. They step up as the list's space
* widens, the way `Grid`'s do.
*/
cols?: GridProps["cols"]
/**
* Space between stats: `xs` 8px, `sm` 16px, `md` 24px, `lg` 40px, `xl` 64px, `px` 1px, `none` 0. `lg`
* is the default.
*/
gap?: GridProps["gap"]
}) {
return (
<Grid
data-slot="stat-group"
render={<ul role="list" />}
cols={cols}
gap={gap}
// Grid's props are typed for its default div; this group renders a list.
{...(props as Omit<GridProps, "cols" | "gap">)}
/>
)
}
// card sets the stat on a filled panel; rule sets a line down its left side.
const statVariants = cva("grid content-start gap-2", {
variants: {
/**
* The stat style. `default` (the default) adds nothing. `card` sets it
* on a `rounded-xl` panel with 32px padding, filled with `muted`, or
* with `card` and `card-foreground` text in dark mode. `rule` draws a
* 1px line in `border` down its left side, 24px from the text.
*/
variant: {
default: "",
card: "rounded-xl bg-muted p-8 dark:bg-card dark:text-card-foreground",
rule: "border-l border-border pl-6",
},
},
defaultVariants: { variant: "default" },
})
/**
* One figure and its label, as an `li` inside `StatGroup`. Holds a
* `StatValue` and a `StatLabel`, stacked with 8px gaps.
*
* `card` sets it on a filled, rounded panel with 32px padding. `rule` draws a
* line down its left side.
*/
function Stat({
className,
variant = "default",
...props
}: ComponentProps<"li"> & VariantProps<typeof statVariants>) {
return (
<li
data-slot="stat"
data-variant={variant}
className={cn(statVariants({ variant }), className)}
{...props}
/>
)
}
/** The figure itself, such as a number or a percentage, at 32px in the body font. */
function StatValue({ className, ...props }: ComponentProps<"p">) {
return (
<p
data-slot="stat-value"
className={cn("text-[2rem]/10 tracking-tight", className)}
{...props}
/>
)
}
/**
* The caption under the figure: what it measures, in a few words. Small
* muted text, 14px on a 20px line, so the number carries the weight. Longer
* explanation belongs in the section's lead or a note, not here.
*/
function StatLabel({ className, ...props }: ComponentProps<"p">) {
return (
<p
data-slot="stat-label"
className={cn("text-sm/5 text-pretty text-muted-foreground", className)}
{...props}
/>
)
}
export { StatGroup, Stat, StatValue, StatLabel }
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
const GRID_DEFAULTS = { cols: 3, gap: "lg" } as const
// Columns follow the screen, stepping at 40rem and 48rem (and 64rem for six). Gap sizes read the shared --gap-*
// values in globals.css. The grid fills its parent's width: without that, a
// grid given `mx-auto` or set inside a centering parent shrinks to fit its
// content, and a part built on it that is a container collapses to nothing.
const containerGridVariants = cva("grid w-full grid-cols-1", {
variants: {
/**
* The most columns. Below 40rem of screen width the grid is one
* column (two for `6`); it steps up at 40rem and 48rem: `2` is two
* columns from 40rem, `3` two then three, `4` two then four, `5` three
* then five, and `6` three, then four, then six from 64rem. The default
* is 3.
*/
cols: {
1: "",
2: "sm:grid-cols-2",
3: "sm:grid-cols-2 md:grid-cols-3",
4: "sm:grid-cols-2 md:grid-cols-4",
5: "sm:grid-cols-3 md:grid-cols-5",
6: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6",
},
/**
* Space between items: `xs` 8px, `sm` 16px, `md` 24px, `lg` 40px, `xl` 64px, `px` 1px, `none` 0. `lg`
* is the default. The sizes are the `--gap-*` values in globals.css.
*/
gap: {
xs: "gap-(--gap-xs)",
sm: "gap-(--gap-sm)",
md: "gap-(--gap-md)",
lg: "gap-(--gap-lg)",
xl: "gap-(--gap-xl)",
px: "gap-px",
none: "gap-0",
},
},
defaultVariants: GRID_DEFAULTS,
})
type GridState = { slot: "grid" } & VariantProps<typeof containerGridVariants>
type GridProps = useRender.ComponentProps<"div", GridState> &
VariantProps<typeof containerGridVariants>
// className, render and every other prop go to the grid. To narrow a Grid,
// pass a `max-w-*` class or size its parent.
function Grid({
className,
cols = GRID_DEFAULTS.cols,
gap = GRID_DEFAULTS.gap,
render,
...props
}: GridProps) {
const grid = useRender({
defaultTagName: "div",
render,
state: { slot: "grid", cols, gap },
props: mergeProps<"div">(
{ className: cn(containerGridVariants({ cols, gap }), className) },
props
),
})
return grid
}
export { Grid, type GridProps }
Paper Editorialheadline-card-paper-editorial
Example of the Headline Card on warm cardstock for editorial content: a mono label, a large serif headline and a byline with a save button.
pnpm dlx shadcn add @01orbital/headline-card-paper-editorial"use client"
import { useState } from "react"
import {
Byline,
BylineDescription,
BylineName,
} from "@/components/byline/byline"
import {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardMeta,
HeadlineCardTitle,
} from "@/components/card/headline-card"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { Button } from "@/components/ui/button"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "The reading room / 01",
title: "What happens when a studio makes time to read?",
description:
"A shelf, an open hour, and a small change to the way a team shares what it knows.",
author: "Tamsin Verrow",
byline: "Studio notes · 6 min read",
cta: "Save for later",
saved: "Saved",
} as const
/** A HeadlineCard on warm cardstock: a mono label, a large Newsreader headline and a byline with a save button. */
export default function HeadlineCardPaperEditorial() {
const [saved, setSaved] = useState(false)
return (
<HeadlineCard className="surface-cardstock relative isolate w-full max-w-md min-w-0 [--font-display:var(--font-serif)]">
<HeadlineCardHeader>
<HeadlineCardMeta>
<Eyebrow variant="mono" tone="ink">
{COPY.eyebrow}
</Eyebrow>
</HeadlineCardMeta>
<HeadlineCardTitle className="font-display font-normal tracking-[-0.025em]">
{COPY.title}
</HeadlineCardTitle>
<HeadlineCardDescription>{COPY.description}</HeadlineCardDescription>
</HeadlineCardHeader>
<HeadlineCardFooter>
<Byline size="sm">
<BylineName>{COPY.author}</BylineName>
<BylineDescription>{COPY.byline}</BylineDescription>
</Byline>
<Button
variant="outline"
aria-pressed={saved}
onClick={() => setSaved(!saved)}
className="h-auto min-h-[38px] max-w-full py-[9px] text-center whitespace-normal"
>
{saved ? COPY.saved : COPY.cta}
</Button>
</HeadlineCardFooter>
</HeadlineCard>
)
}
import type { ComponentProps } from "react"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cn } from "cn"
type BylineSize = "md" | "sm"
type BylineState = { slot: "byline"; size: BylineSize }
type BylineAvatarState = { slot: "byline-avatar" }
/**
* A person's byline: an optional `BylineAvatar`, then `BylineName` with a
* `BylineDescription` under it, as a `div`. With an avatar it becomes two
* columns: the avatar spans both lines, 16px from the text. Under a quote,
* pass `render={<figcaption />}`; in a centered quote add `w-fit text-left` so it shrinks to fit
* and keeps its text left-aligned.
*
* At `size="md"` (the default) the name is 16px/24px semibold and the
* description 14px/20px muted, 2px apart; a 40px avatar matches the two
* lines. At `size="sm"` both lines are 12px/20px, the name in regular weight,
* the byline of a card footer.
*/
function Byline({
className,
size = "md",
render,
...props
}: useRender.ComponentProps<"div", BylineState> & {
/** The type size: `md` (the default) 16px over 14px, `sm` 12px over 12px for a card footer. */
size?: BylineSize
}) {
return useRender({
defaultTagName: "div",
render,
state: { slot: "byline", size },
props: mergeProps<"div">(
{
className: cn(
"group/byline grid items-center gap-x-4 gap-y-0.5 text-sm/5 has-data-[slot=byline-avatar]:grid-cols-[auto_1fr] data-[size=sm]:text-xs/5",
className
),
},
props
),
})
}
/**
* Holds the person's picture beside the name and description: a stock
* `Avatar`, an orb avatar or an image, 40px recommended. Use
* `render={<div />}` when the artwork has a block root.
*/
function BylineAvatar({
className,
render,
...props
}: useRender.ComponentProps<"span", BylineAvatarState>) {
return useRender({
defaultTagName: "span",
render,
state: { slot: "byline-avatar" },
props: mergeProps<"span">(
{ className: cn("row-span-2 flex", className) },
props
),
})
}
/** The person's name, 16px/24px semibold, held close to the line below; 12px regular in a `sm` byline. */
function BylineName({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-name"
className={cn(
"self-end text-base/6 font-semibold group-data-[size=sm]/byline:text-xs/5 group-data-[size=sm]/byline:font-normal",
className
)}
{...props}
/>
)
}
/**
* The second line under the name, such as a job title, a company, a handle
* or a date, in 14px/20px muted text; 12px in a `sm` byline.
*/
function BylineDescription({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-description"
className={cn("self-start text-muted-foreground", className)}
{...props}
/>
)
}
export { Byline, BylineAvatar, BylineName, BylineDescription }
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
// default is a quiet 14px line, cased as written; icon puts a 16px icon in
// front of it; mono is a 12px uppercase mono label for spec-sheet designs;
// caps is the same size in a sans face. tone picks the ink: muted (the
// default) or the surrounding text color, for a label over art or on a dark
// island where muted-foreground is too quiet.
const eyebrowVariants = cva("", {
variants: {
/**
* The label style. `default` (the default) is a 14px line at weight 500,
* cased as written. `icon` is the same line with a 16px icon, placed
* first among the children, 12px before the words. `mono` is a 12px
* uppercase mono label at weight 500 with 0.12em letter spacing. `caps`
* is the same label in the sans face, for a brand and series label such
* as "Studio Neri / Clay school". The color comes from `tone`.
*/
variant: {
default: "text-sm/5 font-medium",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
/**
* The ink. `muted` (the default) is `muted-foreground`. `ink` leaves the
* color to the surrounding text, for a label over art, on a dark island
* or anywhere the muted grey is too quiet to read.
*/
tone: {
muted: "text-muted-foreground",
ink: "",
},
},
defaultVariants: { variant: "default", tone: "muted" },
})
/**
* A short label set above a heading, such as a section name, rendered as a
* `<p>`. Leave 8px between it and the heading. Pass `render` to use another
* element.
*
* `default` is a 14px line at weight 500, cased as written. `icon` adds a
* 16px icon before the words: put the icon first, with `aria-hidden`. `mono`
* is a 12px uppercase mono label with 0.12em letter spacing; `caps` the same
* in the sans face, for a brand and series name such as "Studio Neri / Clay
* school". `tone="muted"` (the default) sets it in `muted-foreground`;
* `tone="ink"` takes the surrounding text color, for a label over art or on
* a dark island where the grey is too quiet.
*/
function Eyebrow({
className,
variant = "default",
tone = "muted",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant, tone },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant, tone }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import type { ComponentProps } from "react"
import { ArrowRightIcon } from "@phosphor-icons/react/dist/ssr"
import { cn } from "cn"
import { buttonVariants } from "@/components/ui/button"
import {
Card,
CardAction,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
/**
* A card for a headline, such as an article or a case study. Compose it from
* its parts: a `HeadlineCardHeader` holding an optional `HeadlineCardMeta`,
* the `HeadlineCardTitle`, a `HeadlineCardDescription` and a
* `HeadlineCardLink`, then a `HeadlineCardFooter` pushed to the bottom. It is
* the kit's `Card`, styled; at least 320px tall, with padding that grows from
* 32px to 40px on screens 42rem and wider. The title steps from 24px to 30px
* once the card is 24rem wide, reading the stock `card-header` container.
*
* It uses the card background unless you pass a surface utility, such as
* `surface-frost`, in `className`. Every part takes `className` to restyle it.
*/
function HeadlineCard({ className, ...props }: ComponentProps<typeof Card>) {
return (
<Card
data-slot="headline-card"
className={cn(
"min-h-80 gap-8 [--card-spacing:--spacing(8)] min-[42rem]:[--card-spacing:--spacing(10)]",
className
)}
{...props}
/>
)
}
/**
* The card's top block, which holds the meta, title, description and link.
* The stock `card-header` container, so the title steps on its width. The copy is capped at 28rem and
* the link sits at the far edge.
*/
function HeadlineCardHeader({
className,
...props
}: ComponentProps<typeof CardHeader>) {
return (
<CardHeader
data-slot="headline-card-header"
className={cn(
"grid-cols-[minmax(0,var(--container-md))] justify-between gap-4 has-data-[slot=card-action]:grid-cols-[minmax(0,var(--container-md))_auto]",
className
)}
{...props}
/>
)
}
/**
* A line above the headline, such as a category and a date. It takes any
* content and has no styling of its own.
*/
function HeadlineCardMeta({ className, ...props }: ComponentProps<"div">) {
return <div data-slot="headline-card-meta" className={className} {...props} />
}
/**
* The headline, read as a level-3 heading, in the body font (Geist). Pass
* `aria-level` to change the level.
*/
function HeadlineCardTitle({
className,
...props
}: ComponentProps<typeof CardTitle>) {
return (
<CardTitle
data-slot="headline-card-title"
role="heading"
aria-level={3}
className={cn(
"text-2xl/8 font-[450] tracking-[-0.04em] text-pretty @sm/card-header:text-3xl/9",
className
)}
{...props}
/>
)
}
/** The text under the headline, at 75% of the card's text color. */
function HeadlineCardDescription({
className,
...props
}: ComponentProps<typeof CardDescription>) {
return (
<CardDescription
data-slot="headline-card-description"
className={cn("text-base/7 text-pretty text-current/75", className)}
{...props}
/>
)
}
/**
* The round arrow link at the top right of the header. Give it an
* `aria-label`, such as "Read guide: …", since it shows only an icon; `href`
* is where it goes. `className` goes on the link itself.
*/
function HeadlineCardLink({ className, ...props }: ComponentProps<"a">) {
return (
<CardAction>
<a
data-slot="button"
className={cn(
buttonVariants({ variant: "secondary", size: "icon-lg" }),
className
)}
{...props}
>
<ArrowRightIcon aria-hidden="true" />
</a>
</CardAction>
)
}
/**
* The card's bottom row, pushed to the bottom: a wrapping flex row with the
* items centered and spread apart, 24px by 8px gaps, in 12px text. Put a
* `Byline size="sm"` on the left and a button or link on the right.
*/
function HeadlineCardFooter({
className,
...props
}: ComponentProps<typeof CardFooter>) {
return (
<CardFooter
data-slot="headline-card-footer"
className={cn(
"mt-auto flex-wrap justify-between gap-x-6 gap-y-2 text-xs/5",
className
)}
{...props}
/>
)
}
export {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardLink,
HeadlineCardMeta,
HeadlineCardTitle,
}
Frost Moonheadline-card-frost-moon
Example of the Headline Card with a blue moon rising behind the top corner: a large serif headline and a short reading note that opens in the footer.
pnpm dlx shadcn add @01orbital/headline-card-frost-moonThe source comes with full access.
One payment of $149 opens the source right here and lets the CLI install every paid component, with lifetime updates.
Jade Announcementheadline-card-jade-announcement
Example of the Headline Card as a product announcement: a jade glowing edge and a sans headline, with a link to the release.
pnpm dlx shadcn add @01orbital/headline-card-jade-announcementimport { cn } from "cn"
import {
Byline,
BylineDescription,
BylineName,
} from "@/components/byline/byline"
import {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardMeta,
HeadlineCardTitle,
} from "@/components/card/headline-card"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { buttonVariants } from "@/components/ui/button"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "Introducing Quillmere 2.0",
title: "One place for your next chapter.",
description:
"Projects, notes, and a shared picture of the week. Quillmere’s new workspace is ready to try.",
brand: "Quillmere",
byline: "Product update · November 2026",
cta: "See the workspace",
} as const
/** A HeadlineCard with a jade limned edge and a sans headline, for a product announcement with a link to the release. */
export default function HeadlineCardJadeAnnouncement() {
return (
<HeadlineCard className="theme-blue surface-limned relative isolate w-full max-w-md min-w-0">
<HeadlineCardHeader>
<HeadlineCardMeta>
<Eyebrow variant="mono" tone="ink">
{COPY.eyebrow}
</Eyebrow>
</HeadlineCardMeta>
<HeadlineCardTitle className="font-normal tracking-[-0.025em]">
{COPY.title}
</HeadlineCardTitle>
<HeadlineCardDescription>{COPY.description}</HeadlineCardDescription>
</HeadlineCardHeader>
<HeadlineCardFooter>
<Byline size="sm">
<BylineName>{COPY.brand}</BylineName>
<BylineDescription>{COPY.byline}</BylineDescription>
</Byline>
<a
href="#"
data-slot="button"
className={cn(
buttonVariants(),
"h-auto min-h-[38px] max-w-full py-[9px] text-center whitespace-normal"
)}
>
{COPY.cta}
</a>
</HeadlineCardFooter>
</HeadlineCard>
)
}
import type { ComponentProps } from "react"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cn } from "cn"
type BylineSize = "md" | "sm"
type BylineState = { slot: "byline"; size: BylineSize }
type BylineAvatarState = { slot: "byline-avatar" }
/**
* A person's byline: an optional `BylineAvatar`, then `BylineName` with a
* `BylineDescription` under it, as a `div`. With an avatar it becomes two
* columns: the avatar spans both lines, 16px from the text. Under a quote,
* pass `render={<figcaption />}`; in a centered quote add `w-fit text-left` so it shrinks to fit
* and keeps its text left-aligned.
*
* At `size="md"` (the default) the name is 16px/24px semibold and the
* description 14px/20px muted, 2px apart; a 40px avatar matches the two
* lines. At `size="sm"` both lines are 12px/20px, the name in regular weight,
* the byline of a card footer.
*/
function Byline({
className,
size = "md",
render,
...props
}: useRender.ComponentProps<"div", BylineState> & {
/** The type size: `md` (the default) 16px over 14px, `sm` 12px over 12px for a card footer. */
size?: BylineSize
}) {
return useRender({
defaultTagName: "div",
render,
state: { slot: "byline", size },
props: mergeProps<"div">(
{
className: cn(
"group/byline grid items-center gap-x-4 gap-y-0.5 text-sm/5 has-data-[slot=byline-avatar]:grid-cols-[auto_1fr] data-[size=sm]:text-xs/5",
className
),
},
props
),
})
}
/**
* Holds the person's picture beside the name and description: a stock
* `Avatar`, an orb avatar or an image, 40px recommended. Use
* `render={<div />}` when the artwork has a block root.
*/
function BylineAvatar({
className,
render,
...props
}: useRender.ComponentProps<"span", BylineAvatarState>) {
return useRender({
defaultTagName: "span",
render,
state: { slot: "byline-avatar" },
props: mergeProps<"span">(
{ className: cn("row-span-2 flex", className) },
props
),
})
}
/** The person's name, 16px/24px semibold, held close to the line below; 12px regular in a `sm` byline. */
function BylineName({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-name"
className={cn(
"self-end text-base/6 font-semibold group-data-[size=sm]/byline:text-xs/5 group-data-[size=sm]/byline:font-normal",
className
)}
{...props}
/>
)
}
/**
* The second line under the name, such as a job title, a company, a handle
* or a date, in 14px/20px muted text; 12px in a `sm` byline.
*/
function BylineDescription({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-description"
className={cn("self-start text-muted-foreground", className)}
{...props}
/>
)
}
export { Byline, BylineAvatar, BylineName, BylineDescription }
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
// default is a quiet 14px line, cased as written; icon puts a 16px icon in
// front of it; mono is a 12px uppercase mono label for spec-sheet designs;
// caps is the same size in a sans face. tone picks the ink: muted (the
// default) or the surrounding text color, for a label over art or on a dark
// island where muted-foreground is too quiet.
const eyebrowVariants = cva("", {
variants: {
/**
* The label style. `default` (the default) is a 14px line at weight 500,
* cased as written. `icon` is the same line with a 16px icon, placed
* first among the children, 12px before the words. `mono` is a 12px
* uppercase mono label at weight 500 with 0.12em letter spacing. `caps`
* is the same label in the sans face, for a brand and series label such
* as "Studio Neri / Clay school". The color comes from `tone`.
*/
variant: {
default: "text-sm/5 font-medium",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
/**
* The ink. `muted` (the default) is `muted-foreground`. `ink` leaves the
* color to the surrounding text, for a label over art, on a dark island
* or anywhere the muted grey is too quiet to read.
*/
tone: {
muted: "text-muted-foreground",
ink: "",
},
},
defaultVariants: { variant: "default", tone: "muted" },
})
/**
* A short label set above a heading, such as a section name, rendered as a
* `<p>`. Leave 8px between it and the heading. Pass `render` to use another
* element.
*
* `default` is a 14px line at weight 500, cased as written. `icon` adds a
* 16px icon before the words: put the icon first, with `aria-hidden`. `mono`
* is a 12px uppercase mono label with 0.12em letter spacing; `caps` the same
* in the sans face, for a brand and series name such as "Studio Neri / Clay
* school". `tone="muted"` (the default) sets it in `muted-foreground`;
* `tone="ink"` takes the surrounding text color, for a label over art or on
* a dark island where the grey is too quiet.
*/
function Eyebrow({
className,
variant = "default",
tone = "muted",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant, tone },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant, tone }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import type { ComponentProps } from "react"
import { ArrowRightIcon } from "@phosphor-icons/react/dist/ssr"
import { cn } from "cn"
import { buttonVariants } from "@/components/ui/button"
import {
Card,
CardAction,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
/**
* A card for a headline, such as an article or a case study. Compose it from
* its parts: a `HeadlineCardHeader` holding an optional `HeadlineCardMeta`,
* the `HeadlineCardTitle`, a `HeadlineCardDescription` and a
* `HeadlineCardLink`, then a `HeadlineCardFooter` pushed to the bottom. It is
* the kit's `Card`, styled; at least 320px tall, with padding that grows from
* 32px to 40px on screens 42rem and wider. The title steps from 24px to 30px
* once the card is 24rem wide, reading the stock `card-header` container.
*
* It uses the card background unless you pass a surface utility, such as
* `surface-frost`, in `className`. Every part takes `className` to restyle it.
*/
function HeadlineCard({ className, ...props }: ComponentProps<typeof Card>) {
return (
<Card
data-slot="headline-card"
className={cn(
"min-h-80 gap-8 [--card-spacing:--spacing(8)] min-[42rem]:[--card-spacing:--spacing(10)]",
className
)}
{...props}
/>
)
}
/**
* The card's top block, which holds the meta, title, description and link.
* The stock `card-header` container, so the title steps on its width. The copy is capped at 28rem and
* the link sits at the far edge.
*/
function HeadlineCardHeader({
className,
...props
}: ComponentProps<typeof CardHeader>) {
return (
<CardHeader
data-slot="headline-card-header"
className={cn(
"grid-cols-[minmax(0,var(--container-md))] justify-between gap-4 has-data-[slot=card-action]:grid-cols-[minmax(0,var(--container-md))_auto]",
className
)}
{...props}
/>
)
}
/**
* A line above the headline, such as a category and a date. It takes any
* content and has no styling of its own.
*/
function HeadlineCardMeta({ className, ...props }: ComponentProps<"div">) {
return <div data-slot="headline-card-meta" className={className} {...props} />
}
/**
* The headline, read as a level-3 heading, in the body font (Geist). Pass
* `aria-level` to change the level.
*/
function HeadlineCardTitle({
className,
...props
}: ComponentProps<typeof CardTitle>) {
return (
<CardTitle
data-slot="headline-card-title"
role="heading"
aria-level={3}
className={cn(
"text-2xl/8 font-[450] tracking-[-0.04em] text-pretty @sm/card-header:text-3xl/9",
className
)}
{...props}
/>
)
}
/** The text under the headline, at 75% of the card's text color. */
function HeadlineCardDescription({
className,
...props
}: ComponentProps<typeof CardDescription>) {
return (
<CardDescription
data-slot="headline-card-description"
className={cn("text-base/7 text-pretty text-current/75", className)}
{...props}
/>
)
}
/**
* The round arrow link at the top right of the header. Give it an
* `aria-label`, such as "Read guide: …", since it shows only an icon; `href`
* is where it goes. `className` goes on the link itself.
*/
function HeadlineCardLink({ className, ...props }: ComponentProps<"a">) {
return (
<CardAction>
<a
data-slot="button"
className={cn(
buttonVariants({ variant: "secondary", size: "icon-lg" }),
className
)}
{...props}
>
<ArrowRightIcon aria-hidden="true" />
</a>
</CardAction>
)
}
/**
* The card's bottom row, pushed to the bottom: a wrapping flex row with the
* items centered and spread apart, 24px by 8px gaps, in 12px text. Put a
* `Byline size="sm"` on the left and a button or link on the right.
*/
function HeadlineCardFooter({
className,
...props
}: ComponentProps<typeof CardFooter>) {
return (
<CardFooter
data-slot="headline-card-footer"
className={cn(
"mt-auto flex-wrap justify-between gap-x-6 gap-y-2 text-xs/5",
className
)}
{...props}
/>
)
}
export {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardLink,
HeadlineCardMeta,
HeadlineCardTitle,
}
Linen Interviewheadline-card-linen-interview
Example of the Headline Card with a fine linen texture and tighter corners, carrying a long quotation as its headline for an interview.
pnpm dlx shadcn add @01orbital/headline-card-linen-interviewimport {
Byline,
BylineDescription,
BylineName,
} from "@/components/byline/byline"
import {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardMeta,
HeadlineCardTitle,
} from "@/components/card/headline-card"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { Linen } from "@/components/texture/linen"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "In conversation",
title: "“We stopped asking for updates and started sharing the work.”",
description:
"A conversation about the small habits that made a busy design team feel less busy.",
author: "Odessa Varn",
byline: "Verdane Practice · sample interview",
} as const
/** A HeadlineCard with a fine linen texture and tighter corners, carrying a long quotation as its headline. */
export default function HeadlineCardLinenInterview() {
return (
<HeadlineCard className="theme-sand relative isolate w-full max-w-md min-w-0 rounded-[8px] [--font-display:var(--font-serif)]">
<HeadlineCardHeader>
<HeadlineCardMeta>
<Linen intensity="fine" className="" />
<Eyebrow variant="mono" tone="ink" className="relative z-2">
{COPY.eyebrow}
</Eyebrow>
</HeadlineCardMeta>
<HeadlineCardTitle className="relative z-2 font-display font-normal tracking-[-0.025em]">
{COPY.title}
</HeadlineCardTitle>
<HeadlineCardDescription className="relative z-2">
{COPY.description}
</HeadlineCardDescription>
</HeadlineCardHeader>
<HeadlineCardFooter>
<Byline size="sm">
<BylineName>{COPY.author}</BylineName>
<BylineDescription>{COPY.byline}</BylineDescription>
</Byline>
</HeadlineCardFooter>
</HeadlineCard>
)
}
import type { ComponentProps } from "react"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cn } from "cn"
type BylineSize = "md" | "sm"
type BylineState = { slot: "byline"; size: BylineSize }
type BylineAvatarState = { slot: "byline-avatar" }
/**
* A person's byline: an optional `BylineAvatar`, then `BylineName` with a
* `BylineDescription` under it, as a `div`. With an avatar it becomes two
* columns: the avatar spans both lines, 16px from the text. Under a quote,
* pass `render={<figcaption />}`; in a centered quote add `w-fit text-left` so it shrinks to fit
* and keeps its text left-aligned.
*
* At `size="md"` (the default) the name is 16px/24px semibold and the
* description 14px/20px muted, 2px apart; a 40px avatar matches the two
* lines. At `size="sm"` both lines are 12px/20px, the name in regular weight,
* the byline of a card footer.
*/
function Byline({
className,
size = "md",
render,
...props
}: useRender.ComponentProps<"div", BylineState> & {
/** The type size: `md` (the default) 16px over 14px, `sm` 12px over 12px for a card footer. */
size?: BylineSize
}) {
return useRender({
defaultTagName: "div",
render,
state: { slot: "byline", size },
props: mergeProps<"div">(
{
className: cn(
"group/byline grid items-center gap-x-4 gap-y-0.5 text-sm/5 has-data-[slot=byline-avatar]:grid-cols-[auto_1fr] data-[size=sm]:text-xs/5",
className
),
},
props
),
})
}
/**
* Holds the person's picture beside the name and description: a stock
* `Avatar`, an orb avatar or an image, 40px recommended. Use
* `render={<div />}` when the artwork has a block root.
*/
function BylineAvatar({
className,
render,
...props
}: useRender.ComponentProps<"span", BylineAvatarState>) {
return useRender({
defaultTagName: "span",
render,
state: { slot: "byline-avatar" },
props: mergeProps<"span">(
{ className: cn("row-span-2 flex", className) },
props
),
})
}
/** The person's name, 16px/24px semibold, held close to the line below; 12px regular in a `sm` byline. */
function BylineName({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-name"
className={cn(
"self-end text-base/6 font-semibold group-data-[size=sm]/byline:text-xs/5 group-data-[size=sm]/byline:font-normal",
className
)}
{...props}
/>
)
}
/**
* The second line under the name, such as a job title, a company, a handle
* or a date, in 14px/20px muted text; 12px in a `sm` byline.
*/
function BylineDescription({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-description"
className={cn("self-start text-muted-foreground", className)}
{...props}
/>
)
}
export { Byline, BylineAvatar, BylineName, BylineDescription }
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
// default is a quiet 14px line, cased as written; icon puts a 16px icon in
// front of it; mono is a 12px uppercase mono label for spec-sheet designs;
// caps is the same size in a sans face. tone picks the ink: muted (the
// default) or the surrounding text color, for a label over art or on a dark
// island where muted-foreground is too quiet.
const eyebrowVariants = cva("", {
variants: {
/**
* The label style. `default` (the default) is a 14px line at weight 500,
* cased as written. `icon` is the same line with a 16px icon, placed
* first among the children, 12px before the words. `mono` is a 12px
* uppercase mono label at weight 500 with 0.12em letter spacing. `caps`
* is the same label in the sans face, for a brand and series label such
* as "Studio Neri / Clay school". The color comes from `tone`.
*/
variant: {
default: "text-sm/5 font-medium",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
/**
* The ink. `muted` (the default) is `muted-foreground`. `ink` leaves the
* color to the surrounding text, for a label over art, on a dark island
* or anywhere the muted grey is too quiet to read.
*/
tone: {
muted: "text-muted-foreground",
ink: "",
},
},
defaultVariants: { variant: "default", tone: "muted" },
})
/**
* A short label set above a heading, such as a section name, rendered as a
* `<p>`. Leave 8px between it and the heading. Pass `render` to use another
* element.
*
* `default` is a 14px line at weight 500, cased as written. `icon` adds a
* 16px icon before the words: put the icon first, with `aria-hidden`. `mono`
* is a 12px uppercase mono label with 0.12em letter spacing; `caps` the same
* in the sans face, for a brand and series name such as "Studio Neri / Clay
* school". `tone="muted"` (the default) sets it in `muted-foreground`;
* `tone="ink"` takes the surrounding text color, for a label over art or on
* a dark island where the grey is too quiet.
*/
function Eyebrow({
className,
variant = "default",
tone = "muted",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant, tone },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant, tone }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import type { ComponentProps } from "react"
import { ArrowRightIcon } from "@phosphor-icons/react/dist/ssr"
import { cn } from "cn"
import { buttonVariants } from "@/components/ui/button"
import {
Card,
CardAction,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
/**
* A card for a headline, such as an article or a case study. Compose it from
* its parts: a `HeadlineCardHeader` holding an optional `HeadlineCardMeta`,
* the `HeadlineCardTitle`, a `HeadlineCardDescription` and a
* `HeadlineCardLink`, then a `HeadlineCardFooter` pushed to the bottom. It is
* the kit's `Card`, styled; at least 320px tall, with padding that grows from
* 32px to 40px on screens 42rem and wider. The title steps from 24px to 30px
* once the card is 24rem wide, reading the stock `card-header` container.
*
* It uses the card background unless you pass a surface utility, such as
* `surface-frost`, in `className`. Every part takes `className` to restyle it.
*/
function HeadlineCard({ className, ...props }: ComponentProps<typeof Card>) {
return (
<Card
data-slot="headline-card"
className={cn(
"min-h-80 gap-8 [--card-spacing:--spacing(8)] min-[42rem]:[--card-spacing:--spacing(10)]",
className
)}
{...props}
/>
)
}
/**
* The card's top block, which holds the meta, title, description and link.
* The stock `card-header` container, so the title steps on its width. The copy is capped at 28rem and
* the link sits at the far edge.
*/
function HeadlineCardHeader({
className,
...props
}: ComponentProps<typeof CardHeader>) {
return (
<CardHeader
data-slot="headline-card-header"
className={cn(
"grid-cols-[minmax(0,var(--container-md))] justify-between gap-4 has-data-[slot=card-action]:grid-cols-[minmax(0,var(--container-md))_auto]",
className
)}
{...props}
/>
)
}
/**
* A line above the headline, such as a category and a date. It takes any
* content and has no styling of its own.
*/
function HeadlineCardMeta({ className, ...props }: ComponentProps<"div">) {
return <div data-slot="headline-card-meta" className={className} {...props} />
}
/**
* The headline, read as a level-3 heading, in the body font (Geist). Pass
* `aria-level` to change the level.
*/
function HeadlineCardTitle({
className,
...props
}: ComponentProps<typeof CardTitle>) {
return (
<CardTitle
data-slot="headline-card-title"
role="heading"
aria-level={3}
className={cn(
"text-2xl/8 font-[450] tracking-[-0.04em] text-pretty @sm/card-header:text-3xl/9",
className
)}
{...props}
/>
)
}
/** The text under the headline, at 75% of the card's text color. */
function HeadlineCardDescription({
className,
...props
}: ComponentProps<typeof CardDescription>) {
return (
<CardDescription
data-slot="headline-card-description"
className={cn("text-base/7 text-pretty text-current/75", className)}
{...props}
/>
)
}
/**
* The round arrow link at the top right of the header. Give it an
* `aria-label`, such as "Read guide: …", since it shows only an icon; `href`
* is where it goes. `className` goes on the link itself.
*/
function HeadlineCardLink({ className, ...props }: ComponentProps<"a">) {
return (
<CardAction>
<a
data-slot="button"
className={cn(
buttonVariants({ variant: "secondary", size: "icon-lg" }),
className
)}
{...props}
>
<ArrowRightIcon aria-hidden="true" />
</a>
</CardAction>
)
}
/**
* The card's bottom row, pushed to the bottom: a wrapping flex row with the
* items centered and spread apart, 24px by 8px gaps, in 12px text. Put a
* `Byline size="sm"` on the left and a button or link on the right.
*/
function HeadlineCardFooter({
className,
...props
}: ComponentProps<typeof CardFooter>) {
return (
<CardFooter
data-slot="headline-card-footer"
className={cn(
"mt-auto flex-wrap justify-between gap-x-6 gap-y-2 text-xs/5",
className
)}
{...props}
/>
)
}
export {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardLink,
HeadlineCardMeta,
HeadlineCardTitle,
}
import { cn } from "cn"
type Intensity = "fine" | "default" | "rich"
// One scale for every texture; `default` is the unscaled value.
const INTENSITY_MULT: Record<Intensity, number> = {
fine: 0.6,
default: 1,
rich: 1.45,
}
const alpha = (base: number, mult: number) => (base * mult).toFixed(4)
// Full-bleed art layer — drop inside a `relative` parent; sits behind content.
// Two-direction weave — 1px threads at 0°+90°. 5px and 6px are the thread
// PERIODS, not gaps, and they are coprime, so the weave repeats every 30px.
function Linen({
intensity = "default",
className,
...props
}: React.ComponentProps<"div"> & {
// Thread alpha multiplier. Ink is white; set --linen-color on a light ground.
intensity?: Intensity
}) {
const m = INTENSITY_MULT[intensity]
return (
<div
className={cn("pointer-events-none absolute inset-0", className)}
aria-hidden="true"
data-slot="linen"
{...props}
>
<div
className="absolute inset-0"
style={{
backgroundImage: `repeating-linear-gradient(90deg in srgb, transparent 0px, transparent 2px, oklch(from var(--linen-color, oklch(1 0 0)) l c h / ${alpha(0.05, m)}) 2px, oklch(from var(--linen-color, oklch(1 0 0)) l c h / ${alpha(0.02, m)}) 3px, transparent 3px, transparent 6px), repeating-linear-gradient(0deg in srgb, transparent 0px, transparent 2px, oklch(from var(--linen-color, oklch(1 0 0)) l c h / ${alpha(0.06, m)}) 2px, oklch(from var(--linen-color, oklch(1 0 0)) l c h / ${alpha(0.02, m)}) 3px, transparent 3px, transparent 5px)`,
}}
/>
</div>
)
}
export { Linen }
Event Date Headline Cardheadline-card-clay-event
Example of the Headline Card for an event: an oversized serif date above the headline and expandable event details in the footer.
pnpm dlx shadcn add @01orbital/headline-card-clay-eventimport {
Byline,
BylineDescription,
BylineName,
} from "@/components/byline/byline"
import {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardMeta,
HeadlineCardTitle,
} from "@/components/card/headline-card"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "November / workshop",
title: "Bring a notebook. Leave with a first draft.",
description:
"An afternoon of writing, editing, and talking through the parts that won’t quite fit.",
organizer: "Harrowgate Press",
when: "Thursday, November 19 · 2–5 pm",
summary: "Workshop details",
note: "A small group session for people with a draft in progress. Bring something unfinished and a willingness to read it aloud. Sample event listing.",
day: "19",
} as const
/** A HeadlineCard: an oversized Newsreader date above the headline and expandable event details in the footer. */
export default function HeadlineCardClayEvent() {
return (
<HeadlineCard className="theme-clay relative isolate w-full max-w-md min-w-0 shadow-none [--font-display:var(--font-serif)]">
<HeadlineCardHeader>
<HeadlineCardMeta>
<div className="grid gap-4">
<Eyebrow variant="mono" tone="ink">
{COPY.eyebrow}
</Eyebrow>
<p className="relative font-display text-[80px]/none tracking-[-0.05em]">
{COPY.day}
</p>
</div>
</HeadlineCardMeta>
<HeadlineCardTitle className="font-display font-normal tracking-[-0.025em]">
{COPY.title}
</HeadlineCardTitle>
<HeadlineCardDescription>{COPY.description}</HeadlineCardDescription>
</HeadlineCardHeader>
<HeadlineCardFooter>
<Byline size="sm">
<BylineName>{COPY.organizer}</BylineName>
<BylineDescription>{COPY.when}</BylineDescription>
</Byline>
<details className="w-full text-sm/6">
<summary className="w-fit cursor-pointer list-none py-1 underline underline-offset-4 [&::-webkit-details-marker]:hidden">
{COPY.summary}
</summary>
<div className="pt-4 text-muted-foreground">
<p>{COPY.note}</p>
</div>
</details>
</HeadlineCardFooter>
</HeadlineCard>
)
}
import type { ComponentProps } from "react"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cn } from "cn"
type BylineSize = "md" | "sm"
type BylineState = { slot: "byline"; size: BylineSize }
type BylineAvatarState = { slot: "byline-avatar" }
/**
* A person's byline: an optional `BylineAvatar`, then `BylineName` with a
* `BylineDescription` under it, as a `div`. With an avatar it becomes two
* columns: the avatar spans both lines, 16px from the text. Under a quote,
* pass `render={<figcaption />}`; in a centered quote add `w-fit text-left` so it shrinks to fit
* and keeps its text left-aligned.
*
* At `size="md"` (the default) the name is 16px/24px semibold and the
* description 14px/20px muted, 2px apart; a 40px avatar matches the two
* lines. At `size="sm"` both lines are 12px/20px, the name in regular weight,
* the byline of a card footer.
*/
function Byline({
className,
size = "md",
render,
...props
}: useRender.ComponentProps<"div", BylineState> & {
/** The type size: `md` (the default) 16px over 14px, `sm` 12px over 12px for a card footer. */
size?: BylineSize
}) {
return useRender({
defaultTagName: "div",
render,
state: { slot: "byline", size },
props: mergeProps<"div">(
{
className: cn(
"group/byline grid items-center gap-x-4 gap-y-0.5 text-sm/5 has-data-[slot=byline-avatar]:grid-cols-[auto_1fr] data-[size=sm]:text-xs/5",
className
),
},
props
),
})
}
/**
* Holds the person's picture beside the name and description: a stock
* `Avatar`, an orb avatar or an image, 40px recommended. Use
* `render={<div />}` when the artwork has a block root.
*/
function BylineAvatar({
className,
render,
...props
}: useRender.ComponentProps<"span", BylineAvatarState>) {
return useRender({
defaultTagName: "span",
render,
state: { slot: "byline-avatar" },
props: mergeProps<"span">(
{ className: cn("row-span-2 flex", className) },
props
),
})
}
/** The person's name, 16px/24px semibold, held close to the line below; 12px regular in a `sm` byline. */
function BylineName({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-name"
className={cn(
"self-end text-base/6 font-semibold group-data-[size=sm]/byline:text-xs/5 group-data-[size=sm]/byline:font-normal",
className
)}
{...props}
/>
)
}
/**
* The second line under the name, such as a job title, a company, a handle
* or a date, in 14px/20px muted text; 12px in a `sm` byline.
*/
function BylineDescription({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-description"
className={cn("self-start text-muted-foreground", className)}
{...props}
/>
)
}
export { Byline, BylineAvatar, BylineName, BylineDescription }
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
// default is a quiet 14px line, cased as written; icon puts a 16px icon in
// front of it; mono is a 12px uppercase mono label for spec-sheet designs;
// caps is the same size in a sans face. tone picks the ink: muted (the
// default) or the surrounding text color, for a label over art or on a dark
// island where muted-foreground is too quiet.
const eyebrowVariants = cva("", {
variants: {
/**
* The label style. `default` (the default) is a 14px line at weight 500,
* cased as written. `icon` is the same line with a 16px icon, placed
* first among the children, 12px before the words. `mono` is a 12px
* uppercase mono label at weight 500 with 0.12em letter spacing. `caps`
* is the same label in the sans face, for a brand and series label such
* as "Studio Neri / Clay school". The color comes from `tone`.
*/
variant: {
default: "text-sm/5 font-medium",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
/**
* The ink. `muted` (the default) is `muted-foreground`. `ink` leaves the
* color to the surrounding text, for a label over art, on a dark island
* or anywhere the muted grey is too quiet to read.
*/
tone: {
muted: "text-muted-foreground",
ink: "",
},
},
defaultVariants: { variant: "default", tone: "muted" },
})
/**
* A short label set above a heading, such as a section name, rendered as a
* `<p>`. Leave 8px between it and the heading. Pass `render` to use another
* element.
*
* `default` is a 14px line at weight 500, cased as written. `icon` adds a
* 16px icon before the words: put the icon first, with `aria-hidden`. `mono`
* is a 12px uppercase mono label with 0.12em letter spacing; `caps` the same
* in the sans face, for a brand and series name such as "Studio Neri / Clay
* school". `tone="muted"` (the default) sets it in `muted-foreground`;
* `tone="ink"` takes the surrounding text color, for a label over art or on
* a dark island where the grey is too quiet.
*/
function Eyebrow({
className,
variant = "default",
tone = "muted",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant, tone },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant, tone }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import type { ComponentProps } from "react"
import { ArrowRightIcon } from "@phosphor-icons/react/dist/ssr"
import { cn } from "cn"
import { buttonVariants } from "@/components/ui/button"
import {
Card,
CardAction,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
/**
* A card for a headline, such as an article or a case study. Compose it from
* its parts: a `HeadlineCardHeader` holding an optional `HeadlineCardMeta`,
* the `HeadlineCardTitle`, a `HeadlineCardDescription` and a
* `HeadlineCardLink`, then a `HeadlineCardFooter` pushed to the bottom. It is
* the kit's `Card`, styled; at least 320px tall, with padding that grows from
* 32px to 40px on screens 42rem and wider. The title steps from 24px to 30px
* once the card is 24rem wide, reading the stock `card-header` container.
*
* It uses the card background unless you pass a surface utility, such as
* `surface-frost`, in `className`. Every part takes `className` to restyle it.
*/
function HeadlineCard({ className, ...props }: ComponentProps<typeof Card>) {
return (
<Card
data-slot="headline-card"
className={cn(
"min-h-80 gap-8 [--card-spacing:--spacing(8)] min-[42rem]:[--card-spacing:--spacing(10)]",
className
)}
{...props}
/>
)
}
/**
* The card's top block, which holds the meta, title, description and link.
* The stock `card-header` container, so the title steps on its width. The copy is capped at 28rem and
* the link sits at the far edge.
*/
function HeadlineCardHeader({
className,
...props
}: ComponentProps<typeof CardHeader>) {
return (
<CardHeader
data-slot="headline-card-header"
className={cn(
"grid-cols-[minmax(0,var(--container-md))] justify-between gap-4 has-data-[slot=card-action]:grid-cols-[minmax(0,var(--container-md))_auto]",
className
)}
{...props}
/>
)
}
/**
* A line above the headline, such as a category and a date. It takes any
* content and has no styling of its own.
*/
function HeadlineCardMeta({ className, ...props }: ComponentProps<"div">) {
return <div data-slot="headline-card-meta" className={className} {...props} />
}
/**
* The headline, read as a level-3 heading, in the body font (Geist). Pass
* `aria-level` to change the level.
*/
function HeadlineCardTitle({
className,
...props
}: ComponentProps<typeof CardTitle>) {
return (
<CardTitle
data-slot="headline-card-title"
role="heading"
aria-level={3}
className={cn(
"text-2xl/8 font-[450] tracking-[-0.04em] text-pretty @sm/card-header:text-3xl/9",
className
)}
{...props}
/>
)
}
/** The text under the headline, at 75% of the card's text color. */
function HeadlineCardDescription({
className,
...props
}: ComponentProps<typeof CardDescription>) {
return (
<CardDescription
data-slot="headline-card-description"
className={cn("text-base/7 text-pretty text-current/75", className)}
{...props}
/>
)
}
/**
* The round arrow link at the top right of the header. Give it an
* `aria-label`, such as "Read guide: …", since it shows only an icon; `href`
* is where it goes. `className` goes on the link itself.
*/
function HeadlineCardLink({ className, ...props }: ComponentProps<"a">) {
return (
<CardAction>
<a
data-slot="button"
className={cn(
buttonVariants({ variant: "secondary", size: "icon-lg" }),
className
)}
{...props}
>
<ArrowRightIcon aria-hidden="true" />
</a>
</CardAction>
)
}
/**
* The card's bottom row, pushed to the bottom: a wrapping flex row with the
* items centered and spread apart, 24px by 8px gaps, in 12px text. Put a
* `Byline size="sm"` on the left and a button or link on the right.
*/
function HeadlineCardFooter({
className,
...props
}: ComponentProps<typeof CardFooter>) {
return (
<CardFooter
data-slot="headline-card-footer"
className={cn(
"mt-auto flex-wrap justify-between gap-x-6 gap-y-2 text-xs/5",
className
)}
{...props}
/>
)
}
export {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardLink,
HeadlineCardMeta,
HeadlineCardTitle,
}
Outline Readingheadline-card-outline-reading
Example of the Headline Card as a plain outlined reading card with no fill and a checklist that opens in the footer.
pnpm dlx shadcn add @01orbital/headline-card-outline-readingimport {
Byline,
BylineDescription,
BylineName,
} from "@/components/byline/byline"
import {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardMeta,
HeadlineCardTitle,
} from "@/components/card/headline-card"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "The weekly review / No. 08",
title: "A useful meeting starts before the meeting.",
description:
"Five things to put in the invitation, and one thing to leave out.",
author: "Kjell Lindgren",
byline: "Ways of working · 4 min read",
summary: "Read the checklist",
note: "Give the meeting a purpose, a decision to make, a little context, a time limit, and someone to move it forward. Leave the status updates in the project notes.",
} as const
/** An outlined HeadlineCard and no fill, in the site font, for a straightforward reading card with a checklist that opens in the footer. */
export default function HeadlineCardOutlineReading() {
return (
<HeadlineCard className="relative isolate w-full max-w-md min-w-0 border border-border bg-card shadow-none">
<HeadlineCardHeader>
<HeadlineCardMeta>
<Eyebrow variant="mono" tone="ink">
{COPY.eyebrow}
</Eyebrow>
</HeadlineCardMeta>
<HeadlineCardTitle className="font-normal tracking-[-0.025em]">
{COPY.title}
</HeadlineCardTitle>
<HeadlineCardDescription>{COPY.description}</HeadlineCardDescription>
</HeadlineCardHeader>
<HeadlineCardFooter>
<Byline size="sm">
<BylineName>{COPY.author}</BylineName>
<BylineDescription>{COPY.byline}</BylineDescription>
</Byline>
<details className="w-full text-sm/6">
<summary className="w-fit cursor-pointer list-none py-1 underline underline-offset-4 [&::-webkit-details-marker]:hidden">
{COPY.summary}
</summary>
<div className="pt-4 text-muted-foreground">
<p>{COPY.note}</p>
</div>
</details>
</HeadlineCardFooter>
</HeadlineCard>
)
}
import type { ComponentProps } from "react"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cn } from "cn"
type BylineSize = "md" | "sm"
type BylineState = { slot: "byline"; size: BylineSize }
type BylineAvatarState = { slot: "byline-avatar" }
/**
* A person's byline: an optional `BylineAvatar`, then `BylineName` with a
* `BylineDescription` under it, as a `div`. With an avatar it becomes two
* columns: the avatar spans both lines, 16px from the text. Under a quote,
* pass `render={<figcaption />}`; in a centered quote add `w-fit text-left` so it shrinks to fit
* and keeps its text left-aligned.
*
* At `size="md"` (the default) the name is 16px/24px semibold and the
* description 14px/20px muted, 2px apart; a 40px avatar matches the two
* lines. At `size="sm"` both lines are 12px/20px, the name in regular weight,
* the byline of a card footer.
*/
function Byline({
className,
size = "md",
render,
...props
}: useRender.ComponentProps<"div", BylineState> & {
/** The type size: `md` (the default) 16px over 14px, `sm` 12px over 12px for a card footer. */
size?: BylineSize
}) {
return useRender({
defaultTagName: "div",
render,
state: { slot: "byline", size },
props: mergeProps<"div">(
{
className: cn(
"group/byline grid items-center gap-x-4 gap-y-0.5 text-sm/5 has-data-[slot=byline-avatar]:grid-cols-[auto_1fr] data-[size=sm]:text-xs/5",
className
),
},
props
),
})
}
/**
* Holds the person's picture beside the name and description: a stock
* `Avatar`, an orb avatar or an image, 40px recommended. Use
* `render={<div />}` when the artwork has a block root.
*/
function BylineAvatar({
className,
render,
...props
}: useRender.ComponentProps<"span", BylineAvatarState>) {
return useRender({
defaultTagName: "span",
render,
state: { slot: "byline-avatar" },
props: mergeProps<"span">(
{ className: cn("row-span-2 flex", className) },
props
),
})
}
/** The person's name, 16px/24px semibold, held close to the line below; 12px regular in a `sm` byline. */
function BylineName({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-name"
className={cn(
"self-end text-base/6 font-semibold group-data-[size=sm]/byline:text-xs/5 group-data-[size=sm]/byline:font-normal",
className
)}
{...props}
/>
)
}
/**
* The second line under the name, such as a job title, a company, a handle
* or a date, in 14px/20px muted text; 12px in a `sm` byline.
*/
function BylineDescription({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-description"
className={cn("self-start text-muted-foreground", className)}
{...props}
/>
)
}
export { Byline, BylineAvatar, BylineName, BylineDescription }
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
// default is a quiet 14px line, cased as written; icon puts a 16px icon in
// front of it; mono is a 12px uppercase mono label for spec-sheet designs;
// caps is the same size in a sans face. tone picks the ink: muted (the
// default) or the surrounding text color, for a label over art or on a dark
// island where muted-foreground is too quiet.
const eyebrowVariants = cva("", {
variants: {
/**
* The label style. `default` (the default) is a 14px line at weight 500,
* cased as written. `icon` is the same line with a 16px icon, placed
* first among the children, 12px before the words. `mono` is a 12px
* uppercase mono label at weight 500 with 0.12em letter spacing. `caps`
* is the same label in the sans face, for a brand and series label such
* as "Studio Neri / Clay school". The color comes from `tone`.
*/
variant: {
default: "text-sm/5 font-medium",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
/**
* The ink. `muted` (the default) is `muted-foreground`. `ink` leaves the
* color to the surrounding text, for a label over art, on a dark island
* or anywhere the muted grey is too quiet to read.
*/
tone: {
muted: "text-muted-foreground",
ink: "",
},
},
defaultVariants: { variant: "default", tone: "muted" },
})
/**
* A short label set above a heading, such as a section name, rendered as a
* `<p>`. Leave 8px between it and the heading. Pass `render` to use another
* element.
*
* `default` is a 14px line at weight 500, cased as written. `icon` adds a
* 16px icon before the words: put the icon first, with `aria-hidden`. `mono`
* is a 12px uppercase mono label with 0.12em letter spacing; `caps` the same
* in the sans face, for a brand and series name such as "Studio Neri / Clay
* school". `tone="muted"` (the default) sets it in `muted-foreground`;
* `tone="ink"` takes the surrounding text color, for a label over art or on
* a dark island where the grey is too quiet.
*/
function Eyebrow({
className,
variant = "default",
tone = "muted",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant, tone },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant, tone }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import type { ComponentProps } from "react"
import { ArrowRightIcon } from "@phosphor-icons/react/dist/ssr"
import { cn } from "cn"
import { buttonVariants } from "@/components/ui/button"
import {
Card,
CardAction,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
/**
* A card for a headline, such as an article or a case study. Compose it from
* its parts: a `HeadlineCardHeader` holding an optional `HeadlineCardMeta`,
* the `HeadlineCardTitle`, a `HeadlineCardDescription` and a
* `HeadlineCardLink`, then a `HeadlineCardFooter` pushed to the bottom. It is
* the kit's `Card`, styled; at least 320px tall, with padding that grows from
* 32px to 40px on screens 42rem and wider. The title steps from 24px to 30px
* once the card is 24rem wide, reading the stock `card-header` container.
*
* It uses the card background unless you pass a surface utility, such as
* `surface-frost`, in `className`. Every part takes `className` to restyle it.
*/
function HeadlineCard({ className, ...props }: ComponentProps<typeof Card>) {
return (
<Card
data-slot="headline-card"
className={cn(
"min-h-80 gap-8 [--card-spacing:--spacing(8)] min-[42rem]:[--card-spacing:--spacing(10)]",
className
)}
{...props}
/>
)
}
/**
* The card's top block, which holds the meta, title, description and link.
* The stock `card-header` container, so the title steps on its width. The copy is capped at 28rem and
* the link sits at the far edge.
*/
function HeadlineCardHeader({
className,
...props
}: ComponentProps<typeof CardHeader>) {
return (
<CardHeader
data-slot="headline-card-header"
className={cn(
"grid-cols-[minmax(0,var(--container-md))] justify-between gap-4 has-data-[slot=card-action]:grid-cols-[minmax(0,var(--container-md))_auto]",
className
)}
{...props}
/>
)
}
/**
* A line above the headline, such as a category and a date. It takes any
* content and has no styling of its own.
*/
function HeadlineCardMeta({ className, ...props }: ComponentProps<"div">) {
return <div data-slot="headline-card-meta" className={className} {...props} />
}
/**
* The headline, read as a level-3 heading, in the body font (Geist). Pass
* `aria-level` to change the level.
*/
function HeadlineCardTitle({
className,
...props
}: ComponentProps<typeof CardTitle>) {
return (
<CardTitle
data-slot="headline-card-title"
role="heading"
aria-level={3}
className={cn(
"text-2xl/8 font-[450] tracking-[-0.04em] text-pretty @sm/card-header:text-3xl/9",
className
)}
{...props}
/>
)
}
/** The text under the headline, at 75% of the card's text color. */
function HeadlineCardDescription({
className,
...props
}: ComponentProps<typeof CardDescription>) {
return (
<CardDescription
data-slot="headline-card-description"
className={cn("text-base/7 text-pretty text-current/75", className)}
{...props}
/>
)
}
/**
* The round arrow link at the top right of the header. Give it an
* `aria-label`, such as "Read guide: …", since it shows only an icon; `href`
* is where it goes. `className` goes on the link itself.
*/
function HeadlineCardLink({ className, ...props }: ComponentProps<"a">) {
return (
<CardAction>
<a
data-slot="button"
className={cn(
buttonVariants({ variant: "secondary", size: "icon-lg" }),
className
)}
{...props}
>
<ArrowRightIcon aria-hidden="true" />
</a>
</CardAction>
)
}
/**
* The card's bottom row, pushed to the bottom: a wrapping flex row with the
* items centered and spread apart, 24px by 8px gaps, in 12px text. Put a
* `Byline size="sm"` on the left and a button or link on the right.
*/
function HeadlineCardFooter({
className,
...props
}: ComponentProps<typeof CardFooter>) {
return (
<CardFooter
data-slot="headline-card-footer"
className={cn(
"mt-auto flex-wrap justify-between gap-x-6 gap-y-2 text-xs/5",
className
)}
{...props}
/>
)
}
export {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardLink,
HeadlineCardMeta,
HeadlineCardTitle,
}
Plum Newsletterheadline-card-plum-newsletter
Example of the Headline Card as a newsletter sign-up: a large serif headline with an email field and button in the footer.
pnpm dlx shadcn add @01orbital/headline-card-plum-newsletter"use client"
import { useState } from "react"
import {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardMeta,
HeadlineCardTitle,
} from "@/components/card/headline-card"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "An independent newsletter",
title: "One good letter a month.",
description:
"Notes on design, materials, and the things that make a working day a little better.",
emailLabel: "Email address",
placeholder: "you@example.com",
cta: "Join the list",
joined: "You are on the list",
joinedBody: (email: string) => `We will write to ${email} once a month.`,
footnote: "Local preview · no email is sent or saved.",
} as const
/** A HeadlineCard with a large Newsreader headline and an email field and button in the footer, for a newsletter sign-up. */
export default function HeadlineCardPlumNewsletter() {
const [joined, setJoined] = useState<string | null>(null)
return (
// The plum tint follows the page mode. The haze surface would stamp white
// scene ink, so the card takes the page foreground back for both modes.
<HeadlineCard className="theme-plum surface-haze relative isolate w-full max-w-md min-w-0 text-foreground! [--font-display:var(--font-serif)]">
<HeadlineCardHeader>
<HeadlineCardMeta>
<Eyebrow variant="mono" tone="ink">
{COPY.eyebrow}
</Eyebrow>
</HeadlineCardMeta>
<HeadlineCardTitle className="font-display font-normal tracking-[-0.025em]">
{COPY.title}
</HeadlineCardTitle>
<HeadlineCardDescription>{COPY.description}</HeadlineCardDescription>
</HeadlineCardHeader>
<HeadlineCardFooter>
{joined ? (
<div className="grid w-full gap-2.5 text-xs">
<p role="status" className="text-sm font-medium">
{COPY.joined}
</p>
<p className="text-xs/5 text-muted-foreground">
{COPY.joinedBody(joined)}
</p>
<p className="text-xs/5 text-muted-foreground">{COPY.footnote}</p>
</div>
) : (
<form
onSubmit={(event) => {
event.preventDefault()
const data = new FormData(event.currentTarget)
setJoined(String(data.get("email") ?? ""))
}}
className="grid w-full gap-2.5 text-xs"
>
<label htmlFor="headline-card-email">{COPY.emailLabel}</label>
<div className="flex flex-wrap gap-2.5">
<Input
id="headline-card-email"
name="email"
type="email"
autoComplete="email"
required
placeholder={COPY.placeholder}
className="h-10 flex-[1_1_160px] border border-[color-mix(in_oklab,var(--foreground)_55%,var(--background))] bg-background text-foreground"
/>
<Button
type="submit"
className="h-auto min-h-[38px] max-w-full py-[9px] text-center whitespace-normal"
>
{COPY.cta}
</Button>
</div>
<p role="status" className="text-xs/5 text-muted-foreground">
{COPY.footnote}
</p>
</form>
)}
</HeadlineCardFooter>
</HeadlineCard>
)
}
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
// default is a quiet 14px line, cased as written; icon puts a 16px icon in
// front of it; mono is a 12px uppercase mono label for spec-sheet designs;
// caps is the same size in a sans face. tone picks the ink: muted (the
// default) or the surrounding text color, for a label over art or on a dark
// island where muted-foreground is too quiet.
const eyebrowVariants = cva("", {
variants: {
/**
* The label style. `default` (the default) is a 14px line at weight 500,
* cased as written. `icon` is the same line with a 16px icon, placed
* first among the children, 12px before the words. `mono` is a 12px
* uppercase mono label at weight 500 with 0.12em letter spacing. `caps`
* is the same label in the sans face, for a brand and series label such
* as "Studio Neri / Clay school". The color comes from `tone`.
*/
variant: {
default: "text-sm/5 font-medium",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
/**
* The ink. `muted` (the default) is `muted-foreground`. `ink` leaves the
* color to the surrounding text, for a label over art, on a dark island
* or anywhere the muted grey is too quiet to read.
*/
tone: {
muted: "text-muted-foreground",
ink: "",
},
},
defaultVariants: { variant: "default", tone: "muted" },
})
/**
* A short label set above a heading, such as a section name, rendered as a
* `<p>`. Leave 8px between it and the heading. Pass `render` to use another
* element.
*
* `default` is a 14px line at weight 500, cased as written. `icon` adds a
* 16px icon before the words: put the icon first, with `aria-hidden`. `mono`
* is a 12px uppercase mono label with 0.12em letter spacing; `caps` the same
* in the sans face, for a brand and series name such as "Studio Neri / Clay
* school". `tone="muted"` (the default) sets it in `muted-foreground`;
* `tone="ink"` takes the surrounding text color, for a label over art or on
* a dark island where the grey is too quiet.
*/
function Eyebrow({
className,
variant = "default",
tone = "muted",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant, tone },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant, tone }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import type { ComponentProps } from "react"
import { ArrowRightIcon } from "@phosphor-icons/react/dist/ssr"
import { cn } from "cn"
import { buttonVariants } from "@/components/ui/button"
import {
Card,
CardAction,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
/**
* A card for a headline, such as an article or a case study. Compose it from
* its parts: a `HeadlineCardHeader` holding an optional `HeadlineCardMeta`,
* the `HeadlineCardTitle`, a `HeadlineCardDescription` and a
* `HeadlineCardLink`, then a `HeadlineCardFooter` pushed to the bottom. It is
* the kit's `Card`, styled; at least 320px tall, with padding that grows from
* 32px to 40px on screens 42rem and wider. The title steps from 24px to 30px
* once the card is 24rem wide, reading the stock `card-header` container.
*
* It uses the card background unless you pass a surface utility, such as
* `surface-frost`, in `className`. Every part takes `className` to restyle it.
*/
function HeadlineCard({ className, ...props }: ComponentProps<typeof Card>) {
return (
<Card
data-slot="headline-card"
className={cn(
"min-h-80 gap-8 [--card-spacing:--spacing(8)] min-[42rem]:[--card-spacing:--spacing(10)]",
className
)}
{...props}
/>
)
}
/**
* The card's top block, which holds the meta, title, description and link.
* The stock `card-header` container, so the title steps on its width. The copy is capped at 28rem and
* the link sits at the far edge.
*/
function HeadlineCardHeader({
className,
...props
}: ComponentProps<typeof CardHeader>) {
return (
<CardHeader
data-slot="headline-card-header"
className={cn(
"grid-cols-[minmax(0,var(--container-md))] justify-between gap-4 has-data-[slot=card-action]:grid-cols-[minmax(0,var(--container-md))_auto]",
className
)}
{...props}
/>
)
}
/**
* A line above the headline, such as a category and a date. It takes any
* content and has no styling of its own.
*/
function HeadlineCardMeta({ className, ...props }: ComponentProps<"div">) {
return <div data-slot="headline-card-meta" className={className} {...props} />
}
/**
* The headline, read as a level-3 heading, in the body font (Geist). Pass
* `aria-level` to change the level.
*/
function HeadlineCardTitle({
className,
...props
}: ComponentProps<typeof CardTitle>) {
return (
<CardTitle
data-slot="headline-card-title"
role="heading"
aria-level={3}
className={cn(
"text-2xl/8 font-[450] tracking-[-0.04em] text-pretty @sm/card-header:text-3xl/9",
className
)}
{...props}
/>
)
}
/** The text under the headline, at 75% of the card's text color. */
function HeadlineCardDescription({
className,
...props
}: ComponentProps<typeof CardDescription>) {
return (
<CardDescription
data-slot="headline-card-description"
className={cn("text-base/7 text-pretty text-current/75", className)}
{...props}
/>
)
}
/**
* The round arrow link at the top right of the header. Give it an
* `aria-label`, such as "Read guide: …", since it shows only an icon; `href`
* is where it goes. `className` goes on the link itself.
*/
function HeadlineCardLink({ className, ...props }: ComponentProps<"a">) {
return (
<CardAction>
<a
data-slot="button"
className={cn(
buttonVariants({ variant: "secondary", size: "icon-lg" }),
className
)}
{...props}
>
<ArrowRightIcon aria-hidden="true" />
</a>
</CardAction>
)
}
/**
* The card's bottom row, pushed to the bottom: a wrapping flex row with the
* items centered and spread apart, 24px by 8px gaps, in 12px text. Put a
* `Byline size="sm"` on the left and a button or link on the right.
*/
function HeadlineCardFooter({
className,
...props
}: ComponentProps<typeof CardFooter>) {
return (
<CardFooter
data-slot="headline-card-footer"
className={cn(
"mt-auto flex-wrap justify-between gap-x-6 gap-y-2 text-xs/5",
className
)}
{...props}
/>
)
}
export {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardLink,
HeadlineCardMeta,
HeadlineCardTitle,
}
Color Wash Bandheadline-card-art-journal
Example of the Headline Card: a painted color wash band across the top and a paper body with a label, headline, byline and save button.
pnpm dlx shadcn add @01orbital/headline-card-art-journalThe source comes with full access.
One payment of $149 opens the source right here and lets the CLI install every paid component, with lifetime updates.
Shared Rowsheadline-card-shared-rows
Example of the Headline Card: two cards side by side in a Grid sharing headline, description and footer rows, so descriptions line up although the headlines differ in length.
pnpm dlx shadcn add @01orbital/headline-card-shared-rowsimport {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardTitle,
} from "@/components/card/headline-card"
import { Grid } from "@/components/grid/grid"
// The copy: change text here, not in the markup.
const NOTES = [
{
label: "Field guide / 01",
title: "A place to begin.",
description:
"Before the timelines and the deliverables, write down what this project needs to change.",
summary: "Read the first note",
body: "Keep the first brief short enough to discuss. A useful beginning names the problem, the people it affects, and how you will know things have improved.",
},
{
label: "Field guide / 02",
title: "Make a little room for the work you haven’t thought of yet.",
description:
"A plan is more useful when it can hold a new question without falling apart.",
summary: "Read the second note",
body: "Leave time after the first review to learn from what you see. The point of the plan is to help the work happen, including the part you could not predict.",
},
] as const
/** Two HeadlineCards side by side in a Grid, with the headline, description and footer rows shared, so the descriptions line up although the headlines differ in length. */
export default function HeadlineCardSharedRows() {
return (
<Grid
cols={2}
gap="sm"
className="theme-sage w-full auto-rows-[auto_auto_1fr] text-foreground [--font-display:var(--font-serif)] *:data-[slot=headline-card]:row-span-3 *:data-[slot=headline-card]:grid *:data-[slot=headline-card]:grid-rows-subgrid *:data-[slot=headline-card]:*:data-[slot=headline-card-header]:row-span-2 *:data-[slot=headline-card]:*:data-[slot=headline-card-header]:grid-rows-subgrid"
>
{NOTES.map((note) => (
<HeadlineCard
key={note.label}
className="relative isolate w-full min-w-0 rounded-[8px]"
>
<HeadlineCardHeader>
<HeadlineCardTitle className="font-display font-normal tracking-[-0.025em]">
<span className="mb-4 block font-mono text-[11px]/5 tracking-[0.1em] uppercase">
{note.label}
</span>
{note.title}
</HeadlineCardTitle>
<HeadlineCardDescription>
{note.description}
</HeadlineCardDescription>
</HeadlineCardHeader>
<HeadlineCardFooter>
<details className="w-full text-sm/6">
<summary className="w-fit cursor-pointer list-none py-1 underline underline-offset-4 [&::-webkit-details-marker]:hidden">
{note.summary}
</summary>
<div className="pt-4 text-muted-foreground">
<p>{note.body}</p>
</div>
</details>
</HeadlineCardFooter>
</HeadlineCard>
))}
</Grid>
)
}
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
const GRID_DEFAULTS = { cols: 3, gap: "lg" } as const
// Columns follow the screen, stepping at 40rem and 48rem (and 64rem for six). Gap sizes read the shared --gap-*
// values in globals.css. The grid fills its parent's width: without that, a
// grid given `mx-auto` or set inside a centering parent shrinks to fit its
// content, and a part built on it that is a container collapses to nothing.
const containerGridVariants = cva("grid w-full grid-cols-1", {
variants: {
/**
* The most columns. Below 40rem of screen width the grid is one
* column (two for `6`); it steps up at 40rem and 48rem: `2` is two
* columns from 40rem, `3` two then three, `4` two then four, `5` three
* then five, and `6` three, then four, then six from 64rem. The default
* is 3.
*/
cols: {
1: "",
2: "sm:grid-cols-2",
3: "sm:grid-cols-2 md:grid-cols-3",
4: "sm:grid-cols-2 md:grid-cols-4",
5: "sm:grid-cols-3 md:grid-cols-5",
6: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6",
},
/**
* Space between items: `xs` 8px, `sm` 16px, `md` 24px, `lg` 40px, `xl` 64px, `px` 1px, `none` 0. `lg`
* is the default. The sizes are the `--gap-*` values in globals.css.
*/
gap: {
xs: "gap-(--gap-xs)",
sm: "gap-(--gap-sm)",
md: "gap-(--gap-md)",
lg: "gap-(--gap-lg)",
xl: "gap-(--gap-xl)",
px: "gap-px",
none: "gap-0",
},
},
defaultVariants: GRID_DEFAULTS,
})
type GridState = { slot: "grid" } & VariantProps<typeof containerGridVariants>
type GridProps = useRender.ComponentProps<"div", GridState> &
VariantProps<typeof containerGridVariants>
// className, render and every other prop go to the grid. To narrow a Grid,
// pass a `max-w-*` class or size its parent.
function Grid({
className,
cols = GRID_DEFAULTS.cols,
gap = GRID_DEFAULTS.gap,
render,
...props
}: GridProps) {
const grid = useRender({
defaultTagName: "div",
render,
state: { slot: "grid", cols, gap },
props: mergeProps<"div">(
{ className: cn(containerGridVariants({ cols, gap }), className) },
props
),
})
return grid
}
export { Grid, type GridProps }
import type { ComponentProps } from "react"
import { ArrowRightIcon } from "@phosphor-icons/react/dist/ssr"
import { cn } from "cn"
import { buttonVariants } from "@/components/ui/button"
import {
Card,
CardAction,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
/**
* A card for a headline, such as an article or a case study. Compose it from
* its parts: a `HeadlineCardHeader` holding an optional `HeadlineCardMeta`,
* the `HeadlineCardTitle`, a `HeadlineCardDescription` and a
* `HeadlineCardLink`, then a `HeadlineCardFooter` pushed to the bottom. It is
* the kit's `Card`, styled; at least 320px tall, with padding that grows from
* 32px to 40px on screens 42rem and wider. The title steps from 24px to 30px
* once the card is 24rem wide, reading the stock `card-header` container.
*
* It uses the card background unless you pass a surface utility, such as
* `surface-frost`, in `className`. Every part takes `className` to restyle it.
*/
function HeadlineCard({ className, ...props }: ComponentProps<typeof Card>) {
return (
<Card
data-slot="headline-card"
className={cn(
"min-h-80 gap-8 [--card-spacing:--spacing(8)] min-[42rem]:[--card-spacing:--spacing(10)]",
className
)}
{...props}
/>
)
}
/**
* The card's top block, which holds the meta, title, description and link.
* The stock `card-header` container, so the title steps on its width. The copy is capped at 28rem and
* the link sits at the far edge.
*/
function HeadlineCardHeader({
className,
...props
}: ComponentProps<typeof CardHeader>) {
return (
<CardHeader
data-slot="headline-card-header"
className={cn(
"grid-cols-[minmax(0,var(--container-md))] justify-between gap-4 has-data-[slot=card-action]:grid-cols-[minmax(0,var(--container-md))_auto]",
className
)}
{...props}
/>
)
}
/**
* A line above the headline, such as a category and a date. It takes any
* content and has no styling of its own.
*/
function HeadlineCardMeta({ className, ...props }: ComponentProps<"div">) {
return <div data-slot="headline-card-meta" className={className} {...props} />
}
/**
* The headline, read as a level-3 heading, in the body font (Geist). Pass
* `aria-level` to change the level.
*/
function HeadlineCardTitle({
className,
...props
}: ComponentProps<typeof CardTitle>) {
return (
<CardTitle
data-slot="headline-card-title"
role="heading"
aria-level={3}
className={cn(
"text-2xl/8 font-[450] tracking-[-0.04em] text-pretty @sm/card-header:text-3xl/9",
className
)}
{...props}
/>
)
}
/** The text under the headline, at 75% of the card's text color. */
function HeadlineCardDescription({
className,
...props
}: ComponentProps<typeof CardDescription>) {
return (
<CardDescription
data-slot="headline-card-description"
className={cn("text-base/7 text-pretty text-current/75", className)}
{...props}
/>
)
}
/**
* The round arrow link at the top right of the header. Give it an
* `aria-label`, such as "Read guide: …", since it shows only an icon; `href`
* is where it goes. `className` goes on the link itself.
*/
function HeadlineCardLink({ className, ...props }: ComponentProps<"a">) {
return (
<CardAction>
<a
data-slot="button"
className={cn(
buttonVariants({ variant: "secondary", size: "icon-lg" }),
className
)}
{...props}
>
<ArrowRightIcon aria-hidden="true" />
</a>
</CardAction>
)
}
/**
* The card's bottom row, pushed to the bottom: a wrapping flex row with the
* items centered and spread apart, 24px by 8px gaps, in 12px text. Put a
* `Byline size="sm"` on the left and a button or link on the right.
*/
function HeadlineCardFooter({
className,
...props
}: ComponentProps<typeof CardFooter>) {
return (
<CardFooter
data-slot="headline-card-footer"
className={cn(
"mt-auto flex-wrap justify-between gap-x-6 gap-y-2 text-xs/5",
className
)}
{...props}
/>
)
}
export {
HeadlineCard,
HeadlineCardDescription,
HeadlineCardFooter,
HeadlineCardHeader,
HeadlineCardLink,
HeadlineCardMeta,
HeadlineCardTitle,
}
Field Notesheadline-card-field-notes
Example of the Headline Card composed from Card parts on warm paper, with an oversized serif title and a ruled mono byline.
pnpm dlx shadcn add @01orbital/headline-card-field-notesThe source comes with full access.
One payment of $149 opens the source right here and lets the CLI install every paid component, with lifetime updates.
Anatomy
Headline Card is built from 7 parts. In the example they nest like this:
HeadlineCard
├─ HeadlineCardHeader
│ ├─ HeadlineCardMeta
│ ├─ HeadlineCardTitle
│ └─ HeadlineCardDescription
└─ HeadlineCardFooterHeadlineCard: A card for a headline, such as an article or a case study. Compose it from its parts: aHeadlineCardHeaderholding an optionalHeadlineCardMeta, theHeadlineCardTitle, aHeadlineCardDescriptionand aHeadlineCardLink, then aHeadlineCardFooterpushed to the bottom. It is the kit'sCard, styled; at least 320px tall, with padding that grows from 32px to 40px on screens 42rem and wider. The title steps from 24px to 30px once the card is 24rem wide, reading the stockcard-headercontainer.HeadlineCardHeader: The card's top block, which holds the meta, title, description and link. The stockcard-headercontainer, so the title steps on its width. The copy is capped at 28rem and the link sits at the far edge.HeadlineCardMeta: A line above the headline, such as a category and a date. It takes any content and has no styling of its own.HeadlineCardTitle: The headline, read as a level-3 heading, in the body font (Geist). Passaria-levelto change the level.HeadlineCardDescription: The text under the headline, at 75% of the card's text color.HeadlineCardFooter: The card's bottom row, pushed to the bottom: a wrapping flex row with the items centered and spread apart, 24px by 8px gaps, in 12px text. Put aByline size="sm"on the left and a button or link on the right.HeadlineCardLink: The round arrow link at the top right of the header. Give it anaria-label, such as "Read guide: …", since it shows only an icon;hrefis where it goes.classNamegoes on the link itself.
API reference
HeadlineCard
A card for a headline, such as an article or a case study. Compose it from its parts: a HeadlineCardHeader holding an optional HeadlineCardMeta, the HeadlineCardTitle, a HeadlineCardDescription and a HeadlineCardLink, then a HeadlineCardFooter pushed to the bottom. It is the kit's Card, styled; at least 320px tall, with padding that grows from 32px to 40px on screens 42rem and wider. The title steps from 24px to 30px once the card is 24rem wide, reading the stock card-header container.
It uses the card background unless you pass a surface utility, such as surface-frost, in className. Every part takes className to restyle it.
Prop
Type
It also accepts the HTML attributes of the element it renders.
HeadlineCardHeader
The card's top block, which holds the meta, title, description and link. The stock card-header container, so the title steps on its width. The copy is capped at 28rem and the link sits at the far edge.
It accepts the HTML attributes of the element it renders.
HeadlineCardMeta
A line above the headline, such as a category and a date. It takes any content and has no styling of its own.
It accepts the HTML attributes of the element it renders.
HeadlineCardTitle
The headline, read as a level-3 heading, in the body font (Geist). Pass aria-level to change the level.
It accepts the HTML attributes of the element it renders.
HeadlineCardDescription
The text under the headline, at 75% of the card's text color.
It accepts the HTML attributes of the element it renders.
HeadlineCardFooter
The card's bottom row, pushed to the bottom: a wrapping flex row with the items centered and spread apart, 24px by 8px gaps, in 12px text. Put a Byline size="sm" on the left and a button or link on the right.
It accepts the HTML attributes of the element it renders.
HeadlineCardLink
The round arrow link at the top right of the header. Give it an aria-label, such as "Read guide: …", since it shows only an icon; href is where it goes. className goes on the link itself.
It accepts the HTML attributes of the element it renders.
Dependencies
npm: @phosphor-icons/react, cn. The CLI installs them for you. cn merges Tailwind class names, in place of clsx and tailwind-merge.
Registry pieces it installs with it:
Used in blocks
2 blocks are built with Headline Card: