Actions
Components

Actions

Choose buttons, toggles, and clipboard controls for application actions.

Components in this category

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.

ButtonProps props
PropTypeDefaultDescription
variantButtonVariant"default""default" | "primary" | "outline" | "ghost" | "danger"
sizeButtonSize"md""sm" | "md"
leftIconReactNode—Slot before the label text.
rightIconReactNode—Slot after the label text.
fullWidthboolean—Stretches the button to fill its container.
disabledboolean—Prevents interaction and applies disabled styling.
onClick() => void—Click handler.
childrenReactNode—Button label.

Variants

Button variants

Sizes

Button sizes

With icons

Button with icons

States

Button states

Full width

Button fullWidth
ImportTSX
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.

IconButtonProps props
PropTypeDefaultDescription
iconReactNode—The icon to display.
aria-labelstring—Accessible label for the button.
variantButtonVariant"ghost""default" | "primary" | "outline" | "ghost" | "danger"
sizeButtonSize"md""sm" | "md"
disabledboolean—Prevents interaction.
IconButton
ImportTSX
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.

SplitButtonProps props
PropTypeDefaultDescription
childrenReactNode—Main button label.
menuReactNode—MenuItem components for the dropdown.
onClick() => void—Primary (left half) action.
variantButtonVariant"default"Applies to both halves.
sizeButtonSize"md""sm" | "md"
leftIconReactNode—Icon before the main label.
disabledboolean—Disables both halves.
placementPlacement"bottom-end"Dropdown placement relative to the trigger.
ImportTSX
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>;
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.

CopyButtonProps props
PropTypeDefaultDescription
valuestring | (() => string)—The text to copy. A function is called at click time.
labelReactNode—Text beside the icon. Omit for icon-only.
copiedLabelReactNode"Copied"Replaces label while in the copied state.
timeoutnumber1400How 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.
CopyButton
ImportTSX
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.

ThemeToggleProps props
PropTypeDefaultDescription
variant"icon" | "segmented""icon"Icon-only toggle or segmented light/dark pair.
size"sm" | "md""md"Control size.
showLabelboolean—Shows 'Light'/'Dark' text beside the icon (icon variant only).
ThemeToggle
ImportTSX
import { ThemeToggle } from "@solarius/onset";

// Must be inside a ThemeProvider
<ThemeToggle />
<ThemeToggle variant="segmented" size="sm" />