Skip to content

Button

SButton is a button with style variants, sizes, a loading state, and icon slots. It is polymorphic: as renders it as another element, such as a link.

Variants

Sizes

Shape

The round prop fully rounds the edges (pill shape), while square does the opposite and removes the rounding (square corners). Every component with a frame (buttons, inputs, cards, overlays, etc.) has the square prop, and it works the same way everywhere.

Color

The color prop sets a color from the palette: a brand role, a family, or one of its shades (primary, teal, teal-10). It overrides the variant color while keeping the style (fill/outline). The hover/active states are derived automatically. On a light fill, set text-color to keep the text readable.

States

Icons

The leading (icon) and trailing (icon-right) icons take a registry name. For a button without text, set aria-label so the icon gets an accessible name.

Icon button

An icon without a text label makes the button square automatically: the horizontal padding is removed and the width equals the height of the size. If the content comes through a slot, enable the mode with the icon-only prop. Such a button requires aria-label, since there is nothing else to announce.

Without shadow

The filled variants (primary, secondary, negative) come with a shadow. The flat prop removes it without touching the shadows of other components. If you want flat buttons across the whole app, make the prop a default: installDefaults(app, { SButton: { flat: true } }). The reverse also works: elevation sets the level explicitly and overrides flat, including a flat that comes from the global defaults. The scale and the rules are on the Elevation page.

Button type

Inside a form, type="submit" submits it and type="reset" resets the fields. The default is type="button", a neutral button that does not submit.

Icon slots

The #leading and #trailing slots override the icon/icon-right props and accept any markup, for example an SIcon with a custom size.

API

Props

NameTypeDefaultDescription
asstring"button"Tag/component to render (polymorphism). button by default.
variant | "primary" | "secondary" | "negative" | "outline" | "ghost""primary"Visual variant: filled primary/secondary/negative, outlined outline or transparent ghost.
colorstringundefinedAccent color: a name from the palette (primary/teal/teal-10). Overrides the variant color.
text-colorstringundefinedText/icon color on the fill: a name from the palette. White by default (set it for light color values).
size"md" | "sm" | "lg""md"Button size: sm (32px), md (40px) or lg (48px).
roundbooleanundefinedFully rounded edges (pill shape).
squarebooleanundefinedSquare corners: removes the border radius (rounded by default).
type | "button" | "submit" | "reset""button"type of the native button (ignored when as is not button).
disabledbooleanfalseDisables the button.
loadingbooleanfalseLoading state: shows a spinner and blocks interaction.
icon-onlybooleanundefinedIcon button: a square sized by the control height, without horizontal padding. Turns on automatically when an icon is set without a text label; the prop is needed when the content comes from a slot. Such a button requires ariaLabel — a screen reader has nothing else to announce.
flatbooleanundefinedButton without a shadow. Filled variants (primary/secondary/negative) have a built-in shadow; flat removes it without affecting other components' shadows. Can also be set globally: installDefaults(app, { SButton: { flat: true } }).
elevation0 | 1 | 2 | 3 | 4 | 5undefinedShadow level 0–5 (scale); 0 means no shadow. Overrides flat.
iconstringundefinedLeading icon: a registry name or a raw SVG path. Ignored when the leading slot is set.
icon-rightstringundefinedTrailing icon: a registry name or a raw SVG path. Ignored when the trailing slot is set.
aria-labelstringundefinedAccessible name of the button. Required for icon-only buttons (no text label).

Slots

NameDescription
leadingContent before the label, usually a leading icon. Overrides the icon prop.
defaultButton label (text).
trailingContent after the label, usually a trailing icon. Overrides the iconRight prop.