Button
FrondUsage
The import, then a use to start from. Both copy as they are.
Import
import { Button } from "@/components/ui/button";import { Plus, Settings } from "@/components/icons";Example
<Button onClick={createSite}> <Plus /> New site</Button><Button variant="outline">Cancel</Button><Button variant="ghostMuted" size="iconSm" aria-label="Settings"> <Settings /></Button>When to use
Use it for
- One
defaultbutton per view, for the action that moves the person forward. Everything else isoutlineorghost. ghostMutedfor toolbar icons and secondary actions: muted at rest, full color on hover.destructiveOutlinefor a destructive action in place;destructiveonly on the confirm button inside its dialog.loadingwhile the action runs: the spinner sits over the label, so the button keeps its width.size="xs"for a small action after a value, such as Edit or Upgrade: a 12px icon, 4px from its label.asChildaround aLinkwhen the button navigates, so it can open in a new tab.
Avoid
- A raw
<button>or a clickable<div>: it misses the focus ring, the press state and dark mode. - Two primary buttons side by side. Pick the one that moves the person forward.
- A link inside running text: use a plain
Link.
Accessibility
Checks
- Icon-only buttons (
size="icon"oriconSm) need anaria-label, repeated in aTooltipfor sighted users. - Buttons are never narrower than square, and targets stay at least 32px.
disabledtakes the button out of the tab order: say why nearby, or keep it enabled and explain on click.
API
Read from each component's stories, the same source as COMPONENTS.md, and kept in step by check:design-system.
Button
| Prop | Values |
|---|---|
| variant | "default""destructive""destructiveOutline""outline""ghost""ghostMuted""link" |
| size | "default""xs""sm""lg""icon""iconSm""iconXs" |
| loading | boolean |
| disabled | boolean |
VariantsDefaultOutlineDestructiveDestructiveOutlineGhostLinkSmallExtraSmallLargeWithIconIconOnlyLoadingGhostMutedIconExtraSmallIconSizesDisabledAllVariants
Keep going
- TooltipName or detail on hover and focus. Takes a
shortcut.Frond - Dialog, Popover, DropdownMenuFloating surfaces on
bg-overlaywith one hairline andshadow-overlay.Fiddle - IconsThe glyph set and logos. Never
lucide-react.Frond
Content
Write plainly with sentence case. Follow these guidelines to ensure you do so.
Accessibility
Fern supports accessibility standards out of the box.