Selectable Row
A controlled selectable row that separates selection proposals from activation.
A controlled row primitive for lists, file browsers, and tables that handles press, keyboard, focus, and row accessibility semantics while keeping selection and activation distinct.
Preview
Section titled “Preview”Press Tab to focus an enabled row and Space to propose selection. Press Enter (or double-click on Web) on the Assets row to trigger an activation request.
Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases.
import { selectableRow, asSelectableRow } from '@proto.ui/prototypes-base/selectable-row';This subpath also exports the default prototype, SelectableRowProps, SelectableRowExposes, and SelectableRowAsHookContract, while the package root re-exports the named entries. The prototype and hook share the same setup.
Controlled selection and separate activation
Section titled “Controlled selection and separate activation”selectedis controlled by the caller: pointer press andSpaceemitselectionChangewith{ value: itemKey }without mutatingselectedlocally.- When
activatableistrue,Enteremitsactivatewith{ value: itemKey }without proposing selection. On Web, double-clicking (host:dblclick) also emitsactivate. - Enabled focused rows prevent default page scrolling on
Space; activatable focused rows also prevent default behavior onEnter. Auto-repeated keydown events do not re-emit selection or activation.
Focus, accessibility, and collection coordination
Section titled “Focus, accessibility, and collection coordination”- Renders
role="row"with the currentselectedanddisabledstates while preserving your children in the default slot. disabledsuppresses selection, activation, andfocusSelf()and removes the row from normal focus order, while preserving any externally selected state.- Arrow-key navigation, roving tab order, range selection, and multi-select belong to the enclosing collection.
| Prop | Type | Default |
|---|---|---|
itemKey | string | '' |
selected | boolean | false |
disabled | boolean | false |
activatable | boolean | false |
- Exposed states:
selected,disabled,focused,focusVisible. - Exposed methods:
focusSelf(). - Events:
selectionChange,activate, each carrying{ value: string }.