UI Interface
Buttons
Variants, tones, sizes, icons, loading and disabled states, groups, split buttons, segmented controls, chips, link buttons, FABs and social buttons. Every preview is live; open the Code panel to copy the exact markup.
Button variants
Primary, outline, ghost and soft cover almost every surface. Glass and white are made for gradient heroes and aurora headers.
Hover each button to see the kit hover state; press Tab to see the focus ring. Use one primary button per view, everything else outline, ghost or soft.
<button type="button" class="sx-btn sx-btn--primary">Primary</button>
<button type="button" class="sx-btn sx-btn--outline">Outline</button>
<button type="button" class="sx-btn sx-btn--ghost">Ghost</button>
<button type="button" class="sx-btn sx-btn--soft">Soft</button>
<button type="button" class="sx-btn sx-btn--soft" data-tone="success">Soft success</button>
Glass and white (on gradients)
Translucent glass and solid white buttons sit on hero banners, aurora cards and dark gradient panels.
Both variants use light text or light fills, so keep them on dark or saturated backgrounds only.
<button type="button" class="sx-btn sx-btn--white"><i class="icon-rocket"></i>Start free trial</button>
<button type="button" class="sx-btn sx-btn--glass"><i class="icon-play"></i>Watch demo</button>
<button type="button" class="sx-btn sx-btn--glass sx-btn--sm">Glass small</button>
<button type="button" class="sx-btn sx-btn--glass sx-btn--icon" aria-label="Share"><i class="icon-share-2"></i></button>
<button type="button" class="sx-btn sx-btn--white sx-btn--icon sx-btn--sm" aria-label="Download"><i class="icon-download"></i></button>
Tones: solid, soft and outline
Soft buttons read the shared data-tone attribute. Solid and tonal outline need the small page-local helpers shown in the code view.
Tones: primary, success, warning, danger, info, accent, violet, orange, blue, pink, neutral. Dark mode brightens the tone foreground automatically.
<!-- Soft: built into the kit -->
<button type="button" class="sx-btn sx-btn--soft" data-tone="success">Success</button>
<!-- Solid and tonal outline: add this CSS once -->
<style>
.ui-solid { background: var(--tone); }
.ui-solid:hover { filter: brightness(1.08); }
.ui-tone-outline { color: var(--tone-fg); border-color: color-mix(in oklab, var(--tone) 45%, transparent); background: var(--surface-raised); }
.ui-tone-outline:hover { background: var(--tone-bg); }
</style>
<button type="button" class="sx-btn ui-solid text-white" data-tone="danger">Delete</button>
<button type="button" class="sx-btn ui-tone-outline" data-tone="warning">Review</button>
Sizes
The kit ships default (36px) and sm (30px). Larger and smaller steps are plain Tailwind utilities that override the kit.
<div class="ui-row"><span class="ui-lab">Primary</span>
<button type="button" class="sx-btn sx-btn--primary h-6 px-2 text-[11px] rounded-lg">Extra small</button>
<button type="button" class="sx-btn sx-btn--primary sx-btn--sm">Small</button>
<button type="button" class="sx-btn sx-btn--primary">Default</button>
<button type="button" class="sx-btn sx-btn--primary h-11 px-5 text-sm rounded-xl">Large</button>
<button type="button" class="sx-btn sx-btn--primary h-[52px] px-7 text-[15px] rounded-2xl">Extra large</button>
</div>
<div class="ui-row"><span class="ui-lab">Outline</span>
<button type="button" class="sx-btn sx-btn--outline h-6 px-2 text-[11px] rounded-lg">Extra small</button>
<button type="button" class="sx-btn sx-btn--outline sx-btn--sm">Small</button>
<button type="button" class="sx-btn sx-btn--outline">Default</button>
<button type="button" class="sx-btn sx-btn--outline h-11 px-5 text-sm rounded-xl">Large</button>
<button type="button" class="sx-btn sx-btn--outline h-[52px] px-7 text-[15px] rounded-2xl">Extra large</button>
</div>
<div class="ui-row"><span class="ui-lab">Pill</span>
<button type="button" class="sx-btn sx-btn--primary sx-btn--sm rounded-full">Small pill</button>
<button type="button" class="sx-btn sx-btn--soft rounded-full">Default pill</button>
<button type="button" class="sx-btn sx-btn--outline h-11 px-6 text-sm rounded-full">Large pill</button>
</div>
Leading and trailing icons
Drop a lucide or Phosphor icon inside the button. The kit sizes it to 15px and spaces it with the built-in gap.
<button type="button" class="sx-btn sx-btn--primary"><i class="icon-plus"></i>New project</button>
<button type="button" class="sx-btn sx-btn--primary">Continue<i class="icon-arrow-right"></i></button>
<button type="button" class="sx-btn sx-btn--outline"><i class="icon-download"></i>Export<i class="icon-chevron-down !text-[13px] text-[var(--text-tertiary)]"></i></button>
<button type="button" class="sx-btn sx-btn--soft" data-tone="violet"><i class="icon-sparkles"></i>Ask AI</button>
<button type="button" class="sx-btn sx-btn--ghost"><i class="icon-settings"></i>Settings</button>
<button type="button" class="sx-btn sx-btn--outline sx-btn--sm"><i class="icon-filter"></i>Filters<span class="sx-badge sx-badge--sm" data-tone="primary">3</span></button>
<button type="button" class="sx-btn sx-btn--outline"><i class="ph ph-slack-logo"></i>Connect Slack</button>
Icon-only buttons
Use sx-btn--icon for square buttons. Always provide an aria-label; add data-tip for a hover tooltip.
<button type="button" class="sx-btn sx-btn--primary sx-btn--icon" aria-label="Add" data-tip="Add"><i class="icon-plus"></i></button>
<button type="button" class="sx-btn sx-btn--outline sx-btn--icon" aria-label="Edit" data-tip="Edit"><i class="icon-pencil"></i></button>
<button type="button" class="sx-btn sx-btn--ghost sx-btn--icon" aria-label="More actions"><i class="icon-ellipsis"></i></button>
<button type="button" class="sx-btn sx-btn--soft sx-btn--icon" data-tone="danger" aria-label="Delete" data-tip="Delete"><i class="icon-trash-2"></i></button>
<button type="button" class="sx-btn sx-btn--outline sx-btn--icon sx-btn--sm" aria-label="Copy"><i class="icon-copy"></i></button>
<button type="button" class="sx-btn sx-btn--primary sx-btn--icon w-11 h-11 rounded-xl" aria-label="Send"><i class="icon-send !text-[18px]"></i></button>
<button type="button" class="sx-btn sx-btn--outline sx-btn--icon rounded-full" aria-label="Favourite"><i class="icon-heart"></i></button>
<button type="button" class="sx-btn sx-btn--soft sx-btn--icon rounded-full relative" aria-label="Notifications"><i class="icon-bell"></i><span class="absolute top-1.5 end-1.5 w-2 h-2 rounded-full" style="background: var(--sx-danger)"></span></button>
States: hover, focus and disabled
Hover and focus come from the kit. Disabled uses the native attribute (or aria-disabled on links) with a tiny page-local rule.
Explain why an action is unavailable next to the button; a disabled control alone gives no feedback.
<button type="button" class="sx-btn sx-btn--primary" disabled>Primary</button>
<a href="#" class="sx-btn sx-btn--outline" aria-disabled="true" tabindex="-1">Link disabled</a>
<style>
.sx-btn:disabled, .sx-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; box-shadow: none; }
</style>
Loading state (spinner)
Swap the leading icon for a spinning loader, set aria-busy and disable the button. Click the live buttons to try it.
Keep the label visible so the button width does not jump. Announce completion with a toast or live region.
<button type="button" class="sx-btn sx-btn--primary" data-ui-loading>
<i class="icon-send ui-btn-ic"></i>
<i class="icon-loader-circle ui-spin ui-ld"></i>Send invoice
</button>
<style>
@keyframes ui-spin { to { transform: rotate(360deg); } }
.ui-spin { animation: ui-spin .8s linear infinite; }
.ui-ld { display: none; }
.sx-btn.is-loading .ui-ld { display: inline-block; }
.sx-btn.is-loading .ui-btn-ic { display: none; }
</style>
<script>
// on click: add .is-loading, aria-busy="true", disabled; remove when the request ends
</script>
Button groups
Join related buttons into one control with a page-local .ui-group wrapper. Supports outline, soft and icon-only members.
<div class="ui-group" role="group" aria-label="View">
<button type="button" class="sx-btn sx-btn--outline is-active" aria-pressed="true">Day</button>
<button type="button" class="sx-btn sx-btn--outline" aria-pressed="false">Week</button>
<button type="button" class="sx-btn sx-btn--outline" aria-pressed="false">Month</button>
</div>
<style>
.ui-group { display: inline-flex; }
.ui-group > .sx-btn, .ui-group > .sx-dropdown > .sx-btn { border-radius: 0; }
.ui-group > .sx-btn + .sx-btn { margin-inline-start: -1px; }
.ui-group > .sx-btn:first-child { border-start-start-radius: 10px; border-end-start-radius: 10px; }
.ui-group > .sx-btn:last-child, .ui-group > .sx-dropdown:last-child > .sx-btn { border-start-end-radius: 10px; border-end-end-radius: 10px; }
.ui-group > .sx-btn:hover, .ui-group > .sx-btn:focus-visible { position: relative; z-index: 1; }
.ui-group > .sx-btn.is-active { background: var(--surface-sunken); color: var(--color-primary-700); }
</style>
Split button with dropdown
A main action plus a caret that opens a sx-menu. The dropdown is handled by the shell with data-sx-dropdown.
Use sx-menu--up when the split button sits near the bottom of the viewport.
<div class="ui-group ui-split" role="group" aria-label="Publish">
<button type="button" class="sx-btn sx-btn--primary"><i class="icon-rocket"></i>Publish</button>
<div class="sx-dropdown" data-sx-dropdown>
<button type="button" class="sx-btn sx-btn--primary sx-btn--icon" data-sx-trigger
aria-haspopup="menu" aria-expanded="false" aria-label="More publish options"><i class="icon-chevron-down"></i></button>
<div class="sx-menu w-[210px]" role="menu">
<a href="#" class="sx-menu-item" role="menuitem"><i class="icon-calendar-clock"></i>Schedule for later</a>
<div class="sx-menu-sep"></div>
<a href="#" class="sx-menu-item" role="menuitem"><i class="icon-archive"></i>Archive</a>
</div>
</div>
</div>
<!-- .ui-group CSS: see Button groups. Divider between primary halves: -->
<style>
.ui-split .sx-btn--primary + .sx-dropdown > .sx-btn { box-shadow: inset 1px 0 0 color-mix(in oklab, white 35%, transparent); }
</style>
Segmented controls (sx-seg)
Mutually exclusive options in one compact control. The shell toggles .is-active and fires a sx:seg event with the chosen value.
Listen with el.addEventListener("sx:seg", e => e.detail.value) to swap data. Keep labels short; use tabs for navigation between panels.
<div class="ui-row"><span class="ui-lab">Text</span>
<div class="sx-seg" data-sx-seg="range" role="group" aria-label="Date range">
<button type="button" data-value="7d">7D</button>
<button type="button" data-value="30d" class="is-active" aria-pressed="true">30D</button>
<button type="button" data-value="90d">90D</button>
<button type="button" data-value="1y">1Y</button>
</div>
<div class="sx-seg" data-sx-seg="plan" role="group" aria-label="Billing">
<button type="button" data-value="monthly" class="is-active" aria-pressed="true">Monthly</button>
<button type="button" data-value="yearly">Yearly <span class="sx-badge sx-badge--sm" data-tone="success">-20%</span></button>
</div>
</div>
<div class="ui-row"><span class="ui-lab">Icons</span>
<div class="sx-seg" data-sx-seg="view" role="group" aria-label="Layout">
<button type="button" data-value="grid" class="is-active" aria-pressed="true" aria-label="Grid view"><i class="icon-layout-grid"></i></button>
<button type="button" data-value="list" aria-label="List view"><i class="icon-list"></i></button>
</div>
<div class="sx-seg" data-sx-seg="theme" role="group" aria-label="Theme">
<button type="button" data-value="light" class="is-active" aria-pressed="true"><span class="inline-flex items-center gap-1.5"><i class="icon-sun"></i>Light</span></button>
<button type="button" data-value="dark"><span class="inline-flex items-center gap-1.5"><i class="icon-moon"></i>Dark</span></button>
<button type="button" data-value="system"><span class="inline-flex items-center gap-1.5"><i class="icon-monitor"></i>System</span></button>
</div>
</div>
<div class="ui-row"><span class="ui-lab">Full width</span>
<div class="sx-seg w-full max-w-md [&>button]:flex-1" data-sx-seg="status" role="group" aria-label="Status">
<button type="button" data-value="all" class="is-active" aria-pressed="true">All</button>
<button type="button" data-value="open">Open</button>
<button type="button" data-value="closed">Closed</button>
<button type="button" data-value="off" disabled class="opacity-50 cursor-not-allowed">Off</button>
</div>
</div>
Chips (sx-chip)
Compact pills for filters and quick picks. Click to toggle the selected look; add an icon or a remove button.
<button type="button" class="sx-chip is-on" data-ui-chip aria-pressed="true">All</button>
<button type="button" class="sx-chip" data-ui-chip aria-pressed="false">Design</button>
<span class="sx-chip is-on ui-removable">Status: Active
<button type="button" class="ui-x" data-ui-remove aria-label="Remove Status: Active"><i class="icon-x"></i></button>
</span>
<style>
.sx-chip.is-on { border-color: var(--color-primary-500); color: var(--color-primary-700); background: color-mix(in oklab, var(--color-primary-500) 10%, var(--surface-raised)); }
[data-theme="dark"] .sx-chip.is-on { color: var(--color-primary-300); }
.ui-x { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-inline-end: -4px; border-radius: 50%; }
.ui-x:hover { background: var(--tone-bg, var(--surface-sunken)); }
.ui-x i { font-size: 11px; }
</style>
Link buttons
Text-only actions: the kit sx-link, ghost buttons that look like links, and anchors styled as buttons.
Use anchors for navigation and buttons for actions. Add rel="noopener" to links that open a new tab.
<a href="#" class="sx-link">View all activity<i class="icon-arrow-right"></i></a>
<a href="#" class="sx-link">Documentation<i class="icon-external-link"></i></a>
<a href="#" class="sx-link"><i class="icon-arrow-left"></i>Back to projects</a>
<a href="#" class="sx-link underline underline-offset-4">Always underlined</a>
<button type="button" class="sx-btn sx-btn--ghost !px-1.5 text-[var(--color-primary-600)]">Ghost link</button>
<a href="#" class="sx-btn sx-btn--outline"><i class="icon-link"></i>Anchor as button</a>
<a href="#" class="sx-btn sx-btn--primary" target="_blank" rel="noopener">Open in new tab<i class="icon-external-link"></i></a>
Floating action buttons
Round primary actions pinned to a corner. Shown here inside a mock frame; in production use position fixed.
A FAB should represent the single most common action on the screen. Always label icon-only FABs.
<button type="button" class="sx-btn sx-btn--primary ui-fab" aria-label="Create new"><i class="icon-plus"></i></button>
<button type="button" class="sx-btn sx-btn--primary ui-fab ui-fab--ext"><i class="icon-pencil"></i>Compose</button>
<style>
.ui-fab { position: absolute; inset-block-end: 12px; inset-inline-end: 12px; width: 52px; height: 52px; padding: 0; border-radius: 50%; box-shadow: 0 12px 24px -10px var(--color-primary-600); }
.ui-fab > i { font-size: 20px; }
.ui-fab--ext { width: auto; padding-inline: 1.1rem; border-radius: 99px; }
/* in production: position: fixed; inset-block-end: 24px; inset-inline-end: 24px; */
</style>
Full-width and responsive
Combine Tailwind width utilities with the kit: block buttons, stacked on mobile and inline from sm, and icon-only collapse.
Keep touch targets at least 36px tall on phones (default size) and use size lg for the primary mobile action.
<button type="button" class="sx-btn sx-btn--primary w-full h-11">Full-width primary</button>
<button type="button" class="sx-btn sx-btn--outline w-full">Full-width outline</button>
<div class="flex flex-col sm:flex-row gap-2 sm:justify-end">
<button type="button" class="sx-btn sx-btn--outline w-full sm:w-auto">Cancel</button>
<button type="button" class="sx-btn sx-btn--primary w-full sm:w-auto">Save changes</button>
</div>
<div class="flex flex-wrap items-center gap-2">
<button type="button" class="sx-btn sx-btn--primary"><i class="icon-plus"></i><span class="hidden sm:inline">New invoice</span></button>
<button type="button" class="sx-btn sx-btn--outline"><i class="icon-download"></i><span class="hidden sm:inline">Export</span></button>
<span class="text-[12px] text-[var(--text-tertiary)]">Labels hide below 640px</span>
</div>
<div class="grid grid-cols-2 gap-2">
<button type="button" class="sx-btn sx-btn--soft" data-tone="danger"><i class="icon-x"></i>Decline</button>
<button type="button" class="sx-btn sx-btn--soft" data-tone="success"><i class="icon-check"></i>Approve</button>
</div>
Usage tips and accessibility
Guidelines worth following across the whole template
Usage tips
- Limit each view to one primary button; secondary actions use outline, ghost or soft.
- Start labels with a verb: Save changes, Send invoice, Export report.
- Pair destructive actions with the danger tone and confirm irreversible ones.
- Use size lg for the main mobile call to action and keep groups under five items.
- Shared styles used on this page that are not in shell.css are shown in each Code panel as page-local CSS.
Accessibility
- Icon-only buttons need an aria-label; tooltips (data-tip) are supplementary, not a replacement.
- Toggle buttons, chips and segmented items expose state with aria-pressed.
- Loading buttons set aria-busy and stay in the tab order context; disabled ones use the native attribute.
- The kit focus ring (2px primary outline) is visible on every variant; never remove it.
- Use anchors for navigation and buttons for actions, and keep touch targets at 36px or more.
Social buttons
Sign-in and share buttons using Phosphor brand logos. Outline for neutral providers, inverted fill for dark brands.
Brand marks are generic Phosphor logos. Follow each provider brand guidelines before shipping real sign-in flows.
sx-btn--outlineph ph-*-logow-full