nalarx-ui
Components

Field

A label, a control and one line under it for the hint or the error.

bunx shadcn@latest add @nalarx/field

Usage

children is a function: bind the id to the control so the label targets it, and describedBy to aria-describedby so the hint or error is read with it.

<Field label="Email" error={error}>
  {(id, describedBy) => <Input id={id} aria-describedby={describedBy} aria-invalid={!!error} />}
</Field>
Letters, numbers and dashes.
This value is not valid
Letters, numbers and dashes.
This value is not valid

Props

PropType
labelstringVisible label.
hintReactNodeShown under the control when there is no error.
errorstringReplaces the hint. Set aria-invalid on the control too.
children(id, describedBy) => ReactNodeRenders the control.

Replaces

The label and error of NxInput (web) and the Platform's base/Field.tsx.

On this page