Components
Field
Wires a label, hint and error to one control.
Ombelle · light
Field
Shown in the CLI and the editor header.
Use lower case letters and dashes only.
Installation
Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.
pnpm dlx @ombelle-ui/cli@1.1.2 add fieldAdds components/ui/field.tsx and installs react, clsx, tailwind-merge, lucide-react with lifecycle scripts disabled. This is a client component.
In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.
Usage
example.tsx
import { Field, FieldLabel, FieldControl, FieldDescription, FieldError } from '@/components/ui/field'
import { Input } from '@/components/ui/input'
export function Example(){return <Field required><FieldLabel>Project name</FieldLabel><FieldControl><Input placeholder="acme-dashboard" /></FieldControl><FieldDescription>Shown in the CLI and the editor header.</FieldDescription><FieldError>Use lower case letters and dashes only.</FieldError></Field>}FieldControl wraps one control, such as Input, Textarea, Native Select or a Select trigger, and keeps its own styles.
API and states
- API
- Field (orientation, invalid, required, disabled), FieldLabel, FieldControl, FieldDescription, FieldError
- Minimum states
- Default, required, invalid, disabled, horizontal
- Native basis
- Native label and aria-describedby; Base UI uses its Field
- Styles
- Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.