Button: Error details
Pass a function to errorLabel to show the rejection reason. While the pointer or keyboard focus stays on the button, the error stays on screen.
This adds the example as components/examples/button/error-details.tsx, together with the Button component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/button-error-details.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 |
|---|---|---|
variant | "default" | "outline" | "secondary" | "ghost" | "ghost-destructive" | "destructive" | "link" | "default" |
feedbackTrack the promise returned from onClick and show its status. | boolean | false |
onClickReturn a promise to drive feedback. | (event) => unknown | – |
errorLabel | ReactNode | (error: unknown) => ReactNode | "Failed" |
Every prop is in the Button API reference.
- Variants
- Sizes
- Pill
- With icon
- Disabled
- Custom labels
- Smooth width
- Forms
- 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.