Skip to content

button

button(opts?): void

Defined in: components/button.ts:87

A button. Tonal and outlined variants show a border; filled variants rely on their solid background for affordance.

Shortcut: pass a string to use it as the label, or a function for custom content.

Tip: pair href with Aberdeen’s interceptLinks() (called once at app startup) for SPA-style navigation without manual click handlers:

import {interceptLinks} from from "aberdeen/route";
interceptLinks(); // once at root
S.button({ href: "/dashboard", content: "Dashboard" }); // navigates via router

Slot | ButtonOptions

void

S.button({ content: "Save", click: S.alert("Saved.") });
S.button({ content: "Cancel", attrs: ".neutral", click: cancel }); // neutral button
S.button({ content: "Delete", attrs: ".danger .outlined", click: del });
S.button("Cancel"); // shorthand for { content: "Cancel" }
S.button({ href: "/docs", content: "Docs" }); // renders an <a role=button>