Buttons
ToolButton
Toolbar button with a density-adaptive icon and optional text.
import { ToolButton } from "datui";Playground
<ToolButton variant="primary" appearance="accent" direction="row">Edit</ToolButton>Examples
Variants and direction
Accessibility
- Renders
<button>(or<a>withhref); Enter/Space activate natively. - Icon-only buttons need
aria-label; icons arearia-hidden. - Icons switch size (or
iconCompact/iconRegular) withAppRootdensity via CSS.
API
ToolButton
Toolbar button with a density-adaptive icon and optional text. Icon-only needs `aria-label`.
| Prop | Type | Default | Description |
|---|---|---|---|
| activated | boolean | — | Keep the pressed look, e.g. for the active item of a list. |
| appearance | "accent" | "neutral" | accent | |
| as | ElementType<any, keyof IntrinsicElements> | — | Element to render. Defaults to `a` with `href`, `button` with `onClick`, otherwise `div`. |
| className | string | — | |
| direction | "row" | "column" | row | Icon beside (`row`) or above (`column`) the text. |
| disabled | boolean | — | |
| href | string | — | |
| icon | ReactNode | — | Icon; sized 24px at regular density and 20px at compact. |
| iconCompact | ReactNode | — | Explicit icon for compact density (with `iconRegular`). |
| iconRegular | ReactNode | — | Explicit icon for regular density (with `iconCompact`). |
| rel | string | — | |
| rounded | boolean | — | Pill shape. Ignored for `column` buttons with text. |
| target | string | — | |
| type | "button" | "submit" | "reset" | — | |
| variant | "primary" | "secondary" | "tertiary" | "outline" | primary |