Forms
Removable
Wraps a row or field with a remove action: a trailing ✕ button, or a two-step reveal that shows a destructive Remove button.
import { Removable } from "datui";Playground
+1 555 0100
<Removable variant="button" align="center">+1 555 0100</Removable>Examples
Button
Removes in one click. indent keeps the space for alignment.
Reveal
The minus button reveals a labelled Remove button; Escape, clicking elsewhere or moving focus collapses it.
Milk
Bread
Coffee
Accessibility
- The ✕ and minus buttons are labelled with
removeLabel("Remove"); the revealed button shows it as visible text. - In
reveal, the minus button hasaria-expanded; activating it moves focus to the Remove button. Escape collapses and returns focus to the minus button. - While collapsed, the Remove button is
inert— out of the tab order and hidden from assistive tech. - The remove click doesn't bubble to a surrounding row, so the row's own action never fires.
API
Removable
Wraps a row or field with a remove action.
| Prop | Type | Default | Description |
|---|---|---|---|
| align | "center" | "start" | center | Vertical alignment of the remove control. |
| className | string | — | |
| disabled | boolean | — | |
| indent | boolean | false | Keep the control's space but hide it, to line up with removable siblings. |
| noPadding | boolean | false | Drop the gutter around the remove control. |
| onRemove | ((event: MouseEvent<HTMLButtonElement, MouseEvent>, rootEl: HTMLDivElement | null) => void) | — | Called with the click event and the root element when the user confirms removal. |
| removeLabel | string | Remove | Label of the remove button (aria-label for `button`, visible text for `reveal`). |
| variant | "button" | "reveal" | button | `button`: trailing ✕ removes at once. `reveal`: leading minus reveals a destructive "Remove" button (two steps). |