CTA Statement 01
A statement above a picture: the eyebrow and title on the left, a line and two buttons on the right on the title baseline, and a dark panel below with a soft ring rising like a horizon.
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { Arc, ArcLayer } from "@/components/glow/arc"
import { LinkButton } from "@/components/link-button/link-button"
import {
Section,
SectionDescription,
SectionTitle,
} from "@/components/section/section"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "Field notes",
title: "Everything you need to start tonight",
description:
"A short guide to the instruments, the hour and the patch of sky that rewards a first look.",
primary: "Read the guide",
secondary: "See the gear list",
} as const
/** A statement above a picture: the eyebrow and title on the left, the line and buttons on the right from `lg` on the title's baseline, and a dark panel below with a ring rising like a horizon. */
export default function CtaStatement01() {
return (
<Section className="sm:py-24">
<div className="flex flex-col gap-12 sm:gap-16 lg:gap-18">
<div className="grid grid-cols-12 items-baseline gap-x-6 gap-y-4">
<Eyebrow className="col-span-full">{COPY.eyebrow}</Eyebrow>
<SectionTitle className="col-span-full lg:col-span-5">
{COPY.title}
</SectionTitle>
<div className="col-span-full flex flex-col items-start gap-8 lg:col-span-6 lg:col-start-7">
<SectionDescription className="max-w-none">
{COPY.description}
</SectionDescription>
<div className="flex flex-wrap gap-4">
<LinkButton href="#" variant="outline">
{COPY.secondary}
</LinkButton>
<LinkButton href="#">{COPY.primary}</LinkButton>
</div>
</div>
</div>
{/* h-160 gives the ring room to read as a horizon. */}
<div
aria-hidden="true"
className="dark relative isolate h-160 overflow-hidden rounded-xs bg-background"
>
<ArcLayer>
<Arc
size="140%"
top="180%"
from={300}
sweep={120}
color="oklch(0.9 0.08 60)"
fade="oklch(0.7 0.1 40 / 0.5)"
/>
</ArcLayer>
</div>
</div>
</Section>
)
}
import type { ComponentProps, CSSProperties } from "react"
import { cn } from "cn"
// One turn for every ring, backwards when ccw; reduced motion holds it still.
// Arc Ring ships the same rule under the same href, so React keeps one copy.
const ARC_CSS = `@keyframes arc-turn{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion: no-preference){
[data-slot="arc-layer"][data-animate] :is([data-slot="arc"],[data-slot="arc-ring"]),:is([data-slot="arc"],[data-slot="arc-ring"])[data-animate]{animation:arc-turn var(--arc-duration) linear infinite var(--arc-direction)}}`
const finite = (n: number | undefined, fallback: number) =>
n !== undefined && Number.isFinite(n) ? n : fallback
/**
* A layer for `Arc` and `ArcRing` rings behind a section's content. It fills
* its positioned parent, clips any ring that runs past its edge, and ignores
* the pointer.
*/
function ArcLayer({
animate = false,
className,
...props
}: ComponentProps<"div"> & {
/**
* Turns every ring inside, each at its own speed and direction. Reduced
* motion holds them still.
*/
animate?: boolean
}) {
return (
<div
data-slot="arc-layer"
data-animate={animate || undefined}
className={cn(
"pointer-events-none absolute inset-0 overflow-hidden",
className
)}
{...props}
/>
)
}
type ArcProps = Omit<ComponentProps<"div">, "color"> & {
/** Diameter in px, or any CSS length such as "80cqw". 900 by default. */
size?: number | string
/** The center's distance from the parent's left edge; any CSS length. */
left?: string
/** The center's distance from the parent's top edge; any CSS length. */
top?: string
/** Where the lit part starts, in degrees clockwise from 12 o'clock; 150. */
from?: number
/** How far the lit part runs, in degrees from 0 to 360; 150. */
sweep?: number
/** The color at the brightest point of the lit part. */
color?: string
/** The dimmer color the lit part fades through. */
fade?: string
/** Which way the ring turns when animated: clockwise or counterclockwise. */
turn?: "cw" | "ccw"
/** Turns this ring on its own. Reduced motion holds it still. */
animate?: boolean
/** Seconds per full turn: 90 clockwise, 120 counterclockwise by default. */
duration?: number
}
/**
* A ring of light for the background behind a section: thin and soft, it
* brightens and fades along its lit part and lightens what is under it. Put
* it in an `ArcLayer` or another positioned parent: `left` and `top` set its
* center, and a ring often sits partly past the frame's edge. For a bright
* stroke over a faint full ring, use `ArcRing`.
*
* It is hidden from assistive tech and ignores the pointer. When animated it
* makes one full turn per `duration`; reduced motion holds it still.
*/
function Arc({
size = 900,
left = "50%",
top = "50%",
from,
sweep,
color = "oklch(0.80 0.06 350 / 0.65)",
fade = "oklch(0.60 0.05 340 / 0.25)",
turn = "cw",
animate = false,
duration,
className,
style,
...props
}: ArcProps) {
const start = finite(from, 150)
const lit = Math.min(360, Math.max(0, finite(sweep, 150)))
const seconds =
duration !== undefined && Number.isFinite(duration) && duration > 0
? duration
: turn === "ccw"
? 120
: 90
const diameter = typeof size === "number" ? `${size}px` : size
return (
<div
data-slot="arc"
data-turn={turn}
data-animate={animate || undefined}
aria-hidden="true"
className={cn(
"pointer-events-none absolute rounded-full mix-blend-screen",
className
)}
style={
{
left,
top,
width: size,
height: size,
margin: `calc(${diameter} / -2) 0 0 calc(${diameter} / -2)`,
"--arc-duration": `${seconds}s`,
"--arc-direction": turn === "ccw" ? "reverse" : "normal",
background: `conic-gradient(from ${start}deg, transparent 0deg, ${color} ${lit * 0.37}deg, ${fade} ${lit * 0.63}deg, transparent ${lit}deg)`,
mask: "radial-gradient(closest-side in srgb, transparent calc(100% - 2px), oklch(0 0 0) calc(100% - 0.5px), transparent calc(100% + 1px))",
...style,
} as CSSProperties
}
{...props}
>
<style href="arc" precedence="medium">
{ARC_CSS}
</style>
</div>
)
}
export { Arc, ArcLayer }
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 { 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 { 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 sectionVariants = cva(
"relative isolate w-full bg-background wrap-anywhere text-foreground",
{
variants: {
/**
* The padding above and below: `sm` 64px (96px from `lg`), `md` (the
* default) 72px (120px from `lg`), `lg` 80px (144px from `lg`).
*/
size: {
sm: "py-16 lg:py-24",
md: "py-18 lg:py-30",
lg: "py-20 lg:py-36",
},
},
defaultVariants: { size: "md" },
}
)
// The gap between the band's children, by the band's size: 40px, and 64px
// from `sm` for `md`; 64px for `lg`.
const columnVariants = cva(
"mx-auto flex w-full max-w-[90.5rem] min-w-0 flex-col px-4 sm:px-6",
{
variants: {
size: {
sm: "gap-10",
md: "gap-10 sm:gap-16",
lg: "gap-16",
},
},
defaultVariants: { size: "md" },
}
)
/**
* A page band: a full-width `<section>` holding a centered column, 1400px
* of content with 16px sides on a phone and 24px from `sm`. `size` sets its
* padding and the gap between its children.
*/
function Section({
className,
size = "md",
children,
...props
}: ComponentProps<"section"> & VariantProps<typeof sectionVariants>) {
return (
<section
data-slot="section"
data-size={size}
className={cn(sectionVariants({ size }), className)}
{...props}
>
<div data-slot="section-column" className={columnVariants({ size })}>
{children}
</div>
</section>
)
}
/** Art behind the whole band, hidden from assistive tech. */
function SectionBackground({ className, ...props }: ComponentProps<"div">) {
return (
<div
data-slot="section-background"
aria-hidden="true"
className={cn("pointer-events-none absolute inset-0 -z-10", className)}
{...props}
/>
)
}
const contentVariants = cva("mx-auto flex w-full min-w-0 flex-col", {
variants: {
/** The gap between children: `sm` 24px, `md` (the default) 32px, `lg` 64px. */
size: {
sm: "gap-6",
md: "gap-8",
lg: "gap-16",
},
},
defaultVariants: { size: "md" },
})
/**
* A centered column for the band's content, its children stacked with a
* gap. Give it a `max-w-*` class for a narrower column. Pass `render` to
* use another element.
*/
function SectionContent({
className,
size = "md",
render,
...props
}: useRender.ComponentProps<"div"> & VariantProps<typeof contentVariants>) {
return useRender({
defaultTagName: "div",
render,
state: { slot: "section-content" },
props: mergeProps<"div">(
{ className: cn(contentVariants({ size }), className) },
props
),
})
}
const columnsVariants = cva("grid w-full grid-cols-1 items-start gap-16", {
variants: {
/**
* From `lg`: `equal` (the default) two even columns; `intro` a narrower
* first column, 2:3.
*/
variant: {
equal: "lg:grid-cols-2",
intro: "lg:grid-cols-[2fr_3fr]",
},
},
defaultVariants: { variant: "equal" },
})
/** Two columns from `lg`, stacked below it, 64px apart. */
function SectionColumns({
className,
variant = "equal",
...props
}: ComponentProps<"div"> & VariantProps<typeof columnsVariants>) {
return (
<div
data-slot="section-columns"
data-variant={variant}
className={cn(columnsVariants({ variant }), className)}
{...props}
/>
)
}
const headerVariants = cva("group/section-header grid w-full min-w-0", {
variants: {
/** `start` (the default) or `center`, which centers everything in it. */
align: {
start: "",
center: "justify-items-center text-center",
},
/**
* `stack` (the default) is one column, its children 16px apart.
* `split` puts the second child, such as SectionActions, on the right
* from `sm`, level with the bottom of the first, and 24px under it
* below `sm`.
*/
variant: {
stack: "gap-4",
split: "justify-items-start gap-6 sm:grid-cols-[1fr_auto] sm:items-end",
},
},
defaultVariants: { align: "start", variant: "stack" },
})
/**
* The band's heading area. Its children are an optional Eyebrow, then
* SectionTitle, SectionDescription and SectionActions, 16px apart, with
* 24px above the actions. `variant="split"` takes two children and puts
* the second on the right; when the left side is more than a title, group
* it in a SectionHeader of its own. It has no max width, so a title runs
* the column; the description's width is its own (45rem).
*/
function SectionHeader({
className,
align = "start",
variant = "stack",
...props
}: ComponentProps<"div"> & VariantProps<typeof headerVariants>) {
return (
<div
data-slot="section-header"
data-align={align}
data-variant={variant}
className={cn(headerVariants({ align, variant }), className)}
{...props}
/>
)
}
// No width of its own: the SectionHeader column (or whatever holds it) is
// the measure. text-pretty keeps a wrapped title from ending on one word.
// font-display follows font-sans unless the block switches it, for example
// with [--font-display:var(--font-serif)].
const sectionTitleVariants = cva("font-display font-[450] text-pretty", {
variants: {
/**
* `default` keeps the surrounding display face, tracked -0.05em and
* -0.06em from `sm`. `serif` uses the kit's serif face, tracked
* -0.03em.
*/
variant: {
default: "tracking-[-0.05em] sm:tracking-[-0.06em]",
serif: "tracking-[-0.03em] [--font-display:var(--font-serif)]",
},
/**
* `xl` (the default): 32px/40px, 56px/56px from `lg`, the section
* title. `closing`: 40px/48px, 48px/56px from `lg`, for a closing or
* side title. `lg`: 32px/40px, 40px/48px from `sm`,
* 48px/56px from `lg`. `md`: 32px/40px, capped at 40px/44px from `sm`.
*/
size: {
md: "text-[2rem]/10 sm:text-[2.5rem]/11",
lg: "text-[2rem]/10 sm:text-[2.5rem]/12 lg:text-5xl/14",
xl: "text-[2rem]/10 lg:text-[3.5rem]/14",
closing: "text-[2.5rem]/12 lg:text-5xl/14",
},
},
defaultVariants: { variant: "default", size: "xl" },
})
/**
* A section's title in the display font, an `<h2>` at weight 450. The
* default `size="xl"` is 32px/40px, then 56px/56px from `lg`. Choose
* `size="closing"` for a closing or side title, 40px/48px then 48px/56px
* at `lg`; `size="lg"` for 32px/40px, 40px/48px at `sm` and 48px/56px at
* `lg`; or `size="md"` for 32px/40px, capped at 40px/44px from `sm`.
* `variant="serif"` uses the kit's serif face with its own, looser
* tracking. Pass `render` to use another heading level. A page's headline
* is `Heading`.
*/
function SectionTitle({
className,
variant = "default",
size = "xl",
render,
...props
}: useRender.ComponentProps<"h2"> & VariantProps<typeof sectionTitleVariants>) {
return useRender({
defaultTagName: "h2",
render,
state: { slot: "section-title", variant, size },
props: mergeProps<"h2">(
{ className: cn(sectionTitleVariants({ variant, size }), className) },
props
),
})
}
/**
* The text under a section's title, a `<p>` in the muted text color:
* 16px/24px, then 18px/28px from `lg`, with balanced lines. It has no
* width of its own: give it a `max-w-*` class where it's used, or let the
* layout set the measure. A `text-*` color class replaces the color. Pass
* `render` to use another element.
*/
function SectionDescription({
className,
render,
...props
}: useRender.ComponentProps<"p">) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "section-description" },
props: mergeProps<"p">(
{
className: cn(
"w-full min-w-0 text-base/6 text-balance text-muted-foreground lg:text-lg/7",
className
),
},
props
),
})
}
// Stacked in a SectionHeader, the actions sit 24px under the text: the
// header's 16px gap plus 8px of their own.
const sectionActionsVariants = cva(
"flex max-w-full flex-wrap items-center gap-4 group-data-[variant=stack]/section-header:mt-2",
{
variants: {
/** `start` (the default) or `center`. */
align: {
start: "",
center: "justify-center",
},
},
defaultVariants: { align: "start" },
}
)
/**
* The band's buttons or links, in a row that wraps, 16px apart. Put it
* last in a SectionHeader, or anywhere else in the band.
*/
function SectionActions({
className,
align = "start",
...props
}: ComponentProps<"div"> & VariantProps<typeof sectionActionsVariants>) {
return (
<div
data-slot="section-actions"
data-align={align}
className={cn(sectionActionsVariants({ align }), className)}
{...props}
/>
)
}
/**
* A rounded panel inside a Section's column: edge to edge and square on a
* phone, then rounded with 96px of padding from `md`. Give it a theme
* class, such as `dark`, to paint it apart from the page.
*/
function SectionPanel({ className, ...props }: ComponentProps<"div">) {
return (
<div
data-slot="section-panel"
className={cn(
"relative isolate -mx-4 overflow-hidden border border-transparent bg-background px-4 py-12 text-foreground sm:-mx-6 sm:px-6 md:mx-0 md:rounded-lg md:p-24 dark:border-border",
className
)}
{...props}
/>
)
}
export {
Section,
SectionBackground,
SectionPanel,
SectionContent,
SectionColumns,
SectionHeader,
SectionTitle,
SectionDescription,
SectionActions,
sectionTitleVariants,
}
Installation
npx shadcn@latest add @01orbital/cta-statement-01Make it yours
- Its words are in
COPYat the top ofcomponents/blocks/cta/cta-statement-01/index.tsx: change them there, not in the markup. - Its look comes from Arc; each page lists the props that change it.
Built from
Built from these parts. The CLI adds each one that is missing and won't replace a file you already have unless you choose to:
Last updated on