Field
Names a control and ties its description and error to it.
Examples
Where we send the receipt.
Booking times show in this zone.
Copies go to ana.lima@example.com.
Kept on this device only.
Variants
Variant
Side
States
Set when the workspace was created.
Enter an address with a domain, such as ada@example.com.
Usage
Use it when
- A control has a visible name, and a description or an error now or later: a Field.
- A form has more than one field, so each one's wiring must not drift from the others: a Field each.
- A checkbox or a switch with only its words, such as a filter or a setting row: a plain Label around the control.
Use something else when
- The words introduce several controls, such as a group of switches. Use a
fieldsetwith alegendinstead, with a Label per control (rule/label-only-for-a-control). - The words are a caption, a key in a key-value row or a heading. Use Section instead, or plain text.
- The fields need to submit together. Use a
formaround the Fields with one submit Button instead of a Field around the form.
Rules
General
Content
Avoid
Limits
Install
npx shadcn@latest add https://kaanarici.com/r/cobalt/field.json https://kaanarici.com/r/cobalt/label.jsonimport { Field, FieldLabel, FieldControl, FieldDescription, FieldError } from "@/components/cobalt/ui/field"import { Label } from "@/components/cobalt/ui/label"