SelectButton is used to choose single or multiple items from a list using buttons.
SelectButton requires a value to bind and a collection of options.
SelectButton allows selecting only one item by default and setting multiple option enables choosing more than one item. In multiple case, model property should be an array.
For custom content support define an option template where the default slot props refer to an option.
SelectButton provides small and large sizes as alternatives to the base.
The fluid prop makes the component take up the full width of its container when set to true.
When disabled is present, the element cannot be edited and focused entirely. Certain options can also be disabled using the optionDisabled property.
The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with form validation libraries.
SelectButton integrates seamlessly with the PrimeVue Forms library.
The container element that wraps the buttons has a group role whereas each button element uses button role and aria-pressed is updated depending on selection state. Value to describe an option is automatically set using the ariaLabel property that refers to the label of an option so it is still suggested to define a label even the option display consists of presentational content like icons only.
| Key | Function |
|---|---|
| tab | Moves focus to the buttons. |
| space | Toggles the checked state of a button. |