
Definitive guide to indeterminate state of a checkbox
Learn more about the indeterminate state of form element like checkbox, radio button, and progress bar and how your users can benefit from it.
In HTML, the indeterminate state is a special visual state for form elements like checkboxes, radio buttons, and progress bars. For checkboxes, this state represents a condition where the checkbox is neither checked nor unchecked – it’s a third visual state typically displayed as a horizontal line (dash) inside the checkbox instead of a checkmark.
Important: the indeterminate state cannot be triggered by user interaction (such as clicking, hovering, or partial clicks). It is only set programmatically via JavaScript and is purely visual – it doesn’t affect the checkbox’s submitted value.
Common use case
The indeterminate state is most commonly used in hierarchical checkbox lists (parent/child relationships) to indicate that some, but not all, child checkboxes are selected. For example:
- Parent checkbox: indeterminate state (dash) when some children are checked
- Parent checkbox: checked state when all children are checked
- Parent checkbox: unchecked state when no children are checked
See screenshot examples of visual representation of input type checkbox and indeterminate state:


You can also see a code example of a checkbox with a mixed-state.
Understanding the indeterminate property
The indeterminate property is a JavaScript property of the HTMLInputElement object. It has a boolean value (true or false) and is used to set or check the indeterminate state of a checkbox.
Key characteristics
- Visual only: the indeterminate state does not affect the checkbox’s
checkedproperty or its value when submitted. - Independent: modifying
indeterminatehas no effect onchecked, and vice versa. - No HTML attribute: there is no
indeterminateHTML attribute – this state can only be set via JavaScript.
CSS pseudo-class
The :indeterminate CSS pseudo-class targets:
<input type="checkbox">elements whoseindeterminateproperty istrue.<input type="radio">elements when all radio buttons with the same name are unchecked.<progress>elements in an indeterminate state.
Practical use case: parent-child checkbox pattern
The indeterminate state is most useful when managing a group of checkboxes where you want to indicate the selection status of sub-options.
See visual example:
Indeterminate vs. mixed state: clarifying the terminology
Throughout this article, indeterminate
and mixed state
are often used interchangeably, but they have specific meanings:
| Term | Context | Description |
|---|---|---|
| Indeterminate | Native HTML element | Visual state of a native <input type="checkbox"> set via the indeterminate JavaScript property |
| Mixed | ARIA attribute | ARIA state value (aria-checked="mixed") used on elements with role="checkbox" or role="menuitemcheckbox" |
Both represent the same concept – a third state that is neither checked nor unchecked – but they have different implementation requirements and accessibility implications.
Detecting the indeterminate state
There is no HTML attribute for indeterminate and the only way to detect this state is using JavaScript:
const checkbox = document.querySelector('#myCheckbox');
if (checkbox.indeterminate) {
// The indeterminate state is true
console.log('Checkbox is in indeterminate state');
} else {
console.log('Checkbox is not in indeterminate state');
}How to change the indeterminate state
Use the indeterminate property on the HTMLInputElement object:
Setting indeterminate state
const checkbox = document.querySelector('#myCheckbox');
// Set indeterminate state
checkbox.indeterminate = true;
// Clear indeterminate state
checkbox.indeterminate = false;Important notes
- The
indeterminateproperty has no effect on thecheckedproperty. - Setting
indeterminatetotruedoesn’t change the checkbox’s value when submitted. - Always set
indeterminateafter settingcheckedif both properties need to be configured.
Example with parent-child logic
// Parent checkbox that controls child checkboxes
const parentCheckbox = document.querySelector('#parent');
const childCheckboxes = document.querySelectorAll('.child');
function updateParentState() {
const checkedCount = document.querySelectorAll('.child:checked').length;
const totalChildren = childCheckboxes.length;
if (checkedCount === 0) {
parentCheckbox.checked = false;
parentCheckbox.indeterminate = false;
} else if (checkedCount === totalChildren) {
parentCheckbox.checked = true;
parentCheckbox.indeterminate = false;
} else {
parentCheckbox.indeterminate = true;
parentCheckbox.checked = false; // Visual state is indeterminate
}
}
// Listen for changes on child checkboxes
childCheckboxes.forEach(checkbox => {
checkbox.addEventListener('change', updateParentState);
});Browser support
The :indeterminate CSS pseudo-class is widely supported across modern browsers. Check caniuse.com for detailed compatibility information.
However, visual representation of the indeterminate state can vary significantly across browsers:
| Browser | Visual Appearance |
|---|---|
| Chrome 118+ | Horizontal dash (—) |
| Firefox 118+ | Horizontal dash or filled square |
| Safari 15.4+ | Horizontal dash (—) |
| Edge 118+ | Horizontal dash (—) |
Note: always test your implementation across target browsers to ensure consistent visual appearance.
Complete working example
Below is a complete example demonstrating the indeterminate state with parent-child checkbox relationships:
Resetting a checkbox to its initial state
When resetting a form, the indeterminate state is not automatically reset. You need to store the original state and restore it manually:
Example: manual reset
// Store initial state
const checkbox = document.querySelector('#myCheckbox');
const initialIndeterminate = checkbox.indeterminate;
// On form reset
function resetForm() {
// Reset other form fields...
// Restore indeterminate state
checkbox.indeterminate = initialIndeterminate;
}Accessibility support for indeterminate state
Live code examples
Testing aria-checked="mixed" on a native checkbox:
Testing aria-checked="mixed" on a faux checkbox:–
Testing indeterminate property on a native checkbox:
Screen reader compatibility
The table below shows how different screen reader/browser combinations expose the indeterminate/mixed state to assistive technologies. Pass
means the state is correctly announced to users, while Not exposed means users may not receive this information – this is an important consideration for accessibility.
| Safari (macOS) / VO | Chrome / JAWS (2020) | Chrome / NVDA | IE 11 / JAWS (2020) | Firefox / NVDA | Safari (iOS) / VO | Chrome / Talkback | |
|---|---|---|---|---|---|---|---|
Native checkbox with aria-checked="mixed" | Not exposed to API | Exposed, announced ✓ | Exposed, announced ✓ | Not exposed to API | Not exposed to API | Not exposed to API | Not exposed to API |
Faux checkbox with aria-checked="mixed" | Exposed, announced ✓ | Exposed, announced ✓ | Exposed, announced ✓ | Exposed, announced ✓ | Exposed, announced ✓ | Not exposed to API | |
| Native checkbox with indeterminate state | Not exposed to API | Exposed, announced ✓ | Exposed, announced ✓ | Not exposed to API | Exposed, announced ✓ | Not exposed to API | Not exposed to API |
Accessibility best practices
- Always provide visual indicators for sighted users (the dash/horizontal line).
- Use ARIA labels (
aria-labeloraria-labelledby) for additional context. - Test with screen readers in your target browsers.
- Consider using
aria-checked="mixed"on faux checkboxes for better screen reader support (as shown in the table above). - Ensure keyboard accessibility (tabindex, Space/Enter key handling).
Common pitfalls and best practices
Pitfalls to avoid
- Assuming indeterminate affects form submission. The
indeterminateproperty is visual only and it doesn’t affect the checkbox’scheckedstate or submitted value. - Relying on user interaction to set indeterminate. Users cannot set indeterminate state through clicks or keyboard interaction. It must be set via JavaScript.
- Forgetting to handle indeterminate in form resets. The indeterminate state persists through form resets and must be managed manually.
- Using only visual indicators for accessibility. Sighted users see the dash, but screen reader users may not hear the mixed state depending on browser/AT combination.
Best practices and recommendations
- Always pair visual state with proper ARIA attributes when creating custom checkbox components.
- Test the indeterminate state with screen readers (NVDA, JAWS, VoiceOver (macOS).
- Provide keyboard support for custom checkbox implementations.
- Document the indeterminate state behavior for other developers working on the codebase.
- Use parent-child checkbox patterns where the indeterminate state adds clear value.

Comments