Form
Accessible form container with integrated validation state management and submission handling.
Examples
Basic Contact Form
A simple contact form with name, email, and message.
With Validation Indicators
Form with inline validation states and error messages.
Horizontal Layout
Label and input side by side in a two-column layout.
Inline Form
Compact inline form on a single row.
Installation
pnpm add @rokle/components @rokle/tokensInstalls with the default Rokle brand. Generate a custom brand on rokle.app to use your own colours and personality.
Usage
import { Form } from "@rokle/components";import { Form } from "@rokle/components";
export function Example() {
return <Form />;
}API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| onSubmit | (values: Record<string, unknown>) => void | - | Called with form values on valid submission. |
| defaultValues | Record<string, unknown> | {} | Initial field values. |
| children | ReactNode | - | Form field elements. |