ComponentsForms & inputs
Text input, multi-line textarea, and Field, which wraps them with a label, hint and error message.
components/input.tsxtheme · material · accent · density · font
Installation
$ pnpm add @vamos-cms/ui
The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-cms/ui/styles.css";
Usage
import { Field, Input } from "@vamos-cms/ui";
<Field label="Title" hint="Keep it under 60 characters.">
<Input placeholder="Post title" />
</Field>Examples
With Field
Field wires up id, aria-invalid and aria-describedby for you.
Keep it under 60 characters for search results.
This address is already registered.
Leading & trailing
Use leading / trailing for an icon, unit or button.
Textarea
Grows with its content via field-sizing: content.
Grows as you type.
Disabled
API
Input
| Prop | Type | Default |
|---|---|---|
leadingIcon or text at the start. | ReactNode | — |
trailingIcon, unit or button at the end. | ReactNode | — |
...propsAll native input attributes. | InputHTMLAttributes | — |
Field
| Prop | Type | Default |
|---|---|---|
labelLabel, linked to the control with htmlFor. | ReactNode | — |
hintHelper text. | ReactNode | — |
errorError text; also sets aria-invalid. | ReactNode | — |
requiredAdds * to the label. | boolean | — |
childrenA single control (Input, Textarea, Select…). | ReactElement | — |