Dialog: Form
Keep the form in <DialogBody /> and point the submit button in the footer at it with form. Enter submits, and the dialog closes through onOpenChange once the value is saved.
Workspace: Acme
This adds the example as components/examples/dialog/form.tsx, together with the Dialog component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/dialog-form.jsonTo add only the component, follow the Dialog installation.
Props in this example
The Dialog props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
open | boolean | – |
onOpenChange | (open: boolean, details) => void | – |
| Prop | Type | Default |
|---|---|---|
render | ReactElement | (props, state) => ReactElement | <button> |
| Prop | Type | Default |
|---|---|---|
size | "sm" | "default" | "lg" | "default" |
| Prop | Type | Default |
|---|---|---|
render | ReactElement | (props, state) => ReactElement | <button> |
Every prop is in the Dialog API reference.
- Custom close button
- No close button
- Sizes
- Sticky footer
- Scrollable content
- Controlled
- Nested
- Detached triggers
- Right to left
See them all, with keyboard support and accessibility notes, on the Dialog page.
- ButtonButtons in every variant and size, with a built-in loading, success and error flow that skips the spinner for fast requests.
- SheetA panel that slides in from any edge, with swipe-to-dismiss, scroll lock and stacked nesting.
- Alert dialogA confirmation dialog for destructive or important actions that waits for async work, and becomes a bottom sheet on phones.
- CommandA searchable list of actions, inline or as a ⌘K palette, with pages, shortcuts and highlighted matches.
- Context menuA menu of actions on right click or long press, with submenus, checkbox and radio items, and hold feedback on touch.
- DrawerA panel that slides in from any edge and follows your finger, with snap points, a working handle and nested drawers that stack.