On this page
@addTagHelper *, Webority.Ui.RazorEntering lines
Type a line, press Enter to save it and move to the next, or Ctrl+S to save and stay. Each demo on this page is server-rendered: a page reacts to the wui-entry-grid:commit, wui-entry-grid:discard, wui-entry-grid:active and wui-entry-grid:add events in its own script, and sets the row state and the active row itself.
| Status | Item | Cases | Units |
|---|---|---|---|
| Saved | |||
| Total | 78 |
A failed save
When a save is refused, the page sets the row to failed and passes the reason to the row's error. The grid does not move on, so the person corrects the same line.
| Status | Item | Cases | Units |
|---|---|---|---|
| Not saved | |||
Units cannot be fewer than cases. Correct the figures and save again. | |||
| Saved | |||
Detail under the active line
A detail draws context under the line the person is working on, without leaving the grid.
| Status | Item | Cases | Units |
|---|---|---|---|
|
Blue pens Line details 4 cases, 48 units. | |||
| Saved | |||
Without the keyboard legend
The legend under the grid lists the keys. Turn it off when the page already explains them.
| Status | Item | Cases | Units |
|---|---|---|---|
| Saved | |||
Guidance
What to do, and what to avoid.
Use it when
- A person enters or corrects several lines of figures in one table, one line at a time.
- Each line is saved on its own, and the person moves through the lines with the keyboard.
Reach for something else when
- The table only shows records and nothing is typed into it. → AppDataTable
- One field on a record is edited in place. → AppInlineEdit
Save each line as the person leaves it
| Status | Item | Units |
|---|---|---|
| Blue pens | 48 |
Enter saves the line and moves to the next one, so the person never reaches for a save button per line.
| Item | Units |
|---|---|
| Blue pens | 48 |
A read-only table with no save path leaves the person's typing with nowhere to go.
Reference
Try every prop, read the full list, and check keyboard and screen reader behaviour.
27 props. The 2 most used come first.
Used on most screens 2 props
| Prop | Type | Default | Description |
|---|---|---|---|
| hintdefault true | bool | true | Shows the keyboard legend under the grid. |
| add-labeldefault Add line | string | Add line | The text of the Add line button. |
Less common 25 props
| Prop | Type | Default | Description |
|---|---|---|---|
| labeldefault Entry lines | string | Entry lines | The accessible name of the table. |
| adddefault false | bool | false | Draws the Add line button under the grid. |
| empty-labeldefault No lines yet | string | No lines yet | The text shown when the grid has no rows. |
| status-labeldefault Status | string | Status | The visually hidden heading of the status column. |
| dirty-labeldefault Changed | string | Changed | The status word of a changed line. |
| saving-labeldefault Saving | string | Saving | The status word of a line being saved. |
| saved-labeldefault Saved | string | Saved | The status word of a saved line. |
| failed-labeldefault Not saved | string | Not saved | The status word of a refused line. |
| commit-next-labeldefault Save and go to the next line | string | Save and go to the next line | The legend text for Enter. |
| commit-stay-labeldefault Save | string | Save | The legend text for Ctrl+S. |
| discard-labeldefault Discard changes | string | Discard changes | The legend text for Escape. |
| move-labeldefault Move between lines | string | Move between lines | The legend text for Ctrl+Up and Ctrl+Down. |
| classdefault - | string | - | Added to the grid's root element. |
| (app-entry-grid-column) keydefault - | string | - | The key a cell names in its column attribute. |
| (app-entry-grid-column) labeldefault - | string | - | The column's header text. |
| (app-entry-grid-column) kinddefault text | text | number | text | A number column right-aligns its cells and selects the text of a focused input. |
| (app-entry-grid-column) widthdefault - | string | - | The column's width, as a CSS length. |
| (app-entry-grid-column) helpdefault - | string | - | Help shown in a tip beside the header label. |
| (app-entry-grid-row) keydefault - | string | - | The row's unique key, the value the page keeps as the active row. |
| (app-entry-grid-row) statedefault clean | clean | dirty | saving | saved | failed | clean | The save state of the line, shown as its status glyph. |
| (app-entry-grid-row) activedefault false | bool | false | Marks the line the person is working on. |
| (app-entry-grid-cell) columndefault - | string | - | The key of the column this cell sits under; the cell holds the author's input. |
| (app-entry-grid-detail)default - | content | - | Shown under the active row only. |
| (app-entry-grid-error)default - | content | - | Shown under a failed row, in an alert. |
| (app-entry-grid-footer) columndefault - | string | - | The column this totals cell sits under; its content is the total. |
Keyboard
5 keys| Key | Does | Notes |
|---|---|---|
| Enter | Saves the line; the page moves to the next line once the save succeeds. | Does nothing inside a text area, a button, or an open menu. |
| Ctrl+S | Saves the line and keeps the focus on it. | Meta+S does the same on a Mac. |
| Escape | Discards the changes on the line and restores its last saved values. | Does nothing inside an open menu. |
| Ctrl+ArrowUp and Ctrl+ArrowDown | Moves the active line up or down. | Does nothing at the first or last line. |
| Tab and Shift+Tab | Move between the fields of a line in page order. | Never intercepted, so the person can always tab out of the grid. |
Screen reader
3 notes- The table is named by label, and the active line carries aria-current.
- Each status is a glyph with a visually hidden word, so a saving, saved or failed line is not shown by colour alone.
- A failed line shows its error in an alert region under the line.
Do and avoid
1 pairsSave each line as the person leaves it
| Status | Item | Units |
|---|---|---|
| Blue pens | 48 |
Enter saves the line and moves to the next one, so the person never reaches for a save button per line.
| Item | Units |
|---|---|
| Blue pens | 48 |
A read-only table with no save path leaves the person's typing with nowhere to go.