Canvas Design System
Main Site Tokens

Button

Interactive buttons for actions, links, and form submissions. Supports multiple variants, sizes, icons, and states.

When to Use

Use Button when: Triggering actions (save, delete, submit), navigating as a CTA, or confirming modal dialogs. Use primary for the main action, secondary for alternatives.
Don't use when: Inline text navigation — use a plain anchor instead. For toggle states, use Tabs or a checkbox.

Variants

<?= ws_button('Primary', ['variant' => 'primary']) ?>
<?= ws_button('Secondary', ['variant' => 'secondary']) ?>
<?= ws_button('Ghost', ['variant' => 'ghost']) ?>
<?= ws_button('Danger', ['variant' => 'danger']) ?>

Sizes

With Icons

<?= ws_button('Add Workshop', ['variant' => 'primary', 'icon' => 'add']) ?>
<?= ws_button('Next Step', ['variant' => 'secondary', 'icon' => 'arrow_forward', 'iconPosition' => 'right']) ?>

States

As Link

When an href is provided, the button renders as an <a> tag.

<?= ws_button('View Workshops', ['variant' => 'primary', 'href' => '/workshops']) ?>

Parameters

ParameterTypeDefaultDescription
$textstringButton label text
variantstringprimaryprimary | secondary | ghost | danger
sizestringmdsm | md | lg
iconstringnullMaterial icon name
iconPositionstringleftleft | right
hrefstringnullRenders as <a> instead of <button>
typestringbuttonbutton | submit | reset
disabledboolfalseDisabled state
loadingboolfalseShows spinner, disables button
fullWidthboolfalseStretch to container width
idstringnullElement ID
classstring''Additional CSS classes
attrsarray[]Extra HTML attributes

Phase Theming

The secondary variant inherits --phase-color for its text and border. Set this variable on a parent to theme buttons per phase or app.

<!-- Set --phase-color on any parent container -->
<div style="--phase-color: var(--phase-plan);">
    <?= ws_button('Plan', ['variant' => 'secondary']) ?>
</div>

Anatomy

.ws-btn — Outer <button> or <a>
.ws-btn__icon — Icon wrapper (left or right)
.ws-btn__text — Label text
.ws-btn__spinner — Loading spinner (when loading: true)

CSS Classes

ClassPurpose
.ws-btnBase button styles
.ws-btn--primaryPrimary variant
.ws-btn--secondarySecondary variant
.ws-btn--ghostGhost variant
.ws-btn--dangerDanger variant
.ws-btn--sm / --md / --lgSize modifiers
.ws-btn--fullFull-width
.ws-btn--loadingLoading state
.ws-btn--icon-onlyIcon-only button (no text)

Files

FilePurpose
includes/components/helpers.phpws_button() helper function
includes/components/button.phpButton template
includes/components/components.cssButton CSS (.ws-btn rules)