components/field
Import
Section titled “Import”import * as api from "@fungi.computer/caps/components/field";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | FormFooterProps | Props accepted by FormFooter. |
| type alias | FormProps | Props accepted by Form. |
| type alias | FormSectionProps | Props accepted by FormSection. |
| type alias | FieldSetProps | Props accepted by FieldSet. |
| type alias | FieldProps | Props accepted by Field. |
| type alias | NumberFieldProps | Props accepted by NumberField. |
| constant | Form | A form with Caps’ field rhythm. While busy, its fieldset disables every
control and the form reports aria-busy; validation stays with the caller. |
| constant | FormSection | A titled group of fields; consecutive sections share one quiet rule. |
| constant | FieldSet | A legend-named group of related choices, such as a list of inline checkbox
Fields. disabled disables every control inside. |
| constant | Field | A labelled form-field layout that renders caller-provided control and supporting content. |
| constant | NumberField | A number spinbutton: a native input type="number" between − and + keys, with
the value as a mono readout. Field wires its label, description and error to the
input. The caps-number-field-* parts are stable so a context such as a Screen
can redraw them; the semantics stay here. |
| function | FieldError() | An announced error that takes no space when absent and collapses smoothly. |
| function | FormFooter() | A form’s stationary action area. Put exactly one primary Button last; every
other action is ghost or outline. |
FormFooterPropstype alias
Section titled “FormFooterProps”type FormFooterProps = object & HTMLAttributes<HTMLElement>;Props accepted by FormFooter.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
error? |
ReactNode |
The submit-time error, announced above the actions. |
layout? |
"end" | "stretch" |
end right-aligns actions; stretch stacks full-width actions for single-column cards. |
status? |
ReactNode |
Quiet state opposite the actions (role=“status”), such as a Status LED reading “Saved”. |
divider? |
boolean |
Draws the rule above the footer; short inline forms leave it off. |
FormPropstype alias
Section titled “FormProps”type FormProps = object & FormHTMLAttributes<HTMLFormElement>;Props accepted by Form.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
busy? |
boolean |
Disables every control while a submission is in flight. |
FormSectionPropstype alias
Section titled “FormSectionProps”type FormSectionProps = object & Omit<HTMLAttributes<HTMLElement>, "title">;Props accepted by FormSection.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
title |
ReactNode |
- |
description? |
ReactNode |
- |
level? |
2 | 3 | 4 |
Heading level inside the page outline. |
children |
ReactNode |
- |
FieldSetPropstype alias
Section titled “FieldSetProps”type FieldSetProps = object & FieldsetHTMLAttributes<HTMLFieldSetElement>;Props accepted by FieldSet.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
legend |
ReactNode |
- |
description? |
ReactNode |
- |
error? |
ReactNode |
The group’s announced error, such as “Choose at least one right”. |
children |
ReactNode |
- |
FieldPropstype alias
Section titled “FieldProps”type FieldProps = object & HTMLAttributes<HTMLDivElement>;Props accepted by Field.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
children |
ReactNode |
- |
description? |
ReactNode |
- |
error? |
ReactNode |
- |
icon? |
ReactNode |
A decorative marker, such as a Sigil or App icon, before the label. It is hidden from assistive tech; the label stays the control’s name. |
label? |
ReactNode |
- |
orientation? |
"horizontal" | "inline" | "vertical" |
vertical stacks label, control and error; horizontal puts the control opposite its copy (settings rows); inline puts a checkbox or switch before its copy. |
optional? |
boolean |
Marks an optional field in a mostly required form. |
readout? |
boolean |
The child is a read-only readout, such as a Status, not a control: the label names the row and nothing is wired to the child. |
required? |
boolean |
- |
NumberFieldPropstype alias
Section titled “NumberFieldProps”type NumberFieldProps = object & Omit< InputHTMLAttributes<HTMLInputElement>, "defaultValue" | "max" | "min" | "onChange" | "step" | "type" | "value" >;Props accepted by NumberField.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
value? |
number | null |
Controlled value; null is empty. |
defaultValue? |
number | null |
- |
onValueChange()? |
(value) => void |
Called with each committed value, already clamped to min/max. |
min? |
number |
- |
max? |
number |
- |
step? |
number |
Arrow keys and the − / + keys move by step; Page Up/Down by ten steps. |
unit? |
ReactNode |
A short unit readout after the value, such as “min” or “GB”. |
wrap? |
boolean |
Cycle from max back to min (and back) instead of stopping at the ends. |
invalid? |
boolean |
- |
decrementLabel? |
string |
Accessible names for the − / + keys. |
incrementLabel? |
string |
- |
Formconstant
Section titled “Form”const Form: ForwardRefExoticComponent< object & FormHTMLAttributes<HTMLFormElement> & RefAttributes<HTMLFormElement>>;A form with Caps’ field rhythm. While busy, its fieldset disables every
control and the form reports aria-busy; validation stays with the caller.
FormSectionconstant
Section titled “FormSection”const FormSection: ForwardRefExoticComponent< object & Omit<HTMLAttributes<HTMLElement>, "title"> & RefAttributes<HTMLElement>>;A titled group of fields; consecutive sections share one quiet rule.
FieldSetconstant
Section titled “FieldSet”const FieldSet: ForwardRefExoticComponent< object & FieldsetHTMLAttributes<HTMLFieldSetElement> & RefAttributes<HTMLFieldSetElement>>;A legend-named group of related choices, such as a list of inline checkbox
Fields. disabled disables every control inside.
Fieldconstant
Section titled “Field”const Field: ForwardRefExoticComponent< object & HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>>;A labelled form-field layout that renders caller-provided control and supporting content.
NumberFieldconstant
Section titled “NumberField”const NumberField: ForwardRefExoticComponent< object & Omit< InputHTMLAttributes<HTMLInputElement>, "defaultValue" | "onChange" | "type" | "value" | "max" | "min" | "step" > & RefAttributes<HTMLInputElement>>;A number spinbutton: a native input type="number" between − and + keys, with
the value as a mono readout. Field wires its label, description and error to the
input. The caps-number-field-* parts are stable so a context such as a Screen
can redraw them; the semantics stay here.
FieldError()function
Section titled “FieldError()”function FieldError(__namedParameters): Element;An announced error that takes no space when absent and collapses smoothly.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
__namedParameters |
HTMLAttributes<HTMLDivElement> |
Returns
Section titled “Returns”Element
FormFooter()function
Section titled “FormFooter()”function FormFooter(__namedParameters): Element;A form’s stationary action area. Put exactly one primary Button last; every
other action is ghost or outline.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
__namedParameters |
FormFooterProps |
Returns
Section titled “Returns”Element