Skip to content

Repeatable row group ​

A block that repeats the same fields for every entry in a list, such as each ISBN with its edition.

entityelements-entityelementwindowpanel--repeatableOpen in Storybook ↗

When to use ​

  • A field that holds a list of entries, where each entry has one or more values that belong together: ISBN numbers, EAN codes.

When not to use ​

  • A single value: use a field row.
  • A list of related entities: use a relation field, which edits with an autocomplete.

Anatomy ​

  1. Block header: the block's label, bold, and on the right an Add more pill (--radius-pill, --button-sm-padding, --text-button-sm, --color-text-light, --color-accent-wash on hover).
  2. Row: one entry. Each field in it is a field row; the fields sit side by side in columns and wrap to fewer columns when the block is narrow. Rows are rounded (--radius-input); every second row is striped with --color-surface-repeat-row, and a hovered row fills with --color-surface-row-hover.
  3. Row header: the block label and the row number (ISBN 2) in --text-label and --color-text-secondary, with a ghost trash button, centred between two rules in --color-border-default. The rules also separate the rows.

Variants ​

VariantWhat you seeWhen
EditableAdd more pill, a row header with a trash button above every rowthe user may update the entity
Single empty rowone row of empty fields, no row headerthe list has no entries yet
Read-onlyrows separated by a rule, no pill and no trash buttonsthe user can't update the entity, or the block isn't editable
entityelements-entityelementwindowpanel--repeatable-emptyOpen in Storybook ↗
entityelements-entityelementwindowpanel--repeatable-read-onlyOpen in Storybook ↗

States ​

StateWhat you seeTrigger
Restingstriped rows—
Row hoverrow fillpointer
Field editingthat field's inline editor replaces its valueclick the value
New rowan empty row at the bottom; focus on its first fieldAdd more
Remove saved rowa confirmation dialog, then the row is gonethe trash button of a saved row
Remove new rowthe row is gone, no confirmationthe trash button of a row that isn't saved yet
entityelements-entityelementwindowpanel--repeatable-new-rowOpen in Storybook ↗

How rows save:

  • Each field edits and saves on its own, like any field row. Saving stores the block's whole list with that one value changed.
  • A new row exists only on screen until one of its fields is saved. You can add several new rows before saving any of them.
  • Saved rows stay on top, in their stored order. A new row that is saved moves up to right after them.
  • Removing a saved row asks first, then saves the list without it.
  • Rows can't be reordered.
  • A multilingual field in a row stays read-only.

Keyboard & accessibility ​

  • The rows are a role="list"; each row is a role="listitem".
  • Add more is a real <button>. After adding a row, focus moves to the first field of the new row; Enter opens it.
  • The trash button is named after the row's first filled value, Remove row: 978-90-209-1234-5, or else after the row, Remove row: ISBN 2.
  • The rules beside the row header are decorative (aria-hidden).
  • The confirmation is a modal with Cancel and a danger Remove button.

Content ​

  • The row header is the block label and the row number: ISBN 2.
  • Confirmation: Remove this row?, Its values are deleted when you confirm., Remove and Cancel.
  • Translation keys: actions.labels.add-more, inline-edit.remove-row and inline-edit.remove-row-confirm.*.

Field row · Inline editor · Modal · Button

Powered by Elody - Open Source Semantic Data Platform