GitHubGitHub
← All components
Forms / component

Field

A stable label, description, error, and control composition for form inputs.

RequiredDescriptionError

Alert when the value exceeds this limit.

<Field label="Threshold">{#snippet children(id)}<input {id} />{/snippet}</Field>

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { Field } from '@chanrg/4ui';<Field label="Threshold">{#snippet children(id)}<input {id} />{/snippet}</Field>

API reference

Props

PropTypeDefaultDescription
labelstringrequiredVisible field label.
errorstring''Validation feedback.
controlIdstringgeneratedStable explicit association.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • Uses explicit label/control association.
  • Errors are announced with role=alert.

Dependencies

No runtime component dependencies.