Button
A versatile button component with multiple variants, sizes, and states.
Basic Usage
Default Button
import { Button } from 'fluxo-ui';
<Button onClick={() => console.log('Clicked!')}>Click me</Button>Variants
All Button Variants
<Button variant="default">Default</Button>
<Button variant="primary">Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="success">Success</Button>
<Button variant="warning">Warning</Button>
<Button variant="danger">Danger</Button>
<Button variant="info">Info</Button>Sizes
All Button Sizes
<Button size="xs">Extra Small</Button>
<Button size="sm">Small</Button>
<Button size="md">Medium</Button>
<Button size="lg">Large</Button>
<Button size="xl">Extra Large</Button>Layouts
All Button Layouts
<Button layout="default" variant="primary">Default</Button>
<Button layout="outlined" variant="primary">Outlined</Button>
<Button layout="sharp" variant="primary">Sharp</Button>
<Button layout="rounded" variant="primary">Rounded</Button>
<Button layout="plain" variant="primary">Plain</Button>States
Button States
<Button>Normal</Button>
<Button disabled>Disabled</Button>
<Button isLoading={loading} onClick={handleAsyncAction}>
{loading ? 'Loading...' : 'Async Action'}
</Button>Full Width
Full Width Button
<Button fullWidth>Full Width Button</Button>With Icons
Buttons with Icons
<Button leftIcon={<PlusIcon />}>Left Icon</Button>
<Button rightIcon={<ArrowRightIcon />}>Right Icon</Button>
<Button leftIcon={<DownloadIcon />} variant="success">Download</Button>With Tooltip
Buttons with Tooltips
Use the tooltip prop to surface helper text on hover/focus without wrapping the button externally. Especially useful for icon-only buttons where a tooltip is mandatory for accessibility.
<Button leftIcon={<TrashIcon />} tooltip="Delete item" ariaLabel="Delete item" variant="danger" />
<Button leftIcon={<CogIcon />} tooltip="Open settings" ariaLabel="Settings" layout="plain" />
<Button tooltip="Saves your work to the cloud" variant="primary">Save</Button>Inline Confirmation
Inline Confirmation
Use confirmText to show a confirm popover before the click handler runs. The handler only runs after the user clicks the confirm action.
<Button
variant="danger"
confirmText="Are you sure you want to delete this item? This cannot be undone."
confirmTitle="Delete item"
confirmOkText="Delete"
onClick={() => deleteItem()}
>
Delete
</Button>Async Action Handling
Automatic Loading State for Async Actions
<Button onClick={async () => {
await fetch('/api/data');
}}>
Save Data
</Button>Countdown Timer
Button with Countdown (waitFor)
<Button waitFor={5} variant="warning">
Confirm Action
</Button>As Link
Button as Link
<Button href="https://example.com" variant="primary">
External Link
</Button>
<Button href="https://example.com" newTab variant="secondary">
Open in New Tab
</Button>Combination Examples
Variants with Different Layouts
<Button layout="outlined" variant="success">Outlined Success</Button>
<Button layout="sharp" variant="primary">Sharp Primary</Button>
<Button layout="rounded" variant="danger">Rounded Danger</Button>
<Button layout="plain" variant="primary">Plain Primary</Button>Import
import { Button } from 'fluxo-ui';Props
variant'success' | 'warning' | 'danger' | 'info' | 'default' | 'primary' | 'secondary'"'default'"Button color variant
variant'success' | 'warning' | 'danger' | 'info' | 'default' | 'primary' | 'secondary'"'default'"Button color variant
size'xs' | 'sm' | 'md' | 'lg' | 'xl'"'md'"Button size
size'xs' | 'sm' | 'md' | 'lg' | 'xl'"'md'"Button size
layout'rounded' | 'default' | 'outlined' | 'plain' | 'sharp'"'default'"Button layout style (default: filled with rounded corners, outlined: border with rounded corners, sharp: filled with no radius, plain: no background or border, rounded: fully rounded/pill shape)
layout'rounded' | 'default' | 'outlined' | 'plain' | 'sharp'"'default'"Button layout style (default: filled with rounded corners, outlined: border with rounded corners, sharp: filled with no radius, plain: no background or border, rounded: fully rounded/pill shape)
disabledboolean"false"Disable button interaction
disabledboolean"false"Disable button interaction
isLoadingboolean"false"Show loading spinner and disable interaction
isLoadingboolean"false"Show loading spinner and disable interaction
leftIconIconComponent | ReactElementIcon to display on the left side of the button
leftIconIconComponent | ReactElementIcon to display on the left side of the button
rightIconIconComponent | ReactElementIcon to display on the right side of the button
rightIconIconComponent | ReactElementIcon to display on the right side of the button
labelstringButton label text (alternative to children)
labelstringButton label text (alternative to children)
childrenReactNodeButton content
childrenReactNodeButton content
onClick(e: MouseEvent) => void | Promise<any>Click event handler (supports async functions for automatic loading state)
onClick(e: MouseEvent) => void | Promise<any>Click event handler (supports async functions for automatic loading state)
classNamestringAdditional CSS classes
classNamestringAdditional CSS classes
loadingMessagestring"'Loading...'"Message to display while loading (also announced via aria-live for screen readers)
loadingMessagestring"'Loading...'"Message to display while loading (also announced via aria-live for screen readers)
waitFornumberCountdown timer in seconds before button becomes clickable
waitFornumberCountdown timer in seconds before button becomes clickable
hrefstringURL to navigate to (renders as link)
hrefstringURL to navigate to (renders as link)
newTabboolean"false"Open link in new tab
newTabboolean"false"Open link in new tab
type'submit' | 'link' | 'button'"'button'"Button type
type'submit' | 'link' | 'button'"'button'"Button type
ariaLabelstringAccessibility label
ariaLabelstringAccessibility label
titlestringHTML title attribute
titlestringHTML title attribute
idstringHTML id attribute
idstringHTML id attribute
fullWidthboolean"false"Stretch the button to fill the width of its container (common for modal footers and forms)
fullWidthboolean"false"Stretch the button to fill the width of its container (common for modal footers and forms)
tooltipReactNodeTooltip content shown on hover/focus. Renders the button wrapped in a Tooltip — useful for icon-only buttons where a tooltip is mandatory for accessibility
tooltipReactNodeTooltip content shown on hover/focus. Renders the button wrapped in a Tooltip — useful for icon-only buttons where a tooltip is mandatory for accessibility
tooltipPlacement'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'auto'"'auto'"Placement of the tooltip when tooltip prop is provided
tooltipPlacement'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'auto'"'auto'"Placement of the tooltip when tooltip prop is provided
confirmTextReactNodeWhen set, the first click shows a confirm popover; the popover Confirm action runs onClick. Useful for destructive actions
confirmTextReactNodeWhen set, the first click shows a confirm popover; the popover Confirm action runs onClick. Useful for destructive actions
confirmTitlestring"'Confirm'"Title of the confirm popover when confirmText is set
confirmTitlestring"'Confirm'"Title of the confirm popover when confirmText is set
confirmOkTextstring"'Confirm'"Label of the confirm action button
confirmOkTextstring"'Confirm'"Label of the confirm action button
confirmCancelTextstring"'Cancel'"Label of the cancel action button
confirmCancelTextstring"'Cancel'"Label of the cancel action button
Features
Variants
7 color variants: default, primary, secondary, success, warning, danger, info
Layouts
5 shape styles: default, outlined, sharp, rounded (pill), and plain
Sizes
5 size options: xs, sm, md, lg, xl for every context
Async Support
Automatically shows loading state when onClick returns a Promise
Countdown Timer
waitFor prop disables the button with a countdown for destructive actions
Icon Support
Left and right icon slots accept any React element or icon component
Link Mode
Renders as an anchor tag when href is provided, with optional newTab
Accessibility
ARIA labels, keyboard focus, role and state attributes built in
Theming
Full dark/light + 5 brand themes via CSS variables — zero extra config