lara-light-indigo

MultiStateCheckbox

MultiStateCheckbox is used to select a state from given multiple states.

Import via Module

import { MultiStateCheckbox } from 'primereact/multistatecheckbox';
 
Import via CDN

<script src="https://unpkg.com/primereact/core/core.min.js"></script>
<script src="https://unpkg.com/primereact/multistatecheckbox/multistatecheckbox.min.js"></script>
 
Getting Started

MultiStateCheckbox is used as a controlled input with value, options and onChange properties. The optionValue field refers to the value of each option.


const [value, setValue] = useState('public');
const options = [
    { value: 'public', icon: 'pi pi-globe' },
    { value: 'protected', icon: 'pi pi-lock-open' },
    { value: 'private', icon: 'pi pi-lock' }
];
 

<MultiStateCheckbox value={value} options={options} onChange={(e) => setValue(e.value)} optionValue="value" />
 
Icons

Icon of each option is defined with the icon property of an option object. For templating use iconTemplate to render custom content inside the checkbox.

Option
NameTypeDefaultDescription
iconstringnullThe icon of the option. This is optional. The iconTemplate property can be used instead.
styleobjectnullInline style of the checkbox element when the option is selected.
classNamestringnullStyle class of the checkbox element when the option is selected.
Properties

Any valid attribute is passed to the root element implicitly, extended properties are as follows;

NameTypeDefaultDescription
idstringnullUnique identifier of the element.
valueanynullValue of the MultiStateCheckbox.
optionsarraynullAn array to display as the available options.
optionValuestringnullProperty name to use as the value of an option, defaults to the option itself when not defined.
optionLabelstringnullProperty name to refer to the option label, used by screen readers only. Defaults to optionValue.
iconTemplateanynullTemplate of icon for the selected option.
dataKeystringnullA property to uniquely match the value in options for better performance.
stylestringnullInline style of the element.
classNamestringnullStyle class of the element.
disabledbooleanfalseWhen present, it specifies that the element value cannot be altered.
readOnlybooleanfalseWhen present, it specifies that the value cannot be changed.
tabIndexnumbernullIndex of the element in tabbing order.
emptybooleantrueIf false, the empty state is skipped in the chekbox.
tooltipanynullContent of the tooltip.
tooltipOptionsobjectnullConfiguration of the tooltip, refer to the tooltip documentation for more information.
Events
NameParametersDescription
onChangeevent.originalEvent: Browser event
event.value: Current Value
Callback to invoke on value change
Styling

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
p-chkboxContainer element
p-multistatechkboxContainer element
p-chkbox-boxContainer of icon.
p-chkbox-iconIcon element.
Accessibility

This section is under development. After the necessary tests and improvements are made, it will be shared with the users as soon as possible.

Dependencies

None.

Component Scale

Input Style

Ripple Effect

Free Themes

Built-in component themes created by the PrimeReact Theme Designer.

Bootstrap
Blue
Purple
Blue
Purple
Material Design
Indigo
Deep Purple
Indigo
Deep Purple
Material Design Compact
Indigo
Deep Purple
Indigo
Deep Purple
Tailwind
Tailwind Light
Fluent UI
Blue
PrimeOne Design - 2022 NEW
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
PrimeOne Design - 2021
Saga Blue
Saga Green
Saga Orange
Saga Purple
Vela Blue
Vela Green
Vela Orange
Vela Purple
Arya Blue
Arya Green
Arya Orange
Arya Purple
Premium Themes

Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.

Soho Light
Soho Dark
Viva Light
Viva Dark
Mira
Nano

Legacy Free Themes

Nova
Nova Alt
Nova Accent
Luna Blue
Luna Green
Luna Amber
Luna Pink
Rhea

Premium Create-React-App Templates

Beautifully crafted premium create-react-app application templates by the PrimeTek design team.

Sakai
Atlantis
Freya
Ultima
Diamond
Sapphire
Serenity
Babylon
Avalon
Apollo
Roma