Primitives
Tappable & Clickable
Clickable renders the right interactive element for its props; Tappable adds hover, press, focus and disabled feedback. Buttons, cells and tabs are built on them.
import { Tappable, Clickable } from "datui";Examples
Feedback modes
Non-native elements
A div with onClick gets role="button", a tab stop and Enter/Space activation.
Focus me and press Enter or Space
Activated 0 timesAccessibility
- With
hrefrenders<a>, withonClickrenders<button type="button">; otherwise a non-interactivediv. - Non-native elements (
as="div") receiverole="button",tabIndex=0and Enter/Space activation. disableduses the native attribute on buttons andaria-disabledelsewhere; links lose theirhref.- Focus is shown with the shared focus ring on keyboard focus only (
:focus-visible).
API
Tappable
Interactive surface with consistent hover, press, focus and disabled feedback. Base of buttons, cells and tabs.
| 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 | — | |
| feedback | "background" | "opacity" | "none" | — | Feedback on hover/press. `background` tints the surface; `opacity` fades it. |
| href | string | — | |
| rel | string | — | |
| target | string | — | |
| type | "button" | "submit" | "reset" | — |
Clickable
Renders the right interactive element for its props and gives non-native elements button semantics (role, tab stop, Enter/Space activation).
| Prop | Type | Default | Description |
|---|---|---|---|
| as | ElementType<any, keyof IntrinsicElements> | — | Element to render. Defaults to `a` with `href`, `button` with `onClick`, otherwise `div`. |
| className | string | — | |
| disabled | boolean | — | |
| href | string | — | |
| rel | string | — | |
| target | string | — | |
| type | "button" | "submit" | "reset" | — |