Field
Label + description + error layout.
Import
tsx
import { Field } from "@cooud-ui/ui";
bash
npx cooud-ui add field
Label + description + error layout.
import { Field } from "@cooud-ui/ui";
npx cooud-ui add field
On this page
Compose FieldLabel, FieldDescription, and an Input inside a Field.
Used in your workspace URL. Letters, numbers, and dashes.
<Field><FieldLabel htmlFor="workspace">Workspace name</FieldLabel><Inputid="workspace"placeholder="acme-inc"aria-describedby="workspace-desc"/><FieldDescription id="workspace-desc">Used in your workspace URL. Letters, numbers, and dashes.</FieldDescription></Field>
A Field that surfaces an inline FieldError as the value changes.
function FieldErrorDemo() {const [username, setUsername] = useState("");const error = username.includes(" ") ? "Username can't contain spaces." : "";return (<Field><FieldLabel htmlFor="username">Username</FieldLabel><Inputid="username"value={username}invalid={!!error}placeholder="ada"aria-describedby={error ? "username-err" : undefined}onChange={(event) => setUsername(event.target.value)}/><FieldError id="username-err">{error}</FieldError></Field>);}