Paper Hero
Hero printed on paper: hairline frame, letterpress buttons and a plate tipped in beside the copy. Eyebrow, title, description, actions, plate art, plate caption and cream or black tone are props.
import type { ComponentProps, ReactNode } from "react"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { Heading } from "@/components/heading/heading"
import {
HeroActions,
HeroContainer,
HeroContent,
HeroMedia,
} from "@/components/hero/hero"
import { LinkButton } from "@/components/link-button/link-button"
import { ColorWash } from "@/components/scene/color-wash"
import { Text } from "@/components/text/text"
import { PaperSheet } from "@/components/texture/paper-sheet"
type HeroAction = { label: string; href: string }
type PaperHeroProps = Omit<ComponentProps<typeof PaperSheet>, "title"> & {
/** A small label above the title, such as a catalog or issue number. */
eyebrow?: ReactNode
/** The headline, an `h1` (or `h2` with `level={2}`), set in Geist. */
title: ReactNode
/** A larger line of text under the title. */
description?: ReactNode
/**
* Links shown as letterpress buttons, each a `label` and `href`: the first
* in dark ink, the rest on cream paper.
*/
actions?: readonly HeroAction[]
/**
* The picture on the tipped-in plate. Leave it out for a gold Color Wash;
* pass your own to replace it. It should fill a 4:5 box, so give it
* `aspect-4/5 w-full`.
*/
art?: ReactNode
/**
* The caption under the plate: `caption` on the left (such as "Plate 01")
* and `label` on the right (the plate's name). Leave it out for no caption.
*/
plate?: { caption: string; label: string }
/** The paper the hero is printed on: `cream` (the default) or `black`. */
tone?: ComponentProps<typeof PaperSheet>["tone"]
/** 1 for the page's first hero; 2 when the page's h1 is already taken. */
level?: 1 | 2
}
/**
* A hero printed on paper: a hairline frame, the copy and letterpress buttons
* on one side, and a plate tipped in by hand on the other, which stacks below
* the copy on narrower screens. The headline is Geist with a pressed
* highlight, and the buttons look inked. Other props go to the Paper Sheet.
*/
function PaperHero({
eyebrow,
title,
description,
actions = [],
art,
plate,
tone,
level = 1,
...props
}: PaperHeroProps) {
return (
<PaperSheet tone={tone} {...props}>
{/* The printed hairline frame, inset 24px, 40px from sm. The
in-data-[tone=black] classes reprint frame, deboss and buttons in
silver on the black sheet. */}
<div
aria-hidden="true"
className="pointer-events-none absolute inset-6 border border-[oklch(0.300_0.021_83/0.2)] in-data-[tone=black]:border-[oklch(0.841_0.011_95/0.2)] sm:inset-10"
/>
{/* The copy clears the card's inset border (24px in, 40px from sm). */}
<HeroContainer variant="split" className="px-10 py-28 sm:px-16 lg:px-16">
<HeroContent>
<div className="flex w-full flex-col gap-2">
{eyebrow ? <Eyebrow>{eyebrow}</Eyebrow> : null}
<Heading
render={level === 2 ? <h2 /> : <h1 />}
// font-sans on purpose: this headline is Geist, not the display
// face Heading defaults to. The deboss: a light highlight
// under pressed type. In the narrow two-column range (64-80rem)
// the column is ~26rem, and below the sm breakpoint it is narrower
// still, so the type steps down there to keep "Components," whole.
className="w-full max-w-5xl font-sans [text-shadow:0_1px_0_oklch(1_0_0/0.55)] in-data-[tone=black]:[text-shadow:0_-1px_0_oklch(0_0_0/0.6)] max-sm:text-[2.375rem]/none lg:text-6xl/none xl:text-[5rem]/none"
>
{title}
</Heading>
</div>
{description ? (
<Text size="xl" className="max-w-3xl">
{description}
</Text>
) : null}
{actions.length > 0 ? (
<HeroActions>
{actions.map((action, index) => (
<LinkButton
href={action.href}
key={action.href + action.label}
variant={null}
size={null}
className={
index === 0
? "h-auto gap-1.5 rounded-sm border-transparent bg-foreground px-6 py-3 text-base font-normal text-[oklch(0.944_0.021_89)] shadow-[inset_0_1px_0_color-mix(in_oklch,oklch(0.944_0.021_89)_12%,transparent),0_2px_5px_color-mix(in_oklch,var(--foreground)_28%,transparent)] transition-[background-color,box-shadow,translate] hover:bg-[color-mix(in_oklch,var(--foreground),oklch(0.944_0.021_89)_12%)] active:shadow-[inset_0_2px_3px_oklch(0_0_0/0.35)] in-data-[tone=black]:text-[oklch(0.192_0.010_89)]"
: "h-auto gap-1.5 rounded-sm border-[oklch(0.300_0.021_83/0.2)] bg-[oklch(0.944_0.021_89)] px-6 py-3 text-base font-normal text-foreground shadow-[inset_0_1px_0_oklch(1_0_0/0.8),0_2px_5px_color-mix(in_oklch,var(--foreground)_12%,transparent)] transition-[background-color,box-shadow,translate] hover:bg-[oklch(0.911_0.026_87)] active:shadow-[inset_0_2px_3px_color-mix(in_oklch,var(--foreground)_18%,transparent)] in-data-[tone=black]:border-[oklch(0.841_0.011_95/0.25)] in-data-[tone=black]:bg-[oklch(0.24_0.010_89)] in-data-[tone=black]:shadow-[inset_0_1px_0_oklch(1_0_0/0.08)] in-data-[tone=black]:hover:bg-[oklch(0.28_0.010_89)]"
}
>
{action.label}
</LinkButton>
))}
</HeroActions>
) : null}
</HeroContent>
{/* Stacked, the plate lines up with the text; beside it, it centers. */}
<HeroMedia className="w-full max-w-sm lg:mx-auto">
<figure>
{/* The plate: a sheet of cream paper, tipped in by hand. */}
<div className="relative border border-[oklch(0.300_0.021_83/0.2)] bg-[oklch(0.944_0.021_89)] p-3 text-[oklch(0.300_0.021_83)] shadow-[inset_0_1px_0_oklch(1_0_0/0.8),0_2px_4px_oklch(0.300_0.021_83/0.1),0_22px_40px_-18px_oklch(0.300_0.021_83/0.4)] [--foreground:oklch(0.300_0.021_83)] [--muted-foreground:oklch(0.43_0.027_82)]">
{art ?? (
<ColorWash
color="gold"
grain={0.18}
groundLift={0.22}
upperHeight={95}
className="aspect-4/5 w-full"
/>
)}
</div>
{plate ? (
<Eyebrow
render={<figcaption />}
className="mt-3 flex flex-wrap items-center justify-between gap-x-4 gap-y-1 text-xs"
>
<span>{plate.caption}</span>
<span>{plate.label}</span>
</Eyebrow>
) : null}
</figure>
</HeroMedia>
</HeroContainer>
</PaperSheet>
)
}
export { PaperHero }
export type { PaperHeroProps }
import { PaperHero } from "@/components/hero/paper-hero"
import { ColorWash } from "@/components/scene/color-wash"
import { DemoLabel } from "@/components/text/demo-label"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "Orbcore Catalog №1",
title: "Components, pressed into paper.",
description:
"A registry that you can hold: cream stock, letterpress ink, and a plate tipped in by hand.",
plate: { caption: "Plate 01", label: "The Gallery of Sol" },
captions: {
cream: "Tone cream, with eyebrow and plate caption",
black: "Tone black, no plate caption",
art: "Art: your own picture",
},
} as const
const ACTIONS = [
{ label: "View catalog", href: "#" },
{ label: "Browse plates", href: "#" },
] as const
/** Paper Hero on cream paper with an eyebrow and a plate caption, on black
* paper without a caption, and with its own art on the plate. */
export default function PaperHeroDemo() {
return (
<div className="grid w-full gap-8">
<div className="grid gap-2">
<PaperHero
level={2}
tone="cream"
eyebrow={COPY.eyebrow}
title={COPY.title}
description={COPY.description}
actions={ACTIONS}
plate={COPY.plate}
/>
<DemoLabel className="px-6">{COPY.captions.cream}</DemoLabel>
</div>
<div className="grid gap-2">
<PaperHero
level={2}
tone="black"
title={COPY.title}
description={COPY.description}
actions={ACTIONS}
/>
<DemoLabel className="px-6">{COPY.captions.black}</DemoLabel>
</div>
<div className="grid gap-2">
<PaperHero
level={2}
title={COPY.title}
description={COPY.description}
actions={ACTIONS}
plate={COPY.plate}
art={
<ColorWash
color="rose"
grain={0.18}
className="aspect-4/5 w-full"
/>
}
/>
<DemoLabel className="px-6">{COPY.captions.art}</DemoLabel>
</div>
</div>
)
}
import type * as React from "react"
import { cn } from "cn"
import {
ORBITAL_PALETTES,
type OrbitalPalette,
type OrbitalPaletteName,
} from "@/components/orbs/orbital-palettes"
// Paper grain: an SVG turbulence filter as a data URI.
const PAPER_GRAIN = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250' viewBox='0 0 100 100'%3E%3Cfilter id='n' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='turbulence' baseFrequency='1.4' numOctaves='1' seed='2' stitchTiles='stitch' result='n'/%3E%3CfeComponentTransfer result='g'%3E%3CfeFuncR type='linear' slope='4' intercept='1'/%3E%3CfeFuncG type='linear' slope='4' intercept='1'/%3E%3CfeFuncB type='linear' slope='4' intercept='1'/%3E%3C/feComponentTransfer%3E%3CfeColorMatrix type='saturate' values='0' in='g'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`
/** A palette of your own: a ground and the two fields painted over it. */
type ColorWashPalette = Pick<OrbitalPalette, "ground" | "upper" | "lower">
type ColorWashFinishProps = {
/**
* A named palette from `ORBITAL_PALETTES`, the table Orbital paints from
* too. The default is `delft`, cream over blue.
*/
color?: OrbitalPaletteName
/**
* Your own ground, upper and lower field. Replaces the named `color`; the
* wash reports `data-color="custom"`.
*/
palette?: ColorWashPalette
/** Blur on the upper field, in px. Default 44. */
upperBlur?: number
/** Blur on the lower field, in px. Default 52. */
lowerBlur?: number
/** Grain opacity, 0 to 1. Default 0.5. */
grain?: number
/** Height of the upper field, as a percentage of the frame. Default 78. */
upperHeight?: number
/** Height of the lower field, as a percentage of the frame. Default 65. */
lowerHeight?: number
/**
* OKLCH lightness added to the ground, kept within 0 to 1; positive values
* lighten. Default 0.
*/
groundLift?: number
}
/**
* A box painted as a soft color field, a ground with a blurred upper and
* lower field and a grain overlay, used as a background for cards and
* sections. `color` picks a named palette from `ORBITAL_PALETTES`, the
* default is `delft`, and `palette` takes one of your own.
*
* Children render above the wash in a full-height wrapper. The wash layers
* are hidden from assistive tech and take no pointer events.
*/
function ColorWash({
className,
color,
palette,
style,
children,
upperBlur = 44,
lowerBlur = 52,
grain = 0.5,
upperHeight = 78,
lowerHeight = 65,
groundLift = 0,
...props
}: React.ComponentProps<"div"> & ColorWashFinishProps) {
const paint = palette ?? ORBITAL_PALETTES[color ?? "delft"]
return (
<div
data-slot="color-wash"
data-color={palette ? "custom" : (color ?? "delft")}
className={cn("relative isolate overflow-hidden", className)}
style={
{
"--color-wash-ground": paint.ground,
"--color-wash-upper": paint.upper,
"--color-wash-lower": paint.lower,
...style,
} as React.CSSProperties
}
{...props}
>
<div
aria-hidden="true"
className="pointer-events-none absolute inset-0"
style={{
background:
groundLift === 0
? "var(--color-wash-ground)"
: `oklch(from var(--color-wash-ground) clamp(0, calc(l + ${groundLift}), 1) c h)`,
}}
>
<div
className="absolute inset-x-0 top-[-20%]"
style={{
background: "var(--color-wash-upper)",
height: `${Math.max(0, upperHeight)}%`,
filter: `blur(${Math.max(0, upperBlur)}px)`,
}}
/>
<div
className="absolute inset-x-0 bottom-[-15%]"
style={{
background: "var(--color-wash-lower)",
height: `${Math.max(0, lowerHeight)}%`,
filter: `blur(${Math.max(0, lowerBlur)}px)`,
}}
/>
</div>
<div
aria-hidden="true"
className="pointer-events-none absolute inset-0 mix-blend-overlay"
style={{
opacity: Math.min(1, Math.max(0, grain)),
backgroundImage: PAPER_GRAIN,
}}
/>
<div className="relative h-full">{children}</div>
</div>
)
}
export { ColorWash }
export type { ColorWashPalette }
// Named palettes for the painted fields: a ground with an upper and a lower
// field blurred over it, the way Orbital paints a ball and ColorWash paints
// a panel. Plain data with no imports, so any component can read it. Pass a
// name to ColorWash as `color`, or an entry (or your own object of the same
// shape) to Orbital or ColorWash as `palette`.
type OrbitalPalette = {
/** The base color under everything else, any CSS color. */
ground: string
/** A CSS background, usually a radial gradient, blurred over the top. */
upper: string
/** A CSS background blurred over the bottom. */
lower: string
/** The orb's glow: an inner bloom and a halo. ColorWash ignores it. */
glow?: string
/** The orb's preferred shading tier. ColorWash ignores it. */
form?: "off" | "medium" | "strong"
/** Read by nothing today; kept so older palettes still type-check. */
period?: "nocturne"
}
type OrbitalPaletteName =
| "gold"
| "delft"
| "warmth"
| "marigold"
| "vesper"
| "aurora"
| "gesso"
| "plaster"
| "moss"
| "tidepool"
| "vermillion"
| "cocoa"
| "linen"
| "tarn"
| "gold-dark"
| "mint"
| "rose"
| "sky"
| "lilac"
| "pewter"
| "oxblood"
| "heather"
| "chambray"
| "lichen"
| "mallow"
| "kiln"
const ORBITAL_PALETTES: Record<OrbitalPaletteName, OrbitalPalette> = {
gold: {
ground: "oklch(0.315 0.064 270.3)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.875 0.097 100.4) 0%, oklch(0.850 0.101 100.7 / 0.7) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.365 0.073 269.3) 0%, oklch(0.365 0.073 269.3 / 0.8) 56%, transparent 100%)",
glow: "oklch(0.936 0.055 102.9)",
form: "strong",
},
delft: {
ground: "oklch(0.376 0.087 261.9)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.905 0.025 104.4) 0%, oklch(0.887 0.026 104.5 / 0.72) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.467 0.121 261.9) 0%, oklch(0.467 0.121 261.9 / 0.8) 55%, transparent 100%)",
glow: "oklch(0.978 0.010 261.8)",
form: "strong",
},
warmth: {
ground: "oklch(0.652 0.147 52.4)",
upper:
"radial-gradient(ellipse 130% 100% at 50% 35%, oklch(0.836 0.159 96.2) 0%, oklch(0.814 0.157 92.4 / 0.7) 55%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 90% at 50% 80%, oklch(0.518 0.176 28.9) 0%, oklch(0.487 0.167 27.7 / 0.8) 55%, transparent 100%)",
glow: "oklch(0.836 0.159 96.2)",
},
marigold: {
ground: "oklch(0.379 0.076 35.6)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.805 0.160 71.9) 0%, oklch(0.805 0.160 71.9 / 0.75) 53%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.243 0.023 32.4) 0%, oklch(0.243 0.023 32.4 / 0.88) 56%, transparent 100%)",
glow: "oklch(0.829 0.154 76.5)",
form: "strong",
},
vesper: {
ground: "oklch(0.28 0.06 300)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.90 0.04 55) 0%, oklch(0.90 0.04 55 / 0.7) 53%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.42 0.13 305) 0%, oklch(0.42 0.13 305 / 0.85) 56%, transparent 100%)",
glow: "oklch(0.82 0.07 50)",
form: "strong",
},
aurora: {
ground: "oklch(0.318 0.057 158.2)",
upper:
"radial-gradient(ellipse 140% 110% at 50% 45%, oklch(0.890 0.129 146.1) 0%, oklch(0.890 0.129 146.1 / 0.5) 55%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 100% at 50% 55%, oklch(0.236 0.055 296.3) 0%, oklch(0.236 0.055 296.3 / 0.5) 55%, transparent 100%)",
},
gesso: {
ground: "oklch(0.563 0.167 30.8)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.919 0.014 53.3) 0%, oklch(0.907 0.011 45.7 / 0.75) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.621 0.161 28.1) 0%, oklch(0.621 0.161 28.1 / 0.8) 55%, transparent 100%)",
glow: "oklch(0.949 0.014 53.3)",
form: "strong",
},
plaster: {
ground: "oklch(0.728 0.030 93.8)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.787 0.035 68.7) 0%, oklch(0.787 0.035 68.7 / 0.65) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.547 0.181 27.1) 0%, oklch(0.516 0.172 26.6 / 0.75) 55%, transparent 100%)",
glow: "oklch(0.561 0.158 29.1)",
form: "strong",
},
moss: {
ground: "oklch(0.313 0.006 34.3)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.561 0.039 200.7) 0%, oklch(0.507 0.038 203.1 / 0.7) 55%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.373 0.047 214.5) 0%, oklch(0.395 0.046 210.5 / 0.8) 56%, transparent 100%)",
glow: "oklch(0.659 0.131 237.7)",
form: "medium",
},
tidepool: {
ground: "oklch(0.179 0.029 240.3)",
upper:
"radial-gradient(ellipse 140% 110% at 50% 45%, oklch(0.413 0.082 166.3) 0%, oklch(0.413 0.082 166.3 / 0.5) 55%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 100% at 50% 55%, oklch(0.962 0.077 113.3) 0%, oklch(0.962 0.077 113.3 / 0.5) 55%, transparent 100%)",
},
vermillion: {
ground: "oklch(0.235 0.06 18.06)",
upper:
"radial-gradient(ellipse 130% 100% at 50% 38%, oklch(0.66 0.205 30.97) 0%, oklch(0.619 0.205 30.96 / 60%) 55%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 90% at 50% 82%, oklch(0.28 0.136 266.87) 0%, oklch(0.25 0.136 267.22 / 70%) 55%, transparent 100%)",
},
cocoa: {
ground: "oklch(0.306 0.066 45.1)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.794 0.054 64.1) 0%, oklch(0.794 0.054 64.1 / 0.75) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.457 0.115 42.0) 0%, oklch(0.457 0.115 42.0 / 0.84) 56%, transparent 100%)",
glow: "oklch(0.762 0.120 49.2)",
form: "strong",
},
linen: {
ground: "oklch(0.267 0.021 54.1)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.782 0.021 58.0) 0%, oklch(0.782 0.021 58.0 / 0.75) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.363 0.028 53.6) 0%, oklch(0.363 0.028 53.6 / 0.85) 56%, transparent 100%)",
glow: "oklch(0.994 0.000 89.9)",
form: "strong",
},
tarn: {
ground: "oklch(0.286 0.036 189.5)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.757 0.155 95.6) 0%, oklch(0.757 0.155 95.6 / 0.72) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.468 0.065 190.9) 0%, oklch(0.468 0.065 190.9 / 0.82) 56%, transparent 100%)",
glow: "oklch(0.831 0.167 96.2)",
form: "strong",
},
"gold-dark": {
ground: "oklch(0.16 0.04 270)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.29 0.06 100) 0%, oklch(0.27 0.06 101 / 0.7) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.23 0.07 269) 0%, oklch(0.23 0.07 269 / 0.8) 56%, transparent 100%)",
},
mint: {
ground: "oklch(0.315 0.06368 314.9)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.875 0.09651 145.0) 0%, oklch(0.850 0.10049 145.3 / 0.7) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.365 0.07263 313.9) 0%, oklch(0.365 0.07263 313.9 / 0.8) 56%, transparent 100%)",
},
rose: {
ground: "oklch(0.315 0.04852 149.9)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.875 0.07355 340.0) 0%, oklch(0.850 0.07658 340.3 / 0.7) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.365 0.05535 148.9) 0%, oklch(0.365 0.05535 148.9 / 0.8) 56%, transparent 100%)",
},
sky: {
ground: "oklch(0.315 0.04989 29.9)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.875 0.07562 220.0) 0%, oklch(0.850 0.07874 220.3 / 0.7) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.365 0.05691 28.9) 0%, oklch(0.365 0.05691 28.9 / 0.8) 56%, transparent 100%)",
},
lilac: {
ground: "oklch(0.315 0.03869 99.9)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.875 0.05864 290.0) 0%, oklch(0.850 0.06106 290.3 / 0.7) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.365 0.04413 98.9) 0%, oklch(0.365 0.04413 98.9 / 0.8) 56%, transparent 100%)",
},
pewter: {
ground: "oklch(0.240 0.022 91.8)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.577 0.031 306.8) 0%, oklch(0.524 0.029 305.5 / 0.75) 54%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.263 0.022 329.5) 0%, oklch(0.263 0.022 329.5 / 0.85) 56%, transparent 100%)",
glow: "oklch(0.964 0.006 308.4)",
form: "medium",
period: "nocturne",
},
oxblood: {
ground: "oklch(0.247 0.023 277.2)",
upper:
"radial-gradient(ellipse 140% 110% at 50% 45%, oklch(0.456 0.136 21.1) 0%, oklch(0.456 0.136 21.1 / 0.5) 55%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 100% at 50% 55%, oklch(0.655 0.090 76.4) 0%, oklch(0.655 0.090 76.4 / 0.5) 55%, transparent 100%)",
},
heather: {
ground: "oklch(0.561 0.203 32.9)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.923 0.021 48.5) 0%, oklch(0.915 0.019 38.1 / 0.75) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.550 0.091 357.3) 0%, oklch(0.602 0.095 359.5 / 0.8) 55%, transparent 100%)",
glow: "oklch(0.940 0.017 44.8)",
form: "strong",
},
chambray: {
ground: "oklch(0.280 0.110 251.6)",
upper: "oklch(0.905 0.040 251.6)",
lower: "oklch(0.450 0.155 251.6)",
glow: "oklch(0.840 0.075 251.6)",
form: "strong",
},
lichen: {
ground: "oklch(0.258 0.027 329.1)",
upper:
"radial-gradient(ellipse 140% 110% at 50% 45%, oklch(0.551 0.058 87.6) 0%, oklch(0.551 0.058 87.6 / 0.5) 55%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 100% at 50% 55%, oklch(0.234 0.035 278.5) 0%, oklch(0.234 0.035 278.5 / 0.5) 55%, transparent 100%)",
period: "nocturne",
},
mallow: {
ground: "oklch(0.250 0.050 325)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.87 0.06 350) 0%, oklch(0.80 0.07 340 / 0.8) 52%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.34 0.09 320) 0%, oklch(0.28 0.07 325 / 0.85) 56%, transparent 100%)",
glow: "oklch(0.88 0.07 350)",
form: "medium",
},
kiln: {
ground: "oklch(0.408 0.085 48.6)",
upper:
"radial-gradient(ellipse 135% 105% at 50% 35%, oklch(0.757 0.089 60.2) 0%, oklch(0.757 0.089 60.2 / 0.75) 53%, transparent 100%)",
lower:
"radial-gradient(ellipse 130% 95% at 50% 80%, oklch(0.583 0.121 44.5) 0%, oklch(0.583 0.121 44.5 / 0.8) 55%, transparent 100%)",
glow: "oklch(0.834 0.088 72.9)",
form: "strong",
},
}
/** One line per palette, for pickers and captions. */
const ORBITAL_PALETTE_NOTES: Record<OrbitalPaletteName, string> = {
gold: "pale gold over indigo, the Orbital default",
delft: "cream over blue",
warmth: "gold over terracotta",
marigold: "gold over rust",
vesper: "pale peach over violet",
aurora: "mint over deep green",
gesso: "warm white over red-orange",
plaster: "rose over plaster",
moss: "sky over warm grey",
tidepool: "teal over deep blue",
vermillion: "cream over oxblood",
cocoa: "pale sand over cocoa",
linen: "pale sand over umber",
tarn: "gold over deep teal",
"gold-dark": "dim gold over near-black blue",
mint: "pale mint over plum",
rose: "pale pink over deep green",
sky: "pale blue over dark brown",
lilac: "pale lilac over dark olive",
pewter: "grey lilac over dark umber",
oxblood: "oxblood over ochre",
heather: "warm white over dusty rose",
chambray: "pale blue over deep blue",
lichen: "khaki over dark indigo",
mallow: "pale pink over plum",
kiln: "apricot over terracotta",
}
export { ORBITAL_PALETTES, ORBITAL_PALETTE_NOTES }
export type { OrbitalPalette, OrbitalPaletteName }
import type { ComponentProps } from "react"
import { cn } from "cn"
/**
* A caption under a demo or gallery piece, in medium-weight mono at
* 12px/20px. Long captions wrap with balanced last lines. The caption
* inherits its ground's text color; native paragraph props pass through.
*/
function DemoLabel({ className, ...props }: ComponentProps<"p">) {
return (
<p
data-slot="demo-label"
className={cn("font-mono text-xs/5 font-medium text-pretty", className)}
{...props}
/>
)
}
export { DemoLabel }
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 eyebrowVariants = cva("text-eyebrow", {
variants: {
/**
* `default` is a 14px/20px label. `icon` adds a row with a 16px icon
* and a 12px gap; put the icon first and give it `aria-hidden`.
* `mono` is a 12px/20px label in the mono face, in sentence case like
* the others: the kit sets no label in capitals.
*/
variant: {
default: "text-sm/5 font-medium text-eyebrow",
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",
},
},
defaultVariants: { variant: "default" },
})
/**
* A short label above a heading, rendered as a `<p>` at weight 500.
* The default is 14px/20px in the kit's eyebrow color. The surrounding
* layout controls the space to the heading. Use `className` to customize
* the typography or color, and `render` to change the element: a `p` is
* right when the label stands alone as a line of text; pass
* `render={<span />}` or `render={<div />}` when it sits inside a heading,
* link, button or other inline text, where a `p` is not valid HTML.
*/
function Eyebrow({
className,
variant = "default",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
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"
// No width of its own: whatever holds it (a HeroContent, a SectionHeader)
// is the measure. text-balance shares a wrapped headline's lines evenly.
// font-display follows font-sans unless the block switches it, for example
// with [--font-display:var(--font-serif)].
const headingVariants = cva("font-display text-balance wrap-anywhere", {
variants: {
/**
* `default` keeps the surrounding display face, tracked -0.06em.
* `serif` uses the kit's serif face, tracked -0.03em, at weight 400:
* Geist Serif has that one weight.
*/
variant: {
default: "tracking-[-0.06em]",
serif: "tracking-[-0.03em] [--font-display:var(--font-serif)]",
},
/**
* Two page headlines. `default`: 40px with a 48px line, then 64px
* with a 64px line from `sm`, for product pages; weight 450 in the
* sans, 400 in the serif. `home`: 48px with a 56px line, then 64px
* from `lg`, at weight 400, for a home page.
*/
size: {
default: "text-[2.5rem]/12 font-[450] sm:text-[4rem]/16",
home: "text-5xl/14 font-normal lg:text-[4rem]/16",
},
},
// 450 is a Geist Sans weight. Geist Serif ships only 400, so the serif
// headline asks for 400 rather than a weight the face doesn't have.
compoundVariants: [
{ variant: "serif", size: "default", class: "font-normal" },
],
defaultVariants: { variant: "default", size: "default" },
})
/**
* The page headline in the display font, which follows `font-sans` unless
* a block switches that role. Rendered as an `<h1>`, in one of two
* headline sizes (`size`), with tight tracking. `variant="serif"` sets it in
* the kit's serif face with its own, looser tracking. Its lines are balanced
* when it wraps. Pass `render` to use another element. Section titles use
* `SectionTitle`; card and panel titles use `Title`, or `CardTitle` inside a
* stock Card.
*/
function Heading({
className,
variant = "default",
size = "default",
render,
...props
}: useRender.ComponentProps<"h1"> & VariantProps<typeof headingVariants>) {
return useRender({
defaultTagName: "h1",
render,
state: { slot: "heading", variant, size },
props: mergeProps<"h1">(
{ className: cn(headingVariants({ variant, size }), className) },
props
),
})
}
export { Heading, headingVariants }
import type { ComponentProps } from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
/** A hero is a full-screen band, so its parts step on the screen width. */
function Hero({ className, ...props }: ComponentProps<"section">) {
return (
<section
data-slot="hero"
className={cn(
"relative isolate flex min-h-svh flex-col overflow-hidden bg-background text-foreground",
className
)}
{...props}
/>
)
}
/** Absolute, behind everything; scenes need this relative parent. */
function HeroBackground({ className, ...props }: ComponentProps<"div">) {
return (
<div
data-slot="hero-background"
aria-hidden="true"
className={cn("pointer-events-none absolute inset-0 -z-10", className)}
{...props}
/>
)
}
const heroContainerVariants = cva("mx-auto w-full max-w-[90.5rem] px-6", {
variants: {
/** `default`, `stack`, `split` or `columns`, as described on HeroContainer. */
variant: {
default: "",
stack: "flex flex-1 flex-col justify-center",
split:
"grid flex-1 content-center items-center gap-16 lg:grid-cols-2 lg:gap-(--gutter)",
columns:
"grid flex-1 grid-cols-12 content-center items-center gap-x-6 gap-y-6",
},
},
defaultVariants: { variant: "default" },
})
/**
* The inner layout, with up to 1400px of content and 24px side padding at
* every width, matching Section's column. `stack` fills the height and
* centers; `split` is two columns from `lg`; `columns` is a
* 12-column grid with 24px gutters, where each child takes a span (for
* example `col-span-full lg:col-span-6`) so text gets its width from the
* grid rather than a max width. Use `className` to customize the width,
* padding or layout.
*/
function HeroContainer({
className,
variant = "default",
...props
}: ComponentProps<"div"> & VariantProps<typeof heroContainerVariants>) {
return (
<div
data-slot="hero-container"
data-variant={variant}
className={cn(heroContainerVariants({ variant }), className)}
{...props}
/>
)
}
const heroContentVariants = cva(
"group/hero-content flex min-w-0 flex-col gap-6",
{
variants: {
/**
* `start` (the default) or `center`, which centers the copy and its
* actions.
*/
align: {
start: "items-start",
center: "mx-auto items-center text-center",
},
},
defaultVariants: { align: "start" },
}
)
/**
* The copy column: the announcement, title and text 24px apart, and the
* actions 32px below them.
*/
function HeroContent({
className,
align = "start",
...props
}: ComponentProps<"div"> & VariantProps<typeof heroContentVariants>) {
return (
<div
data-slot="hero-content"
data-align={align}
className={cn(heroContentVariants({ align }), className)}
{...props}
/>
)
}
const heroActionsVariants = cva(
"flex flex-wrap items-center gap-4 group-data-[align=center]/hero-content:justify-center group-data-[slot=hero-content]/hero-content:mt-2",
{
variants: {
/** `start` (the default) or `center`, for actions on their own. */
align: {
start: "",
center: "justify-center",
},
},
defaultVariants: { align: "start" },
}
)
/**
* A wrapping row with 16px gaps. Inside HeroContent it sits 32px below the
* copy (the column's 24px gap and 8px more), and
* centers inside a centered HeroContent; `align` is for actions on their
* own. Buttons and links retain their own size and typography.
*/
function HeroActions({
className,
align = "start",
...props
}: ComponentProps<"div"> & VariantProps<typeof heroActionsVariants>) {
return (
<div
data-slot="hero-actions"
className={cn(heroActionsVariants({ align }), className)}
{...props}
/>
)
}
/** The picture or demo beside the copy in a `split` container. */
function HeroMedia({ className, ...props }: ComponentProps<"div">) {
return (
<div
data-slot="hero-media"
className={cn("relative min-w-0", className)}
{...props}
/>
)
}
export {
Hero,
HeroBackground,
HeroContainer,
HeroContent,
HeroActions,
HeroMedia,
}
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { type VariantProps } from "class-variance-authority"
import { cn } from "cn"
import { buttonVariants } from "@/components/ui/button"
/**
* The classes of a link that looks like a button: stock `buttonVariants`,
* plus LinkButton's own sizes (`lg` sets a 16px label). For an element that
* can't be a LinkButton.
*/
function linkButtonVariants({
variant,
size,
className,
}: VariantProps<typeof buttonVariants> & { className?: string } = {}) {
return cn(
buttonVariants({ variant, size }),
// Every size is stock's except lg, which takes a 16px label. Stock stays
// untouched in ui/button.tsx, so a shadcn re-download never undoes it.
size === "lg" && "text-base",
className
)
}
/**
* A link that looks like a button: an `<a>` with the button's look, never a
* button. Base UI's `Button` gives any element `role="button"`, so navigation
* uses this instead.
*
* `variant` and `size` are stock Button's; `lg` sets a 16px label. Pass
* `render` to use your framework's link, such as
* `render={<Link href="/pricing" />}` with Next.js, or change the default
* here once and every block follows.
*/
function LinkButton({
className,
variant = "default",
size = "default",
render,
...props
}: useRender.ComponentProps<"a"> & VariantProps<typeof buttonVariants>) {
return useRender({
defaultTagName: "a",
render,
// Written as data-slot="button" on the link, so styles that dress a
// button's slot dress this too.
state: { slot: "button", variant, size },
props: mergeProps<"a">(
{ className: linkButtonVariants({ variant, size, className }) },
props
),
})
}
export { LinkButton, linkButtonVariants }
import type { ComponentProps } from "react"
import { cn } from "cn"
// Fine paper grain as an SVG noise tile.
const GRAIN =
"url(\"data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")"
/**
* A sheet of paper with a fine grain, as a `section`: warm cream printed in
* dark ink, or black printed in silver. Text inside takes the paper's ink
* through `--foreground` and `--muted-foreground`.
*/
function PaperSheet({
tone = "cream",
className,
children,
...props
}: ComponentProps<"section"> & {
/** The paper: `cream` (the default) or `black`. */
tone?: "cream" | "black"
}) {
return (
<section
data-slot="paper-sheet"
data-tone={tone}
className={cn(
"relative isolate overflow-hidden bg-[oklch(0.911_0.026_87)] text-[oklch(0.300_0.021_83)] [--foreground:oklch(0.300_0.021_83)] [--muted-foreground:oklch(0.43_0.027_82)] data-[tone=black]:bg-[oklch(0.192_0.010_89)] data-[tone=black]:text-[oklch(0.841_0.011_95)] data-[tone=black]:[--foreground:oklch(0.841_0.011_95)] data-[tone=black]:[--muted-foreground:oklch(0.841_0.011_95/0.75)]",
className
)}
{...props}
>
{/* The grain sits behind the content. Multiply soots a light paper;
screen lifts a dark one. */}
<div
aria-hidden="true"
data-tone={tone}
className="pointer-events-none absolute inset-0 -z-10 bg-size-[150px] opacity-8 mix-blend-multiply data-[tone=black]:opacity-10 data-[tone=black]:mix-blend-screen"
style={{ backgroundImage: GRAIN }}
/>
{children}
</section>
)
}
export { PaperSheet }
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"
// Paragraphs in body content and introductions. It has no width of its own:
// the layout sets the measure. The default sets the foreground color; muted
// steps it down. Over art or a colored ground, pass className="text-current"
// to keep the ink around it. The text under a section's title is
// SectionDescription.
const textVariants = cva("w-full min-w-0 text-balance", {
variants: {
/**
* The text color. `default` (the default) is `foreground`; `muted`
* is `muted-foreground`. For the ink of a colored ground or art, pass
* `className="text-current"`.
*/
variant: {
default: "text-foreground",
muted: "text-muted-foreground",
},
/**
* The text size and line height: `xs` 12px/20px for a footnote or fine
* print; `sm` 14px/24px for the line under a card or panel title; `md`
* (the default) 16px/28px for body copy; `lg` 18px/28px at every width;
* `xl` 18px/28px, then 20px/32px from `sm` for a hero introduction.
*/
size: {
xs: "text-xs/5",
sm: "text-sm/6",
md: "text-base/7",
lg: "text-lg/7",
xl: "text-lg/7 sm:text-xl/8",
},
/**
* Tabular figures: every digit takes the same width, so numbers line up
* in a column and a changing count does not shift the text.
*/
tabular: {
true: "tabular-nums",
false: "",
},
},
defaultVariants: { variant: "default", size: "md", tabular: false },
})
/**
* A paragraph in body content or an introduction, a `p` by default. For
* several paragraphs, pass `render={<div />}` and put your own `p` elements
* inside.
*
* The default is the `foreground` color at regular weight (400, inherited
* from the page unless a parent sets one), and the lines are balanced when it
* wraps. `size` sets the text and its line height: `xs` 12px/20px for a
* footnote or fine print; `sm` 14px/24px for the line under a card or panel
* title; `md` (the default) 16px/28px for body copy in cards, lists and rows;
* `lg` 18px/28px; or `xl` 18px/28px and 20px/32px from `sm` for a hero.
* `variant="muted"` uses the muted text color. On art or a colored ground,
* pass `className="text-current"` to keep the ink around it. `tabular` sets
* tabular figures for numbers that line up or change. The layout controls the
* text's width and spacing. The text under a section's title is
* `SectionDescription`.
*/
function Text({
className,
variant = "default",
size = "md",
tabular = false,
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof textVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "text", variant, size, tabular },
props: mergeProps<"p">(
{ className: cn(textVariants({ variant, size, tabular }), className) },
props
),
})
}
export { Text, textVariants }
Installation
npx shadcn@latest add @01orbital/paper-heroUsage
import { PaperHero } from "@/components/hero/paper-hero"
import { ColorWash } from "@/components/scene/color-wash"
import { DemoLabel } from "@/components/text/demo-label"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "Orbcore Catalog №1",
title: "Components, pressed into paper.",
description:
"A registry that you can hold: cream stock, letterpress ink, and a plate tipped in by hand.",
plate: { caption: "Plate 01", label: "The Gallery of Sol" },
captions: {
cream: "Tone cream, with eyebrow and plate caption",
black: "Tone black, no plate caption",
art: "Art: your own picture",
},
} as const
const ACTIONS = [
{ label: "View catalog", href: "#" },
{ label: "Browse plates", href: "#" },
] as const
/** Paper Hero on cream paper with an eyebrow and a plate caption, on black
* paper without a caption, and with its own art on the plate. */
export default function PaperHeroDemo() {
return (
<div className="grid w-full gap-8">
<div className="grid gap-2">
<PaperHero
level={2}
tone="cream"
eyebrow={COPY.eyebrow}
title={COPY.title}
description={COPY.description}
actions={ACTIONS}
plate={COPY.plate}
/>
<DemoLabel className="px-6">{COPY.captions.cream}</DemoLabel>
</div>
<div className="grid gap-2">
<PaperHero
level={2}
tone="black"
title={COPY.title}
description={COPY.description}
actions={ACTIONS}
/>
<DemoLabel className="px-6">{COPY.captions.black}</DemoLabel>
</div>
<div className="grid gap-2">
<PaperHero
level={2}
title={COPY.title}
description={COPY.description}
actions={ACTIONS}
plate={COPY.plate}
art={
<ColorWash
color="rose"
grain={0.18}
className="aspect-4/5 w-full"
/>
}
/>
<DemoLabel className="px-6">{COPY.captions.art}</DemoLabel>
</div>
</div>
)
}This example installs with everything it uses:
npx shadcn@latest add @01orbital/paper-hero-demoAPI reference
A hero printed on paper: a hairline frame, the copy and letterpress buttons on one side, and a plate tipped in by hand on the other, which stacks below the copy on narrower screens. The headline is Geist with a pressed highlight, and the buttons look inked. Other props go to the Paper Sheet.
Prop
Type
It also accepts the HTML attributes of the element it renders.
Dependencies
Requires these pieces. The CLI adds each one that is missing and won't replace a file you already have unless you choose to:
Used in blocks
One block is built with Paper Hero.
Last updated on