Forms

Form field

@xui/form-field

The wrapper that gives a control its label, hint and error text, and wires the aria relationships between them so a screen reader announces the three together.

Install

pnpm add @xui/form-field

Add the barrel to a standalone component's imports:

import { XuiFormFieldImports } from '@xui/form-field';

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

Examples

Default

Loading preview…

With label

Loading preview…

Color

Loading preview…

Inline

Loading preview…

API

XuiError

componentxui-error

A validation message for the control in a xui-form-field.

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the component's own rather than replacing them.''

XuiFormField

componentxui-form-field

Wraps a control with its label, helper text and validation message, and wires the three together.

Variants

AxisOptionsDefaultinlinefalsetruefalsecolornoneprimarysuccesswarningerrornone

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the component's own rather than replacing them.''labelstringThe primary label rendered above (or beside, when inline) the control.''labelInfostringSecondary text shown next to the label, e.g. "(optional)".''subLabelstringA smaller description under the label.''helperTextstringMuted helper text under the control, hidden while an error is shown.''colorXuiFormFieldColorA deliberate accent for the label and helper text.this.config.colorinlinebooleanLay the label beside the control rather than above it.this.config.inline

XuiHint

componentxui-hint

Supporting text under the control in a xui-form-field.

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the component's own rather than replacing them.''

Source

libs/ui/form-field/xui

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