A list that selects one value or many. The form value is the option value, or a string[] when multiple is set.
Unlock it plus 108 pro blocks, widgets & layouts — $99 one-time. Lifetime updates, 14-day money-back guarantee.
Value: none
<ply-listbox [options]="cities" [(ngModel)]="city" aria-label="City"></ply-listbox>
TypeScript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
// Install: npx ply-ui-cli add listbox
// Paths are relative to aliases.components (default: src/app/components)
import { ListboxComponent, ListboxOption } from './listbox/listbox.component';
@Component({
selector: 'app-listbox-example',
imports: [
ListboxComponent,
FormsModule
],
template: `...`
})
export class ListboxExampleComponent {
readonly cities: ListboxOption[] = [
{ label: 'Lisbon', value: 'lis' },
{ label: 'Berlin', value: 'ber' },
{ label: 'Sofia', value: 'sof', disabled: true },
];
city: string | null = null;
}Install
npx ply-ui-cli add listbox
Value: none
<ply-listbox [options]="cities" [(ngModel)]="many" multiple aria-label="Cities"></ply-listbox>
TypeScript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
// Install: npx ply-ui-cli add listbox
// Paths are relative to aliases.components (default: src/app/components)
import { ListboxComponent, ListboxOption } from './listbox/listbox.component';
@Component({
selector: 'app-listbox-example',
imports: [
ListboxComponent,
FormsModule
],
template: `...`
})
export class ListboxExampleComponent {
readonly cities: ListboxOption[] = [
{ label: 'Lisbon', value: 'lis' },
{ label: 'Berlin', value: 'ber' },
{ label: 'Sofia', value: 'sof', disabled: true },
];
many: string[] = [];
}Install
npx ply-ui-cli add listbox
npx ply-ui-cli add listbox
For AI agents
Copy a prompt with the registry name, CLI install, and import — or add the Ply MCP server.
npx -y ply-ui-mcp
Ply provides standalone components. Import the exact elements you want to use into your component.
// Install: npx ply-ui-cli add listbox
// Paths are relative to aliases.components (default: src/app/components)
import { ListboxComponent, ListboxOption } from './listbox/listbox.component';
@Component({
selector: 'app-your-component',
imports: [
ListboxComponent
],
template: `...`
})
export class YourComponent {} API for listbox — generated from JSDoc in the library source.
| API | Member | Type | Default | Description |
|---|---|---|---|---|
ListboxOption | label | string | — | — |
ListboxOption | value | string | — | — |
ListboxOption | disabled | boolean | — | — |
ply-listbox | class | string | '' | Extra host classes merged via `cn()`. |
ply-listbox | options | ListboxOption[] | [] | Options. `value` is what the form stores. |
ply-listbox | multiple | boolean | false | When true, the value is a `string[]` and rows toggle. |
ply-listbox | aria-label | unknown | 'List' | Accessible name for the list. |
ply-listbox | emptyMessage | string | '' | Replaces the empty copy. |
Content