Forms

Label

@xui/label

The text label for a bare form control. Wrapping the control in <label xuiLabel> associates the two natively — clicking the text focuses the control, and assistive technology reads them together. For a control that also needs helper text or an error slot, reach for xui-form-field instead.

Install

pnpm add @xui/label

Add the barrel to a standalone component's imports:

import { XuiLabelImports } from '@xui/label';

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

Examples

Default

Loading preview…

Error state

Loading preview…

Disabled

Loading preview…

API

XuiLabel

directive[xuiLabel]

Styles a <label> and keeps it in step with the control it names.

Variants

AxisOptionsDefaultvariantdefaultdefaulterrorautotrueautodisabledautotruefalse

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the directive's own rather than replacing them.''variantXuiLabelVariants['variant']Reserved for future label styles; default is currently the only one.'default'errorXuiLabelVariants['error']Whether to render the error appearance. auto (the default) follows the wrapped control's ng-invalid.ng-touched state; true forces it on for a control the label cannot see.'auto'

Methods

setError(error: XuiLabelVariants['error']): void

Source

libs/ui/label/xui

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