Skip to content
API reference

components/field

Import
import * as api from "@fungi.computer/caps/components/field";
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”
Signature
type FormFooterProps = object & HTMLAttributes<HTMLElement>;

Props accepted by FormFooter.

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”
Signature
type FormProps = object & FormHTMLAttributes<HTMLFormElement>;

Props accepted by Form.

Name Type Description
busy? boolean Disables every control while a submission is in flight.

FormSectionPropstype alias

Section titled “FormSectionProps”
Signature
type FormSectionProps = object & Omit<HTMLAttributes<HTMLElement>, "title">;

Props accepted by FormSection.

Name Type Description
title ReactNode -
description? ReactNode -
level? 2 | 3 | 4 Heading level inside the page outline.
children ReactNode -

FieldSetPropstype alias

Section titled “FieldSetProps”
Signature
type FieldSetProps = object & FieldsetHTMLAttributes<HTMLFieldSetElement>;

Props accepted by FieldSet.

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”
Signature
type FieldProps = object & HTMLAttributes<HTMLDivElement>;

Props accepted by Field.

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”
Signature
type NumberFieldProps = object &
Omit<
InputHTMLAttributes<HTMLInputElement>,
"defaultValue" | "max" | "min" | "onChange" | "step" | "type" | "value"
>;

Props accepted by NumberField.

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”
Signature
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”
Signature
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”
Signature
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”
Signature
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”
Signature
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()”
Signature
function FieldError(__namedParameters): Element;

An announced error that takes no space when absent and collapses smoothly.

Parameter Type
__namedParameters HTMLAttributes<HTMLDivElement>

Element


FormFooter()function

Section titled “FormFooter()”
Signature
function FormFooter(__namedParameters): Element;

A form’s stationary action area. Put exactly one primary Button last; every other action is ghost or outline.

Parameter Type
__namedParameters FormFooterProps

Element