Skip to content
navius

Checkbox

A control that toggles between checked, unchecked, and indeterminate states.

Features

  • Full keyboard navigation.
  • Supports an indeterminate state (@bind-CheckedState with bool?).
  • Can be controlled (@bind-Checked) or uncontrolled (DefaultChecked).
  • Renders a hidden input so it participates in native form submission.
  • role="checkbox" with the correct aria-checked state (including "mixed").

Installation

Reference the Navius.Primitives package for the headless primitive, or vendor a styled version with the CLI: navius add copies the styled zits/ui component plus the brain files it depends on.

Anatomy

Import the parts and assemble them.

API Reference

Contains all the parts of a checkbox. Renders a button.

Prop Type Default
Checked bool false
CheckedChanged EventCallback<bool> -
DefaultChecked bool false
CheckedState bool? -
CheckedStateChanged EventCallback<bool?> -
DefaultCheckedState bool? -
Disabled bool false
Required bool false
Name string? -
Value string "on"
ChildContent RenderFragment? -
Data attribute Values
[data-checked] Present when checked
[data-unchecked] Present when unchecked
[data-indeterminate] Present when indeterminate
[data-disabled] Present when disabled

Renders when the checkbox is in a checked or indeterminate state. Renders a span.

Prop Type Default
KeepMounted bool false
ChildContent RenderFragment? -
Data attribute Values
[data-checked] Present when checked
[data-unchecked] Present when unchecked
[data-indeterminate] Present when indeterminate
[data-disabled] Present when disabled

Accessibility

Implements the roles, states, and keyboard map of the tri-state checkbox WAI-ARIA APG pattern. Behavior is covered by the browser test suite and an axe-core WCAG gate in CI.

Key Description
Space Toggles the component's state.