Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Entering 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.

Three lines of an order
The first line is active and changed, the second is saved, and the units total sits in the footer. Add line adds an empty line at the end.
StatusItemCasesUnits
Saved
Total78
  • Enter Save and go to the next line
  • Ctrl+S Save
  • Esc Discard changes
  • Ctrl+↑/↓ Move between lines
Show code
<app-entry-grid label="Order lines" add="true">
    <app-entry-grid-column key="item" label="Item" />
    <app-entry-grid-column key="cases" label="Cases" kind="Number" />
    <app-entry-grid-column key="units" label="Units" kind="Number" />
    <app-entry-grid-row key="L1" state="Dirty" active="true">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="order-l1-item" value="Blue pens" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="order-l1-cases" value="4" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="order-l1-units" value="48" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
    </app-entry-grid-row>
    <app-entry-grid-row key="L2" state="Saved">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="order-l2-item" value="Notebooks" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="order-l2-cases" value="2" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="order-l2-units" value="24" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
    </app-entry-grid-row>
    <app-entry-grid-row key="L3">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="order-l3-item" value="Staplers" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="order-l3-cases" value="1" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="order-l3-units" value="6" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
    </app-entry-grid-row>
    <app-entry-grid-footer column="item">Total</app-entry-grid-footer>
    <app-entry-grid-footer column="units">78</app-entry-grid-footer>
</app-entry-grid>

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.

A line that was refused
The refused line shows Not saved, its reason sits under it in an alert, and the focus stays on it.
StatusItemCasesUnits
Not saved
Saved
  • Enter Save and go to the next line
  • Ctrl+S Save
  • Esc Discard changes
  • Ctrl+↑/↓ Move between lines
Show code
<app-entry-grid label="Order lines">
    <app-entry-grid-column key="item" label="Item" />
    <app-entry-grid-column key="cases" label="Cases" kind="Number" />
    <app-entry-grid-column key="units" label="Units" kind="Number" />
    <app-entry-grid-row key="F1" state="Failed">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="fail-f1-item" value="Blue pens" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="fail-f1-cases" value="4" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="fail-f1-units" value="2" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-error>Units cannot be fewer than cases. Correct the figures and save again.</app-entry-grid-error>
    </app-entry-grid-row>
    <app-entry-grid-row key="F2" state="Saved">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="fail-f2-item" value="Notebooks" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="fail-f2-cases" value="2" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="fail-f2-units" value="24" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
    </app-entry-grid-row>
</app-entry-grid>

Detail under the active line

A detail draws context under the line the person is working on, without leaving the grid.

A card under the active line
The detail belongs to the active row only. Moving to another line moves the card with it.
StatusItemCasesUnits
Blue pens
Line details

4 cases, 48 units.

Saved
  • Enter Save and go to the next line
  • Ctrl+S Save
  • Esc Discard changes
  • Ctrl+↑/↓ Move between lines
Show code
<app-entry-grid label="Order lines">
    <app-entry-grid-column key="item" label="Item" />
    <app-entry-grid-column key="cases" label="Cases" kind="Number" />
    <app-entry-grid-column key="units" label="Units" kind="Number" />
    <app-entry-grid-row key="D1" state="Dirty" active="true">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="detail-d1-item" value="Blue pens" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="detail-d1-cases" value="4" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="detail-d1-units" value="48" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-detail>
            <app-card title="Blue pens" subtitle="Line details">
                <p class="mb-0 wui-text-sm">4 cases, 48 units.</p>
            </app-card>
        </app-entry-grid-detail>
    </app-entry-grid-row>
    <app-entry-grid-row key="D2" state="Saved">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="detail-d2-item" value="Notebooks" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="detail-d2-cases" value="2" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="detail-d2-units" value="24" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
    </app-entry-grid-row>
</app-entry-grid>

Without the keyboard legend

The legend under the grid lists the keys. Turn it off when the page already explains them.

Without the keyboard legend
hint set to false removes the keys line under the grid, for a page that already explains the keys.
StatusItemCasesUnits
Saved
Show code
<app-entry-grid label="Order lines" hint="false">
    <app-entry-grid-column key="item" label="Item" />
    <app-entry-grid-column key="cases" label="Cases" kind="Number" />
    <app-entry-grid-column key="units" label="Units" kind="Number" />
    <app-entry-grid-row key="N1" state="Saved">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="nohint-n1-item" value="Blue pens" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="nohint-n1-cases" value="4" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="nohint-n1-units" value="48" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
    </app-entry-grid-row>
    <app-entry-grid-row key="N2">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="nohint-n2-item" value="Notebooks" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="nohint-n2-cases" value="2" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="nohint-n2-units" value="24" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
    </app-entry-grid-row>
</app-entry-grid>

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

Do
StatusItemUnits
Blue pens48
  • Enter Save and go to the next line
  • Ctrl+S Save
  • Esc Discard changes
  • Ctrl+↑/↓ Move between lines

Enter saves the line and moves to the next one, so the person never reaches for a save button per line.

Avoid
ItemUnits
Blue pens48

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.

StatusItemCasesUnits
Saved
Total78
  • Enter Save and go to the next line
  • Ctrl+S Save
  • Esc Discard changes
  • Ctrl+↑/↓ Move between lines
React, generated from the controls
<AppEntryGrid
  label="Order lines"
  columns={[
    { key: 'item', label: 'Item' },
    { key: 'cases', label: 'Cases', kind: 'number' },
    { key: 'units', label: 'Units', kind: 'number', footer: (rows) => totalUnits(rows) },
  ]}
  rows={lines}
  rowKey={(row) => row.id}
  activeRowKey={activeKey}
  onActiveRowChange={setActiveKey}
  renderCell={renderCell}
  rowState={(row) => row.status}
  rowError={(row) => row.error}
  onCommitRow={commit}
  onDiscardRow={discard}
  onAddRow={addLine}
/>
Razor, the same props
<app-entry-grid label="Order lines" add="true">
    <app-entry-grid-column key="item" label="Item" />
    <app-entry-grid-column key="cases" label="Cases" kind="Number" />
    <app-entry-grid-column key="units" label="Units" kind="Number" />
    <app-entry-grid-row key="L1" state="Dirty" active="true">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="order-l1-item" value="Blue pens" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="order-l1-cases" value="4" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="order-l1-units" value="48" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
    </app-entry-grid-row>
    <app-entry-grid-row key="L2" state="Saved">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="order-l2-item" value="Notebooks" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="order-l2-cases" value="2" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="order-l2-units" value="24" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
    </app-entry-grid-row>
    <app-entry-grid-row key="L3">
        <app-entry-grid-cell column="item"><app-input control-only="true" aria-label="Item" name="order-l3-item" value="Staplers" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="cases"><app-input control-only="true" type="number" aria-label="Cases" name="order-l3-cases" value="1" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
        <app-entry-grid-cell column="units"><app-input control-only="true" type="number" aria-label="Units" name="order-l3-units" value="6" min="0" size="ControlSize.Sm" /></app-entry-grid-cell>
    </app-entry-grid-row>
    <app-entry-grid-footer column="item">Total</app-entry-grid-footer>
    <app-entry-grid-footer column="units">78</app-entry-grid-footer></app-entry-grid>

27 props. The 2 most used come first.

Used on most screens 2 props

PropTypeDefaultDescription
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

PropTypeDefaultDescription
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
KeyDoesNotes
EnterSaves 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+SSaves the line and keeps the focus on it.Meta+S does the same on a Mac.
EscapeDiscards the changes on the line and restores its last saved values.Does nothing inside an open menu.
Ctrl+ArrowUp and Ctrl+ArrowDownMoves the active line up or down.Does nothing at the first or last line.
Tab and Shift+TabMove 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 pairs

Save each line as the person leaves it

Do
StatusItemUnits
Blue pens48
  • Enter Save and go to the next line
  • Ctrl+S Save
  • Esc Discard changes
  • Ctrl+↑/↓ Move between lines

Enter saves the line and moves to the next one, so the person never reaches for a save button per line.

Avoid
ItemUnits
Blue pens48

A read-only table with no save path leaves the person's typing with nowhere to go.