- Home
- Design system
- Ux patterns
- Repeatable editable rows
Repeatable editable rows
Implementing adding/deleting of repeatable editable rows in a form
Overview
When implementing repeatable, editable rows the following formats should be used
Initial empty state
By default, with no saved values:
- Show 1 row of blank fields
- The delete button must be disabled
- The Add row button must be disabled
html
Copy
Once text is entered into the first row:
- Enable the delete button
- Enable the Add row button
html
Copy
Deleting a row:
Clicking the ‘Delete row’ button, should:
- If row fields have values, show a confirmation dialog to delete the row
- If there is only 1 row, delete the contents of the fields
- If there is only 1 row, disable the Delete row button and the Add row button
- If there is more than one row, delete the current row
Add a row:
Clicking the ‘Add row’ button, should:
- Add a new empty row at the bottom of the list
- Disable the ‘Add row’ button
html
Copy
Examples
Using ds-table
Using ds-table is useful when implementing more than 2 fields per row, or the requirement for column labels.
html
Copy
Using ds-list
For simple key-pairs, ds-list requires the least markup.
html
Copy