Forms

Checkbox

@xui/checkbox

A tri-state checkbox. It is a ControlValueAccessor, so ngModel and reactive forms bind straight to it, and indeterminate renders the mixed state a parent checkbox needs.

Install

pnpm add @xui/checkbox

Add the barrel to a standalone component's imports:

import { XuiCheckboxImports } from '@xui/checkbox';

@Component({
  imports: [XuiCheckboxImports],
  // …
})

Examples

Default

Loading preview…

With label

Loading preview…

Layout

Loading preview…

Colors

Loading preview…

API

XuiCheckbox

componentxui-checkbox

A checkbox with its label, wired for forms.

Variants

AxisOptionsDefaultcolorprimarysecondarysuccesserrorinfowarningprimaryinlinefalsetruefalsealignIndicatorstartendstartdisabledtruefalsefalse

Inputs

NameTypeDefaultclassClassValueClasses for the box itself, not the control as a whole — a width here reshapes the box rather than the row. The host is display: contents, so to size or space the whole control (which is what alignIndicator="end" needs something to push against) put the class on a wrapper.''colorXuiCheckboxVariants['color']Intent colour of the checked box.this.config.colorsizeXuiCheckboxVariants['size']Box size, from the shared control scale. large overrides the tick's own size.this.config.sizelabelstringA plain-text label rendered beside the box, as an alternative to projection.''alignIndicatorXuiCheckboxAlignIndicatorWhich side the box sits on relative to the label.'start'inlinebooleanLay the control out inline so several sit on one line, rather than stacked.falselargebooleanRender a larger box and label.falseidstring | nullUsed to set the id on the underlying xLabel element.nullariaLabelstring | nullUsed to set the aria-label attribute on the underlying xLabel element.nullariaLabelledbystring | nullUsed to set the aria-labelledby attribute on the underlying xLabel element.nullariaDescribedbystring | nullUsed to set the aria-describedby attribute on the underlying xLabel element.nullcheckedtwo-waybooleanThe checked state of the checkbox. Two-way bindable; emits checkedChange.falseindeterminatetwo-waybooleanThe indeterminate state of the checkbox. For example, a "select all/deselect all" checkbox may be in the indeterminate state when some but not all of its sub-controls are checked.falsenamestring | nullThe name attribute of the checkbox.nullrequiredbooleanWhether the checkbox is required.falsedisabledbooleanWhether the checkbox is disabled.false

Source

libs/ui/checkbox/xui

xUI 2.0.0 — Apache 2.0 licensed. Built with Angular and Tailwind CSS.