Appearance
Entity picker
A dialog with a list of entities to choose from, to link them to the entity you are working on.
modals-entitypicker--defaultOpen in Storybook ↗When to use
- Linking existing records to the one you have open: Add existing assets on an asset's list or media block.
- Choosing records in a step of a guided flow.
- People need filters, sorting or a preview to find the right records.
When not to use
- A fixed list of values: use a dropdown.
- Creating a new record: use a dynamic form.
- Setting one relation field while you edit it: the field's autocomplete and its quick search are enough (see Quick search from a relation field).
Anatomy
- Dialog: a wide modal, titled by the action that opened it: Add existing {type}.
- List bar: the Filters button, the result count and the sort controls. Filters opens the filter panel beside the list.
- Selection bar: the number selected and Confirm selection (commit). The button is disabled until something is selected.
- List: list rows with a checkbox, a thumbnail, the title and the configured columns. The header checkbox selects the page. When the type has a preview, the eye opens it.
- Highlight chip (optional): a label on rows the flow marks as current, with
--chip-paddingand--color-accent-wash.
Variants
| Variant | Where | Behaviour |
|---|---|---|
| Filters | default | Filters button and filter panel; the list follows the filters |
| Search | configured per field or step | a search bar above the list instead of filters |
| Links on confirm | form dialog, e.g. Add existing assets | Confirm selection saves the links, closes the dialog and refreshes the list |
| Hands back on confirm | guided flow step | Confirm selection hands the selection to the flow and clears it; nothing is saved yet |
modals-entitypicker--filters-openOpen in Storybook ↗modals-entitypicker--search-modeOpen in Storybook ↗In search mode the search runs as you type, 250 ms after the last key, or at once on Enter. It searches the metadata fields the configuration names. In search mode the picker is --entity-picker-height tall in a modal and --entity-picker-drawer-height in a drawer.
States
| State | What you see | Trigger |
|---|---|---|
| Nothing selected | Confirm selection disabled | opening |
| Selected | checked rows with a wash, Selection: {n}, Confirm selection enabled | checking rows |
| Already linked | the row is greyed out and has no checkbox | the entity is already linked to the open entity |
| Limit reached | the other rows' checkboxes are disabled | the configured maximum is selected |
| No results | No results match your filters with a tip; in search mode No results found | nothing matches |
modals-entitypicker--selectedOpen in Storybook ↗modals-entitypicker--already-linkedOpen in Storybook ↗After Confirm selection in a form dialog:
- Open edits on the entity are saved first. If they have errors, the dialog closes and a warning says Saving failed.
- The selected entities are linked, or they replace the existing links of that type when the action is set to replace.
- The dialog closes, the new rows show in the list at once and the change is saved.
- A notification confirms the save and the list reloads. If the save fails, the dialog opens again.
Keyboard & accessibility
- The dialog follows the modal: focus starts on the close button, Escape closes it, and the title names it.
- Tab moves through the list bar, the selection bar and the rows. Space checks a row's checkbox.
- Rows that are already linked have no checkbox, so they are skipped.
- The selection count is
role="status", so a new count is announced. - The search bar is labelled Search.
Content
- Title the dialog by the action: Add existing assets, not Entity picker.
- Keep the highlight label short: one or two words.
- Translation keys:
bulk-operations.add-existing-relation,bulk-operations.confirm-selection.
Quick search from a relation field
While you edit a relation field, Browse… under the field opens a smaller search dialog. It searches the field's type and puts the chosen entities in the field, which saves like any other inline edit.
modals-relationpicker--multipleOpen in Storybook ↗- Header: the title Choose {type}, a count chip Results: {n} (
--chip-padding) and the close button. - Search pill: search icon, input and, while results load, a spinner.
- Results: a fixed-height area (
--relation-picker-results-height), so the dialog keeps its size while you type. A selected row has--color-accent-washand a check in--color-commit. - Footer (multiple only): Cancel and Add, padded with
--modal-footer-pad.
From 48rem up the dialog is --relation-picker-width wide. For a single-select field, choosing a row picks it and closes the dialog; there is no footer. The search runs as you type, 250 ms after the last key, and lists the first page of results. When nothing matches and the field allows new entities, Create '{query}' closes the dialog and starts the field's own create flow.
modals-relationpicker--no-resultsOpen in Storybook ↗| Key | In the search pill | On a row |
|---|---|---|
| ↓ | first row | next row |
| ↑ | — | previous row; from the first row back to the search pill |
| Enter / Space | — | chooses the row |
| Escape | closes the dialog | closes the dialog |
Focus starts in the search pill. The results are a listbox (aria-multiselectable when multiple), each row an option with aria-selected. Keys: inline-edit.browse, inline-edit.browse-title, inline-edit.picker-*.
Related
Modal · Filter panel · Entity list element · Selection action bar · Autocomplete · Guided flow