Getting StartedInstall and bootstrap headless foundations 4
LayoutHeadless structural primitives for expandable and container patterns 6
OverlayHeadless modal and floating layer behavior 3
FeedbackHeadless notification and status communication patterns 5
FormHeadless input and selection contracts 17
UtilityReusable action, identity, and clipboard behavior 6
NavigationHeadless trails, trees, menus, and command surfaces 7

Headless checkbox

Headless checkbox keeps the native <input type="checkbox"> element in place and adds a consistent state contract for checked, mixed, readonly, invalid, and keyboard-focus styling.

  • Binary and tri-state behavior with checked and indeterminate.
  • Readonly support that keeps the control focusable while reverting user toggles.
  • Stable data-* hooks for custom visuals without wrapper lock-in.

Installation

Import only the checkbox primitive when your app already owns the surrounding markup.

Primitive import

ts
import { TngCheckbox } from '@tailng-ui/primitives';

Basic usage

The directive can live on a bare input, but in practice you usually wrap it in a <label> so the text stays clickable and supplies the accessible name.

Minimal attachment

html
<input tngCheckbox />

Recommended labeled pattern

html
<label class="headless-checkbox-row">
  <input tngCheckbox [checked]="true" />
  <span>Email release updates</span>
</label>

Tri-state example

html
<label class="headless-checkbox-row">
  <input
    tngCheckbox
    [indeterminate]="true"
    [ariaDescribedBy]="'selection-help'"
  />
  <span>Deployment checklist (mixed)</span>
</label>
<p id="selection-help">One or more child checks are still pending.</p>

Style variants

Same headless checkbox behavior rendered inside a plain CSS shell and a Tailwind utility shell.

Headless checkbox stack (Plain-CSS)

Accessibility baseline

  • aria-checked resolves to true, false, or mixed.
  • readonly keeps the native checkbox in the tab order.
  • data-focus-visible makes keyboard-only focus styling straightforward.