Checkbox

A control that allows the user to toggle between checked and not checked.

By clicking this checkbox, you agree to the terms and conditions.

Installation

npx nx g @spartan-ng/cli:ui checkbox

Usage

import { HlmCheckbox } from '@spartan-ng/helm/checkbox';
<hlm-checkbox />

Brain API

BrnCheckbox

Selector: brn-checkbox

Inputs

PropTypeDefaultDescription
id string | null uniqueIdCounter++ + Unique identifier for checkbox component. When provided, inner button gets ID without '-checkbox' suffix. Auto-generates ID if not provided.
name string | null null Form control name for checkbox. When provided, inner button gets name without '-checkbox' suffix.
class string | null null CSS classes applied to inner button element.
aria-label string | null null Accessibility label for screen readers. Use when no visible label exists.
aria-labelledby string | null null ID of element that labels this checkbox for accessibility. Auto-set when checkbox is inside label element.
aria-describedby string | null null ID of element that describes this checkbox for accessibility.
required boolean false Whether checkbox is required in a form.
disabled boolean false Whether checkbox is disabled. Disabled checkboxes cannot be toggled and indicate disabled state through data-disabled attribute.
checked BrnCheckboxValue false Current checked state of checkbox. Can be boolean (true/false) or 'indeterminate'. Can be bound with [(checked)] for two-way binding.

Outputs

PropTypeDefaultDescription
changed BrnCheckboxValue - Event emitted when checkbox value changes. Emits new checked state (true/false/'indeterminate').
touched void - Event emitted when checkbox is blurred (loses focus). Used for form validation.
checkedChanged BrnCheckboxValue false Current checked state of checkbox. Can be boolean (true/false) or 'indeterminate'. Can be bound with [(checked)] for two-way binding.

Helm API

HlmCheckbox

Selector: hlm-checkbox

Inputs

PropTypeDefaultDescription
class ClassValue --
id string | null null Used to set the id on the underlying brn element.
aria-label string | null null Used to set the aria-label attribute on the underlying brn element.
aria-labelledby string | null null Used to set the aria-labelledby attribute on the underlying brn element.
aria-describedby string | null null Used to set the aria-describedby attribute on the underlying brn element.
name string | null null The name attribute of the checkbox.
required boolean false Whether the checkbox is required.
disabled boolean false Whether the checkbox is disabled.
checked CheckboxValue false The checked state of the checkbox.

Outputs

PropTypeDefaultDescription
changed boolean --
checkedChanged CheckboxValue false The checked state of the checkbox.
Collapsible Carousel