Components
Button
Pill-shaped actions in six variants and eight sizes, with a loading state that keeps its label.
import { Button } from "@sideby/ui/button";
<Button>Press play</Button> When to use it
A button starts an action: play, copy a link, make someone host. Navigation that only goes somewhere is a link, though a link can borrow the button look with href (see below).
The filled default button is the primary action and carries the accent, so a view gets one. Everything else on that view steps down to outline, secondary or ghost. That restraint is the one-accent rule: when only one thing is orange, everybody knows what to press.
Variants
default: the primary action, accent fill.outline: a secondary action with a visible edge that holds 3:1 against the page.secondary: a quieter filled action.ghost: no fill and no edge until hover, for toolbars and dense rows.destructive: removes something or someone. Red text on a red tint, never a red slab.link: an action that reads as text, underlined in the accent.
import { Button } from "@sideby/ui/button";
<Button>Press play</Button>
<Button variant="outline">Copy link</Button>
<Button variant="secondary">Make host</Button>
<Button variant="ghost">Not now</Button>
<Button variant="destructive">Kick Leo</Button>
<Button variant="link">Read the rules</Button> Sizes
Heights come from the size tokens: xs 28px, sm 36px, default 40px and lg 44px. xs is the smallest target allowed. Primary touch controls step up to lg on coarse pointers. The demo uses outline so the page keeps a single accent fill.
import { Button } from "@sideby/ui/button";
<Button variant="outline" size="xs">Make host</Button>
<Button variant="outline" size="sm">Make host</Button>
<Button variant="outline">Make host</Button>
<Button variant="outline" size="lg">Make host</Button> Icon-only buttons are square at the same four heights: icon-xs, icon-sm, icon and icon-lg.
import { Button } from "@sideby/ui/button";
import Link from "@lucide/svelte/icons/link";
<Button variant="outline" size="icon-xs" aria-label="Copy link"><Link aria-hidden="true" /></Button>
<Button variant="outline" size="icon-sm" aria-label="Copy link"><Link aria-hidden="true" /></Button>
<Button variant="outline" size="icon" aria-label="Copy link"><Link aria-hidden="true" /></Button>
<Button variant="outline" size="icon-lg" aria-label="Copy link"><Link aria-hidden="true" /></Button> Loading
loading disables the button, marks it aria-busy and puts a small pulsing mark before the label. The label never changes, so the button does not jump in width and nobody has to re-read it. Under reduced motion the mark holds still.
import { Button } from "@sideby/ui/button";
<Button loading>Press play</Button>
<Button variant="outline" loading>Copy link</Button> With an icon
Put a Lucide icon before the label, marked aria-hidden. The label carries the name, and the icon is sized for you.
import { Button } from "@sideby/ui/button";
import Play from "@lucide/svelte/icons/play";
<Button><Play aria-hidden="true" />Press play</Button> As a link
Give the button an href and it renders an a with the same look. Use it when pressing it goes somewhere. A disabled link button drops its href and leaves the tab order.
import { Button } from "@sideby/ui/button";
<Button variant="outline" href="/brand/voice/">Read the voice guide</Button>
<Button variant="link" href="/components/">All components</Button> Accessibility
- It is a native
button(orawithhref), so Enter and Space press it and it sits in the tab order with no extra work. - Keyboard focus shows the solid ring outline. Nothing removes it.
- While
loading, the button is disabled andaria-busy="true"; the label stays the same for screen readers too. - An icon-only button needs an
aria-labelthat names the action, such as “Copy link”. A tooltip is never the only name. - Disabled buttons fade to half opacity and ignore the pointer. Prefer explaining why something is unavailable over disabling it silently.
Copy
Labels are short verbs, usually with a noun: Press play, Copy link, Make host, Kick Leo. Keep them to two or three words so they never wrap, and say what happens, not how the user feels about it. The jokes belong in the surrounding copy, not on the button.