Button
Clickable action in plain <button> elements. Variants map to classes and data-variant attributes.
INSTALL
1pnpm dlx @sayagodev/mo add buttonOr copy the files manually and import them:
1import "@sayagodev/mo/css/button.css";2import "@sayagodev/mo/css/shared.css";
EXAMPLES
Variants
1<button type="button">Default</button>2<button type="button" data-variant="secondary">Secondary</button>3<button type="button" class="outline">Outline</button>4<button type="button" class="ghost">Ghost</button>5<button type="button" data-variant="danger">Destructive</button>6<a class="button link" href="#">Link</a>7
Default
1<button type="button">Button</button>2
Secondary
1<button type="button" data-variant="secondary">Secondary</button>2
Outline
1<button type="button" class="outline">Outline</button>2
Ghost
1<button type="button" class="ghost">Ghost</button>2
Destructive
1<button type="button" data-variant="danger">Destructive</button>2
Link
1<button type="button" class="link">Link</button>2
With icon
1<div class="hstack">2 <button type="button" class="outline">3 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6a9 9 0 0 0-9 9V3" /><circle cx="18" cy="6" r="3" /><circle cx="6" cy="18" r="3" /></svg>4 New Branch5 </button>6 <button type="button" class="outline">7 Fork8 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="18" r="3" /><circle cx="6" cy="6" r="3" /><circle cx="18" cy="6" r="3" /><path d="M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9" /><path d="M12 12v3" /></svg>9 </button>10</div>11
Icon only
1<button type="button" class="outline icon" aria-label="Upgrade">2 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 2a10 10 0 0 1 7.38 16.75" /><path d="m16 12-4-4-4 4" /><path d="M12 16V8" /><path d="M2.5 8.875a10 10 0 0 0-.5 3" /><path d="M2.83 16a10 10 0 0 0 2.43 3.4" /><path d="M4.636 5.235a10 10 0 0 1 .891-.857" /><path d="M8.644 21.42a10 10 0 0 0 7.631-.38" /></svg>3</button>4
Sizes
1<button type="button" class="xs">Extra small</button>2<button type="button" class="small">Small</button>3<button type="button">Default</button>4<button type="button" class="large">Large</button>5
Icon sizes
1<div class="vstack">2 <div class="hstack gap-2">3 <button type="button" class="outline xs">Extra Small</button>4 <button type="button" class="outline xs icon" aria-label="Submit">5 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg>6 </button>7 </div>8 <div class="hstack gap-2">9 <button type="button" class="outline small">Small</button>10 <button type="button" class="outline small icon" aria-label="Submit">11 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg>12 </button>13 </div>14 <div class="hstack gap-2">15 <button type="button" class="outline">Default</button>16 <button type="button" class="outline icon" aria-label="Submit">17 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg>18 </button>19 </div>20 <div class="hstack gap-2">21 <button type="button" class="outline large">Large</button>22 <button type="button" class="outline large icon" aria-label="Submit">23 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg>24 </button>25 </div>26</div>27
Rounded
1<div class="hstack">2 <button type="button" class="rounded-full">Get Started</button>3 <button type="button" class="outline rounded-full icon" aria-label="Submit">4 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m5 12 7-7 7 7" /><path d="M12 19V5" /></svg>5 </button>6</div>7
Group + popover
Start a new task with Copilot
Describe your task in natural language.
Copilot will open a pull request for review.
1<div data-button-group role="group" aria-label="Copilot">2 <button type="button" class="outline">3 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 8V4H8" /><rect width="16" height="12" x="4" y="8" rx="2" /><path d="M2 14h2" /><path d="M20 14h2" /><path d="M15 13v2" /><path d="M9 13v2" /></svg>4 Copilot5 </button>6 <button type="button" class="outline icon" popovertarget="btn-copilot-pop" aria-label="Open Copilot">7 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6" /></svg>8 </button>9</div>10 11<div popover id="btn-copilot-pop" class="popover" style="--mo-popover-min-width: 18rem">12 <div class="vstack gap-4">13 <div class="vstack gap-1">14 <div data-title>Start a new task with Copilot</div>15 <p data-description>Describe your task in natural language.</p>16 </div>17 <div class="vstack gap-2">18 <label class="sr-only" for="btn-copilot-task">Task description</label>19 <textarea id="btn-copilot-task" placeholder="I need to..." rows="3"></textarea>20 <p data-description>Copilot will open a pull request for review.</p>21 </div>22 </div>23</div>24
Group with select
1<div data-button-group role="group" aria-label="Amount">2 <div data-button-group>3 <select aria-label="Currency" style="font-family: var(--font-mono)">4 <option value="$">$</option>5 <option value="€">€</option>6 <option value="£">£</option>7 </select>8 <input placeholder="10.00" inputmode="decimal" pattern="[0-9]*" aria-label="Amount" />9 </div>10 <div data-button-group>11 <button type="button" class="outline icon" aria-label="Send">12 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14" /><path d="m12 5 7 7-7 7" /></svg>13 </button>14 </div>15</div>16
As child
1<a class="button small" data-variant="secondary" href="#">Login</a>2
Spinner
1<div class="hstack">2 <button type="button" disabled>3 <span aria-busy="true"></span>4 Please wait5 </button>6 <button type="button" class="outline" disabled>7 <span aria-busy="true"></span>8 Generating9 </button>10 <button type="button" data-variant="secondary" disabled>11 Downloading12 <span aria-busy="true"></span>13 </button>14 <button type="button" data-variant="destructive" disabled>15 <span aria-busy="true"></span>16 Deleting17 </button>18</div>19
Disabled
1<button type="button" disabled>Disabled</button>2<button type="button" class="outline" disabled>Disabled outline</button>3
Demo
1<div class="hstack">2 <button type="button" class="outline">Button</button>3 <button type="button" class="outline icon" aria-label="Submit">4 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m5 12 7-7 7 7" /><path d="M12 19V5" /></svg>5 </button>6</div>7
API
NAMETYPEDEFAULTDESCRIPTION
class"outline" | "ghost" | "link" | "small" | "large"—Visual style / size of the button.
data-variant"destructive"—Semantic variant (destructive actions).
disabledbooleanfalseDisables the button.
type"button" | "submit" | "reset""submit"Native button type.
command"show-modal" | "close" | …—Declarative Command API action.
commandforstring (element id)—Target element of the command.
All other native <button> attributes are supported.
THEMING · PLAYGROUND
Button reads global tokens plus its own --mo-button-* hooks. Edit either altitude in the editor — autocomplete knows every hook — and the preview obeys in real time.
Global tokens
--accent--accent-foreground--background--border--destructive--foreground--input--muted--muted-foreground--primary--primary-foreground--radius--ring--secondary--secondary-foregroundComponent hooks
--mo-button-font-size--mo-button-height--mo-button-height-large--mo-button-height-small--mo-button-height-xs--mo-button-padding-x--mo-button-padding-x-large--mo-button-padding-x-small--mo-button-padding-x-xs--mo-button-padding-y--mo-button-radiusPreview
Your CSS
Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.