API reference
<tng-checkbox> is built on the tngCheckbox primitive. Most component consumers do not need to attach the directive directly, but it helps to know what the wrapper is forwarding under the hood.
Underlying primitive: tngCheckbox
The wrapper forwards checked, indeterminate, disabled, readonly, required, invalid, name, value, and ariaDescribedBy to a native input[type="checkbox"] that owns ARIA and state attributes.
Primitive attachment
<input tngCheckbox [checked]="true" [indeterminate]="false" />
| Forwarded primitive surface | Notes |
|---|---|
checked, indeterminate | Drive binary and mixed state on the native checkbox control. |
disabled, readonly, required | Preserve native form semantics while controlling interaction. |
invalid | Feeds error emphasis and aria-invalid through the primitive. |
name, value | Support native form submission without extra wrapper logic. |
ariaDescribedBy | Connect helper or error copy to the internal input element. |
If you need direct access to primitive state hooks such as data-state or want to render a custom checkbox box, move to Headless > Form > Checkbox.
tng-checkbox (styled component)
The component wraps the primitive in a ready-to-ship label layout, exposes Angular outputs, and implements ControlValueAccessor for form bindings.
Component attachment
<tng-checkbox [checked]="releaseReady" (checkedChange)="releaseReady = $event">
Release checklist complete
</tng-checkbox>
| Input | Type | Default | Details |
|---|---|---|---|
checked | boolean | false | Committed checked state when the component is used in controlled mode. |
indeterminate | boolean | false | Mixed presentation for parent checklist or partial-completion states. |
disabled, readonly, required | boolean | false | Forwarded to the primitive input and reflected in the rendered behavior. |
invalid | boolean | false | Highlights a mandatory or failed checkbox state. |
name | string | null | null | Native form submission name for checkbox groups or standalone forms. |
value | string | 'on' | Submitted checkbox value when the control is checked. |
ariaDescribedBy | string | null | null | Associates helper text or validation copy with the internal input. |
| Surface | Type | Notes |
|---|---|---|
checkedChange | EventEmitter<boolean> | Emits the committed checked state after a user interaction. |
indeterminateChange | EventEmitter<boolean> | Emits whether the control is still mixed after the user interaction. |
| Projected label content | <ng-content> | Provides the visible checkbox label and accessible name. |
| Forms model | boolean | 'mixed' | ControlValueAccessor lets tri-state flow through reactive or template-driven forms. |
Reactive forms
import { Component } from '@angular/core';
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { TngCheckboxComponent } from '@tailng-ui/components';
@Component({
selector: 'app-release-checklist',
standalone: true,
imports: [ReactiveFormsModule, TngCheckboxComponent],
templateUrl: './release-checklist.component.html',
})
export class ReleaseChecklistComponent {
readonly form = new FormGroup({
releaseReady: new FormControl<boolean | 'mixed'>(false, { nonNullable: true }),
});
}
<form [formGroup]="form">
<tng-checkbox formControlName="releaseReady">
Release checklist complete
</tng-checkbox>
</form>
Angular Signal Forms can bind the component directly with [formField]. The tri-state value still flows as boolean | 'mixed'.
Signal forms
import { Component, signal } from '@angular/core';
import { FormField, form } from '@angular/forms/signals';
import { TngCheckboxComponent } from '@tailng-ui/components';
@Component({
selector: 'app-release-checklist-signal-form',
standalone: true,
imports: [FormField, TngCheckboxComponent],
template: \`
<tng-checkbox [formField]="releaseForm.releaseReady">
Release checklist complete
</tng-checkbox>
\`,
})
export class ReleaseChecklistSignalFormComponent {
readonly releaseModel = signal<{ releaseReady: boolean | 'mixed' }>({
releaseReady: false,
});
readonly releaseForm = form(this.releaseModel);
}