datui
Color scheme

Buttons

IconButton

Square icon-only button.

import { IconButton } from "datui";

Playground

<IconButton label="Settings" size="m" />

Examples

Sizes and states

Home

Accessibility

  • Renders <button type="button">, or <a> with href.
  • Needs an accessible name: label (rendered visually hidden) or aria-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`.

PropTypeDefaultDescription
activatedboolean—Keep the pressed look, e.g. for the active item of a list.
asElementType<any, keyof IntrinsicElements>—Element to render. Defaults to `a` with `href`, `button` with `onClick`, otherwise `div`.
classNamestring—
disabledboolean—
hrefstring—
labelstring—Visually hidden accessible name. Alternatively pass `aria-label`.
relstring—
size"s" | "m" | "l"lHit area matches the control heights: `l` 44px with a 24px icon, `m` 36px with 20px, `s` 28px with 16px (regular density).
targetstring—
type"button" | "submit" | "reset"—