Transfer List

A recipe: items moved between two lists — two Listboxes and one value, the chosen ids in order. No component of its own.

Usage

Usage

Available 0 / 6
Delete
Share
Export
Invite members
Billing
Administer
Granted 0 / 2
Read
Write

Value: read, write

import { Component, ViewEncapsulation, computed, signal } from '@angular/core';import {  ScButton,  ScCheckbox,  ScInput,  ScListboxItem,  ScListboxMultiple,} from '@semantic-components/ui';import {  SiChevronLeftIcon,

How it is made

The value is yours: a signal of the chosen ids (or a field of your form's model). Each side is computed from it — the rest of the items in theirs, the chosen in the value's order — and is a scListbox multiple bound to what is selected there. One template for both sides (a @for over two side descriptions), the buttons between them by grid order.

  • Move: the selected ids across — still selected on their new side, so a move back is one key away. Move all: what the side shows (searched), not disabled.
  • Enter on a list, or a double-click on an item, moves too: a (keydown.enter) and a (dblclick).
  • Search: a text per side, filtering what it shows. Select all: a checkbox, checked when every movable item is selected, indeterminate when some are.
  • Reorder: the chosen side's selection moved up or down by one, together; the buttons disabled at the ends.
import { ScButton, ScCheckbox, ScInput, ScListboxItem, ScListboxMultiple } from '@semantic-components/ui';
@for (side of sides; track side.key) {  <input type="checkbox" scCheckbox [checked]="allSelected(side.key)" (checkedChange)="selectAll(side.key, $event)" />  <input scInput type="search" [value]="query[side.key]()" (input)="search(side.key, $event)" />  <div scListbox multiple [(value)]="…selected" (keydown.enter)="move(side.key)">    @for (item of lists()[side.key]; track item.id) {      <div scListboxItem [value]="item.id" (dblclick)="move(side.key, [item.id])">{{ item.label }}</div>    }  </div>}<button scButton (click)="move('source')">…</button>  <!-- move all, back, reorder -->

Accessibility

  • Each list is a Listbox, one Tab stop, named by its title: arrows, Space to select, Shift for a range, Ctrl + A for all, typing to jump.
  • Name every icon button ("Add selected"), the searches and the select-all checkboxes; buttons with nothing to do are disabled.
  • In right-to-left pages the arrows turn (rtl:rotate-180), so they point across as the text reads.

Examples

Ordered

Hidden 0 / 3
Role
Team
Joined
Shown 0 / 3
Name
Email
Status

Value: name · email · status

import { Component, ViewEncapsulation, computed, signal } from '@angular/core';import {  ScButton,  ScCheckbox,  ScListboxItem,  ScListboxMultiple,} from '@semantic-components/ui';import {  SiChevronDownIcon,  SiChevronLeftIcon,

Form

Permissions for the role

Available 0 / 7
Write
Delete
Share
Export
Invite members
Billing
Administer
Granted 0 / 1
Read
import { Component, ViewEncapsulation, computed, signal } from '@angular/core';import { FormRoot, form, minLength } from '@angular/forms/signals';import {  ScButton,  ScCheckbox,  ScInput,  ScListboxItem,  ScListboxMultiple,} from '@semantic-components/ui';import {

RTL

المتاحة 0 / 7
كتابة
حذف
مشاركة
تصدير
دعوة أعضاء
الفوترة
الإدارة
الممنوحة 0 / 1
قراءة
import { Dir } from '@angular/cdk/bidi';import {  Component,  LOCALE_ID,  ViewEncapsulation,  computed,  signal,} from '@angular/core';import {  ScButton,