Field
Combine labels, controls, and help text to compose accessible form fields. Responsive fields put the label beside the control when the field itself is at least 480vp wide — no breakpoints.
Usage
Approximate web preview — the HarmonyOS rendering is the reference.
Responsive
Resize the window (or narrow the demo) — the field measures its own width.
Approximate web preview — the HarmonyOS rendering is the reference.
Horizontal
Checkbox, switch and label in a row.
Approximate web preview — the HarmonyOS rendering is the reference.
API
Extracted from the @Param / @Event / @BuilderParam declarations in the library sources.
SField
shadcn-vue Field: a label, control, description and error laid out together.
vertical: stacked (flex-col gap-3).horizontal: in a row (flex-row items-center gap-3); SFieldLabel / SFieldContent / text controls share the free width.responsive(default): measures its own width — beside each other from 480vp, stacked below (the container-query equivalent of shadcn's@md/field-group:flex-row).
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | FieldOrientationFieldOrientation = 'vertical' | 'horizontal' | 'responsive' | 'responsive' | |
invalid | boolean | false | Error look: SFieldLabel turns destructive, SInput / STextarea show the invalid border. |
disabled | boolean | false | Disabled look for the label (opacity 50%). |
Slots: children (trailing closure)
SFieldLabel
Label of a field. Turns destructive when the field is invalid; fills the free width in horizontal fields.
| Prop | Type | Default | Description |
|---|---|---|---|
text | ResourceStr | '' | |
required | boolean | false |
SFieldContent
Groups a label and description next to a control (flex flex-1 flex-col gap-1.5).
Slots: children (trailing closure)
SFieldDescription
Helper text (text-muted-foreground text-sm).
| Prop | Type | Default | Description |
|---|---|---|---|
text | ResourceStr | '' |
SFieldError
Validation message (text-destructive text-sm). Renders nothing while text is empty.
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | '' |
SFieldGroup
Stack of fields (flex w-full flex-col gap-7).
Slots: children (trailing closure)
SFieldSet
Semantic group of fields with an optional SFieldLegend (flex flex-col gap-6).
Slots: children (trailing closure)
SFieldLegend
Title of an SFieldSet: legend = text-base font-medium, label = text-sm font-medium.
| Prop | Type | Default | Description |
|---|---|---|---|
text | ResourceStr | '' | |
variant | FieldLegendVariantFieldLegendVariant = 'legend' | 'label' | 'legend' |
SFieldSeparator
Horizontal rule between field groups.
No props.