Buttons
Button
The main action control. Renders a native button, or a link when given href.
import { Button } from "datui";Playground
<Button variant="primary" appearance="accent" size="m">Continue</Button>Examples
Variants
variant sets visual weight, appearance sets color intent.
Sizes
Icons and loading
Accessibility
- Renders
<button type="button">; withhrefit renders<a>. Enter and Space activate natively. - Icon-only buttons have no visible text — pass
aria-label. loadingsetsaria-busy, announcesloadingLabelthrough a status spinner and ignores clicks.disabledsets the nativedisabledattribute; disabled links drophrefand getaria-disabled.
API
Button
The main action control. Renders `<button>` by default and `<a>` when given `href`. Icon-only buttons (no children) need an `aria-label`.
| Prop | Type | Default | Description |
|---|---|---|---|
| after | ReactNode | — | Content after the label, e.g. an icon or `Counter`. |
| align | "center" | "left" | "right" | — | |
| appearance | "accent" | "negative" | "positive" | "neutral" | "overlay" | — | |
| as | ElementType<any, keyof IntrinsicElements> | — | Element to render. Defaults to `a` with `href`, `button` with `onClick`, otherwise `div`. |
| before | ReactNode | — | Content before the label, usually an icon. |
| className | string | — | |
| disabled | boolean | — | |
| href | string | — | |
| loading | boolean | false | Shows a spinner, blocks activation and sets `aria-busy`. |
| loadingLabel | string | Loading… | Accessible label announced while loading. |
| rel | string | — | |
| rounded | boolean | — | |
| size | "s" | "m" | "l" | — | |
| stretched | boolean | — | |
| target | string | — | |
| type | "button" | "submit" | "reset" | — | |
| variant | "link" | "primary" | "secondary" | "tertiary" | "outline" | — |