Components

Shared components, from single controls to whole features.

Reach for it when
  • Before building anything: check the tier below and COMPONENTS.md. Fix shared components at the source.
  • A new component gets a story with its loading, empty and error states.

The short version

If you read nothing else on this page, read these.

Do. Compose from the library. The focus ring, sizes, press state and dark mode come with it.
+ New Site
Don't. Hand-roll a primitive because the shared one is almost right. Fix it at the source.
LiveError
Do. Show system state with StatusBadge. It owns the dot, the label and the copy.
LIVE⚠ failed
Don't. Draw a one-off pill. The next screen draws a slightly different one.

Library

Fronds carry the tokens, fiddles own one job, understories assemble a feature. Open a component for its guide and API, or click a path to copy the import.

Button

Frond
Every clickable. Variants: default, outline, ghost, ghostMuted, destructive, destructiveOutline, link.

Badge

Frond
Static labels and counts. Neutral by default; status hues only when the badge is the status.
A count beside a label: a circle for one digit, a pill once the number needs the room.
Text entry. Always with a Label; errors via aria-invalid and a Note.
Secrets: an Input with a show and hide toggle once there's a value. Same rules as Input.

Chip

Frond
Pill-shaped buttons: prompt suggestions and filter pills. aria-pressed marks the selected one.
Key caps. mod renders ⌘ or Ctrl by platform.

Tooltip

Frond
Name or detail on hover and focus. Takes a shortcut.
An endpoint's HTTP method as a status-colored Badge, in the hues the docs API reference uses.
A logo or icon in a small bordered tile, sm beside a table cell, lg beside a page title.

Avatar

Frond
People and orgs at 24, 32 or 40px.

Icons

Frond
The glyph set and logos. Never lucide-react.
System state: live, publishing, error… Dot carries the hue, the label carries the meaning.

Note

Fiddle
Inline message with an icon: info, success, warning, error, bold.
2–5 exclusive views. Tabs for page sections, SegmentedControl for a view toggle.

Card

Fiddle
The framed surface (surface-card) with standard padding.
A stat tile: title, counted value, change and refresh state.
A tiny trend beside a headline number: a line for a series, bars for counts per period.

CodeBlock

Fiddle
Files and multi-line code as Fern Docs shows them: a title bar, highlighting, line numbers, copy.
Floating surfaces on bg-overlay with one hairline and shadow-overlay.
Lists of records with sorting, selection and paging.

Steps

Fiddle
A numbered setup flow with its current step.

FileTree

Fiddle
A read-only, inline file tree that shows where files live.

AgentMark

Fiddle
The Fern Agent's mark, at rest or thinking.

CommandPalette

Understory
⌘K navigation, search and agent entry.

Agent panel

Understory
AskPill, DockedAgentPanel, AgentChat, UserQuestion: the whole agent surface.
Toolbar, MetricsCard tiles, then chart and table in their own cards.

Settings cards

Understory
One card per concern with its own Save; destructive actions last.

Side panels

Understory
AnimatedSidepanelContainer and PanelResizeSeparator for detail views.

Docs preview

Understory
BrowserChrome around a live render of the user's site.
The get-started wizard: SplitLayout, step cards, live CodeWidget preview.

Keep going

Patterns
How components come together into pages.
Surfaces
Introduce layering of components with ease.
Accessibility
Fern supports accessibility standards out of the box.