Actions
Choose buttons, toggles, and clipboard controls for application actions.
Components in this category
Primary, outline, ghost and danger variants with full keyboard support.
IconButtonSquare icon-only button, same variants as Button.
SplitButtonA button with a dropdown menu on the right edge.
CopyButtonCopies text to the clipboard with visual feedback.
ThemeToggleToggles between light and dark mode.
Button
Button is the primary interactive control. Five variants (default, primary, outline, ghost, danger), two sizes (sm, md), plus leftIcon/rightIcon slots and fullWidth. Every standard <button> attribute forwards.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | ButtonVariant | "default" | "default" | "primary" | "outline" | "ghost" | "danger" |
size | ButtonSize | "md" | "sm" | "md" |
leftIcon | ReactNode | — | Slot before the label text. |
rightIcon | ReactNode | — | Slot after the label text. |
fullWidth | boolean | — | Stretches the button to fill its container. |
disabled | boolean | — | Prevents interaction and applies disabled styling. |
onClick | () => void | — | Click handler. |
children | ReactNode | — | Button label. |
Variants
Sizes
With icons
States
Full width
import { Button } from "@solarius/onset";
import type { ButtonVariant, ButtonSize } from "@solarius/onset";IconButton
Square icon-only button. Same variants and sizes as Button, but takes an icon (any ReactNode, typically a Tabler icon) and an aria-label in place of visible text.
| Prop | Type | Default | Description |
|---|---|---|---|
icon | ReactNode | — | The icon to display. |
aria-label | string | — | Accessible label for the button. |
variant | ButtonVariant | "ghost" | "default" | "primary" | "outline" | "ghost" | "danger" |
size | ButtonSize | "md" | "sm" | "md" |
disabled | boolean | — | Prevents interaction. |
import { IconButton } from "@solarius/onset";
import { IconSearch } from "@tabler/icons-react";
<IconButton icon={<IconSearch size={14} />} aria-label="Search" />;SplitButton
SplitButton combines a primary Button with a caret dropdown on the right edge, as in an "Export CSV" ▾ control. The main onClick fires the primary action; menu provides the alternate options via an internal DropdownMenu.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Main button label. |
menu | ReactNode | — | MenuItem components for the dropdown. |
onClick | () => void | — | Primary (left half) action. |
variant | ButtonVariant | "default" | Applies to both halves. |
size | ButtonSize | "md" | "sm" | "md" |
leftIcon | ReactNode | — | Icon before the main label. |
disabled | boolean | — | Disables both halves. |
placement | Placement | "bottom-end" | Dropdown placement relative to the trigger. |
import { SplitButton, MenuItem } from "@solarius/onset";
<SplitButton
onClick={() => exportCSV()}
menu={
<>
<MenuItem onClick={() => exportJSON()}>Export JSON</MenuItem>
<MenuItem onClick={() => exportPDF()}>Export PDF</MenuItem>
</>
}
>
Export CSV
</SplitButton>;CopyButton
CopyButton writes a value to the clipboard and confirms in place: the icon swaps to a check for timeout ms. It does not show a toast, since it usually sits next to the copied value.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | (() => string) | — | The text to copy. A function is called at click time. |
label | ReactNode | — | Text beside the icon. Omit for icon-only. |
copiedLabel | ReactNode | "Copied" | Replaces label while in the copied state. |
timeout | number | 1400 | How long the confirmation state lasts (ms). |
size | "sm" | "md" | "md" | Button size. |
variant | "ghost" | "outline" | "ghost" | Visual treatment. |
onCopy | (ok: boolean) => void | — | Called after the copy attempt. |
import { CopyButton } from "@solarius/onset";
<CopyButton value="sk_live_abc123" label="Copy API key" />
<CopyButton value={() => getSecret()} label="Copy" />ThemeToggle
ThemeToggle switches the nearest ThemeProvider between light and dark mode. It must be rendered inside a ThemeProvider: it drives the provider's mode, which regenerates the entire --m-* CSS variable set.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "icon" | "segmented" | "icon" | Icon-only toggle or segmented light/dark pair. |
size | "sm" | "md" | "md" | Control size. |
showLabel | boolean | — | Shows 'Light'/'Dark' text beside the icon (icon variant only). |
import { ThemeToggle } from "@solarius/onset";
// Must be inside a ThemeProvider
<ThemeToggle />
<ThemeToggle variant="segmented" size="sm" />