Skip to Content
Documentation
Saas UI
Get Pro
Getting started
Components
Overview

Field

Used to add labels, help text, and error messages to form fields.

SourceStorybookRecipeArk

Anatomy

import { Field } from '@saas-ui/react/field'
<Field.Root>
  <Field.Label />
  <Field.Control />
  <Field.HelperText />
  <Field.ErrorText />
</Field.Root>

Examples

Helper Text

Use the helperText prop to add helper text to the field.

This is a helper text

Error Text

Use the invalid and errorText to indicate that the field is invalid.

This is an error text

Disabled

Use the disabled prop to disable the field.

Textarea

Here's how to use the field component with a textarea.

Native Select

Here's how to use the field component with a native select.

Props

Root

PropDefaultType
colorPalette 'gray'
'gray' | 'zinc' | 'neutral' | 'stone' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'presence' | 'status' | 'sidebar' | 'sidebar.accent' | 'accent' | 'slate'

The color palette of the component

orientation 'vertical'
'vertical' | 'horizontal'

The orientation of the component

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.
disabled
boolean

Indicates whether the field is disabled.

ids
ElementIds

The ids of the field parts.

invalid
boolean

Indicates whether the field is invalid.

readOnly
boolean

Indicates whether the field is read-only.

required
boolean

Indicates whether the field is required.

as
React.ElementType

The underlying element to render.

unstyled
boolean

Whether to remove the component's style.

Previous

Empty State

Next

File Upload