Form
react-hook-form + zod integration.
Import
tsx
import { Form } from "@cronus-ui/ui";
bash
npx cronus-ui add form
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component FormDefault layout:inline style:form {
label "Email"
text "ada@cronus.dev"
}
page "/audit/form/default" type:custom {
use FormDefault
}
API Reference
Generated from the component's exported types.
FormProps
Extends ComponentPropsWithoutRef<typeof FormProvider>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
FormFieldProps
Extends ControllerProps<TFieldValues, TName>
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | — | Field path in the form values. |
control | Control<TFieldValues> | — | RHF control instance. |
render | (props) => ReactNode | — | Render-prop for the bound control. |
FormItemProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
FormLabelProps
Extends ComponentPropsWithoutRef<typeof Label>
| Prop | Type | Default | Description |
|---|---|---|---|
htmlFor | string | — | id of the labelled control. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
FormControlProps
Extends ComponentPropsWithoutRef<typeof Slot>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
FormDescriptionProps
Extends HTMLAttributes<HTMLParagraphElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
FormMessageProps
Extends HTMLAttributes<HTMLParagraphElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |