Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.36 KB

File metadata and controls

43 lines (32 loc) · 1.36 KB
title Field
parent Controls and forms
grand_parent Components

Field

{: .no_toc }

A label, a control, a hint and whatever error the form has for it.

import { Field, TextInput } from '@textui/widgets';

<Field name="email" label="Email" hint="We only use this for alerts" required>
  <TextInput value="" onChange={() => {}} />
</Field>

Props

Prop Type Default
name string required
label string
hint string
required boolean
labelWidth number Cells reserved for the label, so a column of fields lines up.
stacked boolean Label above the control rather than beside it.

Plus everything on BoxProps.

name is how it finds its error in the surrounding Form, so it must match the key in initialValues. Outside a form a field is just a labelled row, which is fine.

labelWidth aligns labels across fields that are not siblings. stacked puts the label above the control instead of beside it, which is what a narrow terminal wants.

See also