Skip to content

Grid

Move through two-dimensional cells, select values, and enter edit mode.

Usage

Selectable

Move through a grid and select the active cell.

Move through a grid and select the active cell.

Core
Ready
Vue
Active

Disabled wrap

Skip unavailable cells when movement wraps across a grid boundary.

Skip unavailable cells when movement wraps across a grid boundary.

Production
Ready
v0.2
Preview
Pending
next

Editable

Move through grid cells and edit the active value without losing two-dimensional navigation.

Move through grid cells and edit the active value without losing two-dimensional navigation.

Production
Ready
v0.2
Preview
Pending
next

Controlled

Let the parent own the current value and apply accepted changes back to the component.

Let the parent own the current value and apply accepted changes back to the component.

Production
Ready
v0.2
Preview
Pending
next

API

Vue package: @sectile/vue/grid

Components
  • GridRoot
  • GridRow
  • GridCell

Props

GridRootProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

defaultEditMode

Initial uncontrolled editing mode.

defaultHighlightedValue

Initially highlighted value for uncontrolled state.

defaultValue

Initial value used when the component owns its state.

disabled

Whether interaction is unavailable.

disabledItems

Item values excluded from focus and selection.

editMode

Controlled editing mode.

highlightedValue

Value currently highlighted for keyboard interaction.

label

Accessible name announced for the control.

modelValue

Current value when state is controlled by the parent.

policies

Behavior policies that customize validation, movement, or selection.

readonly

Whether the value can be inspected but not changed.

rows

Two-dimensional item structure managed by the component.

GridPartProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

Slots

GridRootSlotProps

disabled

Whether interaction is unavailable.

editMode

Current editing mode.

highlightedValue

Value currently highlighted for interaction.

readonly

Whether the value can be inspected but not changed.

value

Current value exposed by this contract.

GridCellSlotProps

disabled

Whether interaction is unavailable.

editMode

Current editing mode.

highlighted

Whether this item is highlighted for interaction.

highlightedValue

Value currently highlighted for interaction.

readonly

Whether the value can be inspected but not changed.

selected

Whether this item is selected.

value

Current value exposed by this contract.

Events

GridRoot

editCancel

Emitted when editing is cancelled without committing.

editCommit

Emitted when an edited cell value is committed.

editStart

Emitted when a cell enters editing mode.

update:editMode

Emitted when the requested edit mode changes.

update:highlightedValue

Emitted when the requested highlighted value changes.

update:modelValue

Emitted when the component requests a new controlled value.

Other types

GridValueChangeHandler

ts
type GridValueChangeHandler = (value: string | null) => void

GridHighlightedValueChangeHandler

ts
type GridHighlightedValueChangeHandler = (value: string | null) => void

GridEditModeChangeHandler

ts
type GridEditModeChangeHandler = (value: GridEditMode) => void

GridEditStartHandler

ts
type GridEditStartHandler = (value: string) => void

GridEditCommitHandler

ts
type GridEditCommitHandler = (value: string) => void

GridEditCancelHandler

ts
type GridEditCancelHandler = (value: string) => void

GridEditMode

ts
type GridEditMode = 'navigation' | 'editing'

GridPolicies

NameTypeRequired
eligible(id: ID) => boolean
boundaryAxisBoundaryPolicy
maxScannumber

Parts

Shared scope: [data-scope="grid"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
root[data-part="root"]Defines the component boundary and owns its composed parts.
row[data-part="row"]Groups cells that belong to one grid row.
cell[data-part="cell"]Represents one navigable or selectable grid value.

Keyboard interaction

KeyBehavior
Arrow keysMove between grid cells.
SpaceSelect the current cell or row.
Enter / F2Enter edit mode when the current cell supports editing.
EscapeCancel the active edit.

Accessibility

The labeled grid reports row and column counts while each cell exposes position, selection, and disabled state.

See the corresponding WAI-ARIA pattern for the host accessibility contract.

Released under the MIT License.