Variants
Six ways to hold a pen: marker, red pencil, ink, highlighter, pencil whisper and blue felt.
The thing you press. A marker-filled primary, a highlighter secondary, an inked outline, a whisper-box ghost, a solid red destructive and a hand-underlined link, in every shadcn size.
npx shadcn@latest add @wobko/buttonFirst time here? Add the registry to components.json first. How to install
Six ways to hold a pen: marker, red pencil, ink, highlighter, pencil whisper and blue felt.
The shadcn heights (24, 32, 36, 40) and the square icon buttons. Icon buttons need an aria-label.
Rest, hover, pressed, keyboard focus and disabled, forced with data attributes (data-hover, data-pressed, data-focus-visible) so they can be compared side by side. Hover any button yourself: the drawing tilts and lifts a shadow line.
asChild draws the button on your own element. The drawing lands inside the anchor; a disabled link is announced as disabled and cannot be followed.
A real save button: pressing it disables it while the request runs, says what is happening, and confirms. The label is text; nothing here needs an icon.
Icons sit before or after the label. Button tightens its padding when it sees one, sizes the pencilled icon to 16 px (12 px in xs) and keeps the drawing behind both.
Square buttons for one glyph, in the four icon sizes. Give each an aria-label; the drawing is decorative. The last one is a real toggle that swaps its icon.
The shadcn pattern: a Spinner in front of the label inside a disabled button. The first and last are the static state (disabled buttons are dashed). Press the second to watch a request go through: it is `aria-disabled` while it works instead of `disabled`, so keyboard focus stays on it.
Each height comes with its square twin: `sm` and `icon-sm` (32 px), default and `icon` (36 px), `lg` and `icon-lg` (40 px), and our extra `xs` pair at 24 px. Put them side by side and the labels and glyphs line up on one baseline.
A real <button> (or, with asChild, any element you hand it) with a hand-drawn layer behind its label. The label stays DOM text in the hand font; the drawing is measured from the element, never from the text.
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "default" | default = terracotta marker fill and an ink box; destructive = a solid red fill with paper lettering and a red box; outline = an inked box on paper; secondary = highlighter; ghost = a whisper of pencil that lights up under a highlighter swipe on hover; link = a blue felt underline that gets a second, heavier stroke on hover. |
| size | "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "default" | 36, 24, 32 and 40 px high (the shadcn sizes); the icon sizes are squares of 36, 24, 32 and 40. Compact density is one step tighter, calm two (and calm is hairline: a pencil.fine outline, a single-pass fill). In the xs sizes an Icon inside is drawn at the 12 px tier. |
| asChild | boolean | false | Render the child element instead of a <button> and give it the button's classes, data attributes and drawing (Radix Slot). The drawing is inserted inside the child. A disabled asChild element gets aria-disabled, tabIndex -1 and a swallowed click. |
| seed | string | number | - | Pins the hand: the same seed always draws the same button, also across remounts. Default: derived from useId(). |
| className | string | - | Merged last. `rounded-full`, as in upstream, makes a pill: the box is drawn with half-height corners (a hand-drawn circle on a square icon button) and `data-shape="pill"` is set. Other rounded-* classes do nothing, because the box is a drawing, not a border. |
| disabled | boolean | false | Dashed pencil box on a pale wash. A real disabled attribute on buttons, aria-disabled on asChild elements. |
The cva function behind Button, for styling a link or trigger like a button. Layout and typography classes only: the drawing comes from Button.
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | ButtonVariant | "default" | Same values as Button. |
| size | ButtonSize | "default" | Same values as Button. |
| className | string | - | Merged last. |
The files the CLI copies into your project.
Loading the source