Every piece in the library is written the same way, so any piece can be dropped into any page and used like the others. This doc covers using a piece, its props, its specimen, forms and accessibility, and the shape a new piece must follow.
Components and blocks#
| Kind | What it is | On the page |
|---|---|---|
| Component | One job: a button, a bump, a price reveal, a signature card. | Has no section padding of its own: place it inside a padded section with the page background (the starter kit's <section className="fd-section">), never bare between blocks, or its first and last lines sit flush against the neighbouring sections. |
| Block | A whole section: a hero, a guarantee band, an order form, a close. | Owns its band and section spacing: place it directly on the page. Don't nest it inside another padded section. |
Pieces with numbered names (value-stack, value-stack-2) do the same job in a different design. Pick one
per page and keep it consistent.
Ads and video are libraries too. Beside the funnel library (components and blocks) sit two more, with the same theme, slots, props, specimens and truth rules, and their own kinds:
| Kind | Library | What it is |
|---|---|---|
Ad (ads/<name>) |
Ads | One static ad layout at exact pixel sizes. formats lists its sizes, lead the one its preview shows, wordCap the most words on the image; the specimen's states are the formats and its copy export is sample platform copy. Built on the ad kit (AdFrame, AdHeadline, Cue, LogoMark). See ads.md. |
Frame (video/<name>) |
Video | One animated scene, a pure function of the frame number, in 16:9 and 9:16. Its video export gives fps, length and formats; the specimen lists keyframes. Built on the video kit (VideoStage, useWords, Rise, CountUp…). See video.md. |
Clip (video/clip-<name>) |
Video | A short video that sequences Live frames from one storyboard prop, with optional timeline, captions, voice and music. |
None of the three goes on a page. Search them with library: "ads" or "video"; render them with the starter
kit's ads or video project. Their motion rules differ from page pieces: a frame never uses CSS animation,
transitions, motion/react or timers, because only frame-driven motion renders.
Using a piece#
- Read the props and the specimen. The props say what the piece needs; the specimen shows a real call with sensible values.
-
Copy the source. Take the component file and the registry files it imports (its shared helpers, marks
and images). Pieces import only React,
lucide-react,motion/react, payment marks and other registry files. - Replace every word. Every visible word is a prop with sample copy as its default, including button labels, validation messages, plurals and accessible labels. The defaults describe a fictional sample offer. Pass the brand's real copy for all of it.
- Pass real images through the image props.
- Wire the actions. Pieces never send data, charge cards or navigate on their own. You connect them.
Props#
| Prop pattern | Meaning |
|---|---|
Text props, copy objects |
Visible words, with sample copy as the default. Text that carries emphasis may accept rich content. |
| Template strings | Some defaults use named placeholders, such as "Choose your {label} to continue." The piece fills them in; keep the placeholder when you rewrite the text. |
productImage, presenterImage, … |
Image src strings, named after their slot (see theme.md). |
items: { title, image?, value? }[] |
Lists are arrays of records. An empty list renders nothing. |
href |
Where the action goes. |
onAction |
Handles an action click. |
onSubmit |
Receives a form's validated values. The form never sends them anywhere itself. |
state |
`"default" \ |
className |
On the root, for placement on the page. |
- When both a current prop and an older alias exist, the current prop wins and only one callback fires.
- When a slot asks for label content (a button's text), pass text, not a button. Nesting a button inside a button breaks the control. When a slot asks for a complete control, pass exactly one.
- Prices, values, totals, dates and savings are props. A piece may derive a saving from two supplied prices; it never invents one.
The specimen#
Each piece has a specimen: the piece rendered once with sample facts, as a working example of its props.
- It imports the piece and the library's shared sample offer, and renders the piece once.
- It sets no background, tokens or fonts. A block brings its own band; a component sits on the bare page.
- It lists the states the piece implements:
export const states = ["default", "active", "disabled"]. - It relies on the theme to load fonts.
Forms#
- Every field has a visible label. Placeholder text is never the only label.
- Every text-like field (text, email, tel, number, url, search, password, textarea) has a placeholder that is
a realistic example of the answer:
you@example.com,Jane Smith,(555) 123-4567, "What's your biggest challenge right now?". Never a copy of the label. - Fields built from a list carry a sensible default placeholder per field, so callers that omit one still show it.
- A
selectstarts on a disabled placeholder option: "Choose your plan…". - Placeholder colour comes from the field itself so it reads on every theme:
::placeholder { color: color-mix(in oklch, var(--field-ink) 65%, var(--field)); opacity: 1 }. Not--muted. - Inputs have a solid
--fieldbackground and--field-inktext. Cards have a solid--cardbackground. Never transparent. - Labels and inputs are large and clear; targets are at least 48px tall.
- Errors appear next to the field after the reader interacts or tries to continue, name how to fix it, and use an icon and text as well as colour. Focus moves to the first invalid field.
- Step forms show progress, keep Back available after step one, keep the advance button in one place and keep answers when moving back. Back uses the secondary button style.
- Success says what completed and what happens next, and agrees with the button that triggered it. A preview never claims a charge, a sent email or a reserved seat that did not happen.
Accessibility#
- Real elements:
<button>for actions,<a>for navigation,<label for>with<input>, headings in order (oneh1per page, in the hero; sectionsh2; inside a pieceh3). -
alton every image; emptyaltonly for decoration. -
aria-labelon icon-only controls; icons beside text arearia-hidden. - A visible focus ring from
--field-focusor the button tokens. - Touch targets at least 44px.
- Text at 4.5:1 against its actual surface; large text at 3:1.
- Motion through
motion/reactor CSS, always honouringprefers-reduced-motion. - No scripts, fetches, storage, analytics,
eval, remote imports or timers that outlive the piece. A Google Fonts stylesheet for a signature face is the one allowed remote load.
Proof and empty states#
Pieces that show proof (testimony, results, logos, bundles, case studies) take only supplied material.
- An empty list renders nothing. Leave the piece out rather than filling it.
- A piece's placeholder fallback (a "not supplied" frame, sample copy) is a development state, never a finished page.
- A drawn seal is not a certification; a "BONUS" chip needs a real bonus; a struck price needs a real former price.
Writing a new piece#
When the library has nothing for a section, write the section by hand on the page. If it should become a reusable piece, give it this shape.
Files.
registry/<category>/<name>.tsx the component
registry/<category>/demos/<name>.tsx its specimen
registry/<category>/assets/<hash>.webp its images
The component file, in order:
- One header comment: what the piece does for the conversion, in a line or two.
- Imports: React,
lucide-react,motion/react, payment marks, relative registry files. Nothing else. -
export type <Name>Props = { … }, with a one-line comment on any prop that isn't obvious. -
export function <Name>(props: <Name>Props), the PascalCase of the file name, plusexport default <Name>. - Helpers below the component, not exported unless another piece uses them.
- Detailed CSS (pseudo-elements, media queries, states, motion) in one scoped
<style>block under.cf-<name>. No global selectors (body,h1orbuttonon their own).
// Offers an optional order addition with a clear checkbox, supplied price and confirmation.
import * as React from "react"
import { Check } from "lucide-react"
export type OrderBumpProps = {
headline?: string
description: React.ReactNode
/** Pre-formatted, e.g. "+$37". */
price: string
/** Struck-through regular price. Only pass a real one. */
compareAt?: string
checked?: boolean
onCheckedChange?: (checked: boolean) => void
className?: string
}
export function OrderBump({ headline = "Yes! Add this to my order", description, price, compareAt, checked, onCheckedChange, className }: OrderBumpProps) {
// …
}
export default OrderBump
Then check it:
- It follows the theme: no fixed colours or fonts, role tokens for buttons, inputs and cards, slots for every image (see theme.md).
- It follows design-rules.md and imagery.md.
- It renders every state it exports, at 1440px and 390px, under a light and a dark theme, with nothing overflowing and every text pair at 4.5:1.
- It does one job a page builder couldn't get from any UI library. A lone button, a plain bullet list, a generic FAQ accordion or a testimonial card is not a piece.