Button: Forms
For submit buttons, call track() from useButtonFeedback in onSubmit and spread buttonProps on the button. Remove the @ to see the error.
This adds the example as components/examples/button/form.tsx, together with the Button component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/button-form.jsonTo add only the component, follow the Button installation.
Props in this example
The Button props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
successLabel | ReactNode | "Done" |
errorLabel | ReactNode | (error: unknown) => ReactNode | "Failed" |
Every prop is in the Button API reference.
- Variants
- Sizes
- Pill
- With icon
- Disabled
- Custom labels
- Smooth width
- Error details
- Icon buttons
- Feedback on every variant
- Controlled loading
- Controlled status
- As a link
- Right to left
See them all, with keyboard support and accessibility notes, on the Button page.
- SpinnerA loading indicator with Apple-style ticks or a breathing ring that can wait before showing and stay long enough not to flicker.
- useButtonFeedbackRuns an async action through loading, success and error, skipping the spinner for fast requests and holding an error while you read it.
- Button groupButtons joined into one control, with shared seams, separators, text addons, nesting and vertical stacks.
- ToggleA button that stays on or off, with a fill that settles in when pressed, a clear hover-to-on step and icons that can fill with the state.
- Toggle groupA row of toggles for one choice or many, with a fill that slides to the picked item, joined or spaced items and arrow-key focus.
- AlertInline messages for status and feedback, with a neutral surface, a colored icon and a dismiss that collapses smoothly.