Skip to content

Buttons

Buttons are composed from a base .sw-btn class plus optional size and style modifiers. Medium size and primary style are the defaults and don't need to be applied explicitly.

Sizes

ModifierFont sizePaddingRadiusIcon gap
.sw-btn--xxs10px4px 12px360px2px
.sw-btn--xs14px8px 14px6px2px
.sw-btn--s16px10px 16px8px4px
.sw-btn (default)18px12px 18px10px6px
.sw-btn--l20px16px 24px12px8px
.sw-btn--xl24px18px 24px14px8px

Styles

ModifierUse
.sw-btn (default)Primary action — solid primary surface
.sw-btn--secondarySecondary action — solid secondary surface
.sw-btn--secondary-outlineOutlined action — outlined on white surface
.sw-btn--tertiaryTertiary action — solid tertiary surface
.sw-btn--textText-only action — transparent surface with link-coloured text

With icons

Buttons lay out their children with display: flex and an 8px gap, so an icon can be added either side of the label. Wrap the label in a <span> and place an <i> for the icon — order in the markup determines which side it appears.

html
<button class="sw-btn">
  <span>Label</span>
  <i>→</i>
</button>

The pattern works at any size — the gap scales with the size modifier (see the table above).

States

All styles respond to :hover, :active, :focus, and :disabled.

Loading

Add .sw-btn--loading to show an in-progress state. The label is hidden and replaced by an animated three-dot indicator, while the button keeps its original size so layout doesn't shift. Pointer events are disabled for the duration, and the animation is suppressed for users who prefer reduced motion.

html
<button class="sw-btn sw-btn--loading">Save</button>