datui
Color scheme

Data display

Cell

A SimpleCell with list-editing modes: selectable (checkbox or radio), removable, and draggable reordering inside List.

import { Cell, List } from "datui";

Playground

Cell title Subtitle
<Cell subtitle="Subtitle" selectionType="checkbox">Cell title</Cell>

Examples

Selectable

The whole row is a label for a native checkbox or radio.

Removable

A trailing remove button, separate from the row's own action.

+1 555 0100
+1 555 0101
+1 555 0102

Draggable

Drag the handle, or focus it and use Space and the arrow keys. You reorder the data in onDragFinish.

Inbox
Starred
Sent
Drafts

Accessibility

  • Inside List the container has role="list" and every Cell is a listitem.
  • mode="selectable" renders a <label> around a real input type=checkbox (or radio), so clicking the row or pressing Space toggles it and the row text is its name.
  • mode="removable" adds a separate button labelled removeLabel ("Remove"); it is not nested in the row's button and does not trigger onClick.
  • The drag handle is a button labelled dragHandleLabel ("Reorder") with aria-roledescription="sortable". Space or Enter lifts, arrow keys move, Space or Enter drops, Escape cancels.
  • Moves are announced through a live region; List accepts announcements and dragInstructions to localize them.
  • disabled disables the row, the selection input, the remove button and the drag handle.

API

Cell

SimpleCell with list-editing modes: selectable (checkbox/radio), removable and draggable reorder. `ref`, `className` and `style` go to the outer row element.

PropTypeDefaultDescription
activatedboolean—Keep the pressed look, e.g. for the active item of a list.
afterReactNode—Trailing content, e.g. a switch, counter or button-free text.
asElementType<any, keyof IntrinsicElements>—Element to render. Defaults to `a` with `href`, `button` with `onClick`, otherwise `div`.
badgeAfterSubtitleReactNode—
badgeAfterTitleReactNode—
badgeBeforeSubtitleReactNode—
badgeBeforeTitleReactNode—
beforeReactNode—Leading content, e.g. an icon or avatar.
checkedboolean—
chevronbooleanfalseShow a trailing chevron for navigational rows.
chevronSize"s" | "m""m"
classNamestring—
defaultCheckedboolean—
disabledboolean—
draggableboolean—Show a reorder handle. Works for direct children of `List`; the consumer reorders data in `onDragFinish`.
dragHandleLabelstringReorder
extraSubtitleReactNode—
hasActivebooleantrueBackground tint while pressed.
hasHoverbooleantrueBackground tint on hover.
hrefstring—
indicatorReactNode—Secondary value shown before `after`, e.g. the current setting.
mode"selectable" | "removable"—`selectable` turns the row into a label with a checkbox or radio; `removable` adds a trailing remove button.
multilinebooleanfalseWrap long text instead of truncating it.
namestring—Form field name of the selection input.
onCheckedChange((checked: boolean) => void)—
onDragFinish((move: { from: number; to: number; }) => void)—Called after a drop with the original and new index within the List.
onRemove((event: MouseEvent<HTMLButtonElement, MouseEvent>, rootEl: HTMLDivElement | null) => void)—`mode="removable"`: called with the click event and the Cell's root element.
overTitleReactNode—Small text above the title.
relstring—
removeLabelstringRemove
selectionType"checkbox" | "radio"checkboxControl used by `mode="selectable"`. Radios sharing a `name` form a single-choice group.
subtitleReactNode—
targetstring—
type"button" | "submit" | "reset"—
valuestring—Form value of the selection input.

List

Container for Cells (`role="list"`). Also hosts drag-and-drop reordering for `draggable` Cells, which must be its direct children.

PropTypeDefaultDescription
announcementsListAnnouncements—Screen reader announcements for drag reordering, for localization. Positions are 1-based; each function overrides the English default for that event.
classNamestring—
dragInstructionsstringTo reorder, press Space or Enter on the handle, use the arrow keys to move, then Space or Enter to drop. Press Escape to cancel.Instructions read when a drag handle is focused.
gapnumber0Space between items in px.