Skip to content
Look

Shared with the landing page. Theme is the select beside this menu.

Field

Open .md
Live preview

Loading example…

Field is part of the Forms set, imported from @jcsoftdev/ui/forms.

import { Field } from "@jcsoftdev/ui/forms";

Single-component entry points tree-shake to just this component: @jcsoftdev/ui/forms/field.

<Field
label="Nombre del cliente"
hint="Como aparecerá en la agenda"
>
<Input placeholder="Ej. Marco Salazar" />
</Field>
Prop Type Default Description
label * ReactNode The label content: text or any node (an icon, a tooltip trigger).
hint string
error string | null Message under the control; null and undefined mean no error.
optional boolean Marks the field as optional by appending the localized marker to the label.
required boolean Marks the field as required: a visible * marker (hidden from assistive tech, which gets aria-required on the control instead). Native validation is not turned on.
disabled boolean Disables the control and mutes the label.
id string Id of the control the label and messages belong to. Generated when omitted.
controlId string Same as id, for fields with several children: the control carrying this id gets the description and invalid wiring and is what the label points at. Without it the first input, select, textarea or ARIA widget inside the field is used.
children * ReactNode One control element (a component, or input, select, textarea) receives id, aria-describedby and aria-invalid directly. Several children (or a fragment, a plain wrapper element, or text) are rendered as given and the first control is wired after mount.
classNames Partial<Record<FieldPart, string>> Per-part classes merged with cn; consumer classes win. className still targets the root and is merged last.

* marks a required prop.

It also accepts the native props of the element or primitive it renders (for example className, id, aria-* and event handlers).

packages/ui/src/forms/field/field.tsx