SelectButton

SelectButton is used to choose single or multiple items from a list using buttons.

import { SelectButtonModule } from 'primeng/selectbutton';

SelectButton requires a value to bind and a collection of options.

One-WayReturn

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.

Option 1Option 2Option 3

For custom content support define a template named item where the default local template variable refers to an option.

SelectButton provides small and large sizes as alternatives to the base.

BeginnerExpertBeginnerExpertBeginnerExpert

The fluid prop makes the component take up the full width of its container when set to true.

One-WayReturn

When disabled is present, the element cannot be edited and focused entirely. Certain options can also be disabled using the optionDisabled property.

OffOnOption 1Option 2

The invalid state is applied using the ⁠invalid property to indicate failed validation, which can be integrated with Angular Forms.

One-WayReturn
One-WayReturn

SelectButton can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.

One-WayReturn

Screen Reader

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.

Keyboard Support

KeyFunction
tabMoves focus to the buttons.
spaceToggles the checked state of a button.
Figma UI Kit
The official Figma UI Kit for Prime UI libraries, the essential resource for designing with PrimeOne components.