Appearance
Keyboard & accessibility
Keyboard navigation
Ctrl stands for ⌘ on macOS.
| Key | Action |
|---|---|
| ← → ↑ ↓ | move the focus (↑ / ↓ also focus group rows) |
| Ctrl + arrow keys | move the focus and add the cell to the selection (multi selection) |
| Tab / Shift + Tab | next / previous cell (wraps to the next row) |
| Page Up / Page Down | one page up / down |
| Home / End | first / last cell of the row |
| Ctrl + Home / End | first / last cell of the grid |
| Shift + arrow keys, Page Up / Page Down, Home / End | extend the selection |
| Space | toggle the selection of the row (row selection, Shift + Space selects a range) or start editing |
| Ctrl + A | select all |
| Enter | start editing, expand / collapse tree rows which are not editable |
| F2 | start editing |
| any character | start editing and replace the value with the typed character |
| Delete / Backspace | clear the editable cells of the selection (cell range, all cells of the selected rows or the focused cell) |
| Alt + ← / → | collapse / expand tree rows |
| Ctrl + C | copy the selection (clipboard) |
| Ctrl + X | cut: copy the selection and clear the editable cells |
| Ctrl + V | paste at the focused cell |
| Ctrl + Z | undo the last change (undo and redo) |
| Ctrl + Y / Ctrl + Shift + Z | redo |
| Escape | cancel column dragging or dragging the fill handle |
Copy, cut and paste require the option clipboard, undo and redo the option undoRedo (both enabled by default). Delete, cut, paste and undo only change editable cells.
While editing
| Key | Action |
|---|---|
| Enter | finish editing (with enterMovesDown: true the focus moves to the cell below, with Shift to the cell above) |
| Shift + Enter | new line in a textarea editor |
| Tab / Shift + Tab | finish editing and edit the next / previous cell |
| Escape | cancel editing |
Group rows
When a group row (or a group footer) has the focus:
| Key | Action |
|---|---|
| ↑ / ↓ | previous / next row |
| → | expand the group, move to the next row if it is expanded already |
| ← | collapse the group, move to the parent group if it is collapsed already |
| Enter / Space | expand / collapse the group |
| Home / End | first / last row of the grid |
On a group footer the keys expand / collapse the group of the footer.
The focused cell always stays rendered and is scrolled into view.
Custom keyboard handling
Handle keys yourself with the onCellKeyDown callback and call preventDefault() to disable the default behavior:
vue
<Datagrid
:events="{
onCellKeyDown: (e) => {
if (e.key === 'Delete') {
e.preventDefault();
deleteSelectedRows();
}
},
}"
/>tsx
<Datagrid
events={{
onCellKeyDown: (e) => {
if (e.key === "Delete") {
e.preventDefault();
deleteSelectedRows();
}
},
}}
/>Accessibility
The grid follows the ARIA grid pattern:
role="grid"(treegridfor tree data and row grouping),row,columnheader,gridcellandrowgroup; toolbar, group area, pagination and status bar are outside of the grid elementaria-rowcount,aria-colcount,aria-rowindex,aria-colindex(also for virtualized rows)aria-sorton sortable headersaria-selectedfor selected rows and cells,aria-multiselectablearia-expandedandaria-levelfor tree and group rows- the grid is one tab stop: Tab focuses the first cell (or the last focused cell), the arrow keys move the focus
- editors are labelled with the header text of their column
aria-busywhile loading- a roving
tabindex: only the focused cell is part of the tab order - labels for checkboxes, toggle buttons and filter inputs (localized)
The demo pages of both adapters are checked with axe in the end-to-end tests (Chromium, Firefox and WebKit).
Touch devices
The grid can be used with the finger on phones and tablets:
| Gesture | Action |
|---|---|
| Tap | focus and select a cell or row, sort a column, toggle checkboxes and groups |
| Swipe | scroll (with the inertia of the browser) |
| Double tap | start editing a cell, autosize a column (double tap on its resize handle) |
| Long press on a cell | open the context menu |
| Drag a handle | resize a column, fill a range, drag a row |
| Long press on a header, then drag | move the column or drag it into the group area |
On devices without a mouse the resize handles are wider and the menu buttons of the headers are always visible. A comfortable density makes rows easier to hit.
Cell ranges cannot be selected by dragging with the finger, because dragging scrolls the grid. With a keyboard attached, Shift + tap or Shift + arrow keys select a range.