Skip to content

A2ChoicePicker

Multi/single selection card component with chips style support.

Props

PropertyTypeDefaultDescription
labelstring-Label text
optionsarray[]Options list
variantdefault | mutuallyExclusivedefaultSelection mode
displayStyledefault | chipsdefaultDisplay style
requiredbooleanfalseRequired field
disabledbooleanfalseDisabled state
defaultValuearray | string | number[]Default value

Option Configuration

typescript
interface ChoiceOption {
  label: string       // Display text
  value: string | number  // Option value
  description?: string    // Description text (optional)
  disabled?: boolean     // Disabled (optional)
}

Selection Modes

Multi-select Mode (default)

Users can select multiple options.

Single-select Mode (mutuallyExclusive)

Users can only select one option. Clicking a new option automatically deselects the previous one.

Non-required single-select can deselect: When required is false, clicking the already selected option again will deselect it, allowing users to "clear selection".

Basic Example

Basic Multi-select
无内容

Single-select Example

Mutually Exclusive Single-select (Required)
无内容

Non-required Single-select (Can Deselect)

When single-select mode is set as non-required, users can click the already selected option again to deselect it.

Non-required Single-select (Click Selected to Deselect)
无内容

Options with Description

Options with Description
无内容

Required and Disabled States

Required and Disabled
无内容

JSON Schema

json
{
  "id": "pickerId",
  "component": "ChoicePicker",
  "label": "Select option",
  "variant": "mutuallyExclusive",
  "displayStyle": "chips",
  "required": true,
  "options": [
    { "label": "Option 1", "value": "opt1", "description": "Description 1" },
    { "label": "Option 2", "value": "opt2" },
    { "label": "Disabled option", "value": "opt3", "disabled": true }
  ],
  "value": { "path": "/form/choice" }
}

A2UI Documentation