Pick list

Two lists side by side, the available items and the chosen ones, with buttons that move the selected or all shown items between them. In a narrow container the lists stack.

  • vig-pick-list
  • ng-template[vigListItem]
Import
import { PickList } from '@vigdx/ui/pick-list';
import { ListItemTemplate } from '@vigdx/ui/listbox';

Basic

Bind both lists two-way with [(source)] and [(target)] and name them with sourceHeading and targetHeading . Moved items are appended to the other list.

Available
Bread
Butter
Cheese
Eggs
Milk
Tomatoes

Basket
Coffee

Basket: Coffee

Filter, reorder, drag and a template

filter adds a search field to each list; “Move all” then moves only the matching items. reorder adds order buttons to the target, dragDrop pointer dragging between and within the lists. itemLabel names object items and a vigListItem template renders them; (moved) reports every transfer, and [(sourceSelection)] / [(targetSelection)] expose what is selected.

Team
Ada LovelaceAnalyst
Grace HopperCompiler lead
Alan TuringResearch
Katherine JohnsonNavigation
Edsger DijkstraAlgorithms

Reviewers
No options

Nothing moved yet.

Related components

Each list is a listbox in multiple mode. For a single list to put in order, use an order list; to pick a few values in a form, a multi select or a listbox takes less room.

Styling hooks

Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="pick-list"][data-part="root"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.

Scope: [data-scope="pick-list"]

PickList styling hooks
Part Element data-state
root The vig-pick-list host, the container whose width stacks the lists. —
source The source vig-listbox ; style its [data-scope="listbox"] parts. —
transfer The buttons between the lists. —
move-to-target Moves the selected source items to the target. —
move-all-to-target Moves every shown source item to the target. —
move-to-source Moves the selected target items back. —
move-all-to-source Moves every shown target item back. —
target The target vig-listbox ; style its [data-scope="listbox"] parts. —
controls The order buttons of the target ( reorder ). —
move-top The "Move to top" button ( reorder ). —
move-up The "Move up" button ( reorder ). —
move-down The "Move down" button ( reorder ). —
move-bottom The "Move to bottom" button ( reorder ). —
status The visually hidden polite region announcing moves. —

Accessibility

  • Both lists are multi-selectable role="listbox" elements named by their headings; each has its own tab stop, with the buttons between them.
  • The buttons are named after the list they move to, e.g. “Move selected to Basket” and “Move all to Basket” (labels), and are disabled while there is nothing to move. When the button you used becomes disabled, focus continues in the list the items came from, or in the other one once it is empty.
  • From a list, Alt+ArrowRight moves the selection (or the active item) towards the target and Alt+ArrowLeft back; both are mirrored in right-to-left pages. With reorder, Alt+ArrowUp/ArrowDown and Alt+Home/End order the target.
  • Every move is announced in a polite live region, e.g. “2 items moved to Basket”.
  • The layout follows the container, not the viewport: below 36rem the lists stack and the transfer arrows turn to point down and up. Start and end are logical, so in right-to-left pages the source list is on the right.

API

PickList

vig-pick-list component

Two lists — the available source items and the chosen target ones — with buttons moving the selected or all shown items between them. Each list can be filtered (filter); reorder adds order buttons to the target. Keyboard: select in a list, then Alt+ArrowRight moves the selection towards the target and Alt+ArrowLeft back (mirrored in RTL), Alt+ArrowUp/ArrowDown/Home/End reorder the target; every move is announced. The lists sit side by side and stack in a narrow container.

Example :
<vig-pick-list sourceHeading="Available" targetHeading="Chosen"
  [(source)]="available" [(target)]="chosen" [itemLabel]="name" filter />
PickList props
Name Type Default Description
disabledbooleanfalse

Blocks selecting and moving; the lists stay focusable for reading.

dragDropbooleanfalse

Also move items by dragging with a pointer; buttons and keys stay the primary way.

filterbooleanfalse

A filter field above each list.

itemLabel(item: T) => string(item) => String(item)

Text of an item, for its accessible name, filtering, typeahead and default rendering.

labelsPartial<PickListLabels>—

Texts (i18n) over the locale defaults.

reorderbooleanfalse

Order buttons (and Alt+arrow keys) for the target list.

sizeFieldSize'md'

Text size, option padding and button size.

source model T[][]

The items still available.

sourceHeading required string—

Visible name of the source list.

sourceSelection model T[][]

The selected items of the source list, which "move selected" moves.

target model T[][]

The chosen items, in their order.

targetHeading required string—

Visible name of the target list.

targetSelection model T[][]

The selected items of the target list.

ListItemTemplate

ng-template[vigListItem] directive

Custom rendering for the items of vig-order-list and vig-pick-list, replacing the default label. Bind the same items to vigListItemOf (like ngForOf) to type let-item; without it the item is unknown.

Example :
<vig-order-list heading="Tasks" [(value)]="tasks" [itemLabel]="taskLabel">
  <ng-template vigListItem [vigListItemOf]="tasks" let-task>
    <span class="truncate">{{ task.title }}</span>
    <vig-tag class="ms-auto" [value]="task.status" />
  </ng-template>
</vig-order-list>
ListItemTemplate props
Name Type Default Description
vigListItemOfreadonly T[] | null | undefinedundefined

Type-only: the items the template renders, so the template type checker infers the item type. Not read at runtime.

Are you sure?