Buttons
IconButton
Square icon-only button.
import { IconButton } from "datui";Playground
<IconButton label="Settings" size="m" />Examples
Sizes and states
Accessibility
- Renders
<button type="button">, or<a>withhref. - Needs an accessible name:
label(rendered visually hidden) oraria-label; a console warning fires otherwise. - The icon is
aria-hidden.
API
IconButton
Square icon-only button. Needs `label` or `aria-label`. Renders `<a>` with `href`.
| Prop | Type | Default | Description |
|---|---|---|---|
| activated | boolean | — | Keep the pressed look, e.g. for the active item of a list. |
| as | ElementType<any, keyof IntrinsicElements> | — | Element to render. Defaults to `a` with `href`, `button` with `onClick`, otherwise `div`. |
| className | string | — | |
| disabled | boolean | — | |
| href | string | — | |
| label | string | — | Visually hidden accessible name. Alternatively pass `aria-label`. |
| rel | string | — | |
| size | "s" | "m" | "l" | l | Hit area matches the control heights: `l` 44px with a 24px icon, `m` 36px with 20px, `s` 28px with 16px (regular density). |
| target | string | — | |
| type | "button" | "submit" | "reset" | — |