TriStateCheckbox

TriStateCheckbox is used to select either true, false or null as the value.


import TriStateCheckbox from 'primevue/tristatecheckbox';

A model can be bound using the standard v-model directive.

Not Selected

<TriStateCheckbox v-model="value" />

Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.

Not Selected

<TriStateCheckbox v-model="value" variant="filled" />

Invalid state is displayed using the invalid prop to indicate a failed validation. You can use this style when integrating with form validation libraries.

Not Selected

<TriStateCheckbox v-model="value" invalid />

When disabled is present, the element cannot be edited and focused.

Not Selected

<TriStateCheckbox v-model="value" />

Screen Reader

TriStateCheckbox component uses an element with checkbox role. Value to describe the component can either be provided with aria-labelledby or aria-label props. Component adds an element with aria-live attribute that is only visible to screen readers to read the value displayed. Values to read are defined with the trueLabel, falseLabel and nullLabel keys of the aria property from the locale API. This is an example of a custom accessibility implementation as there is no one to one mapping between the component design and the WCAG specification.


<span id="chkbox1">Remember Me</span>
<TriStateCheckbox aria-labelledby="chkbox1" />

<TriStateCheckbox aria-label="Remember Me" />

Keyboard Support

KeyFunction
tabMoves focus to the checkbox.
spaceToggles between the values.
enterToggles between the values.