DocsComponentsCore
Button
ts
import { Button } from "@grassroot/ui-react"; <Button>Start a project</Button><Button variant="secondary">View work</Button><Button variant="ghost">See the work</Button><Button size="lg">Large</Button><Button disabled>Disabled</Button>ts
<script setup lang="ts">import { Button } from "@grassroot/ui-vue";</script> <template> <Button>Start a project</Button> <Button variant="secondary">View work</Button> <Button variant="ghost">See the work</Button> <Button size="lg">Large</Button> <Button disabled>Disabled</Button></template>ts
import { Component } from "@angular/core";import { GrassrootButton } from "@grassroot/ui-angular"; @Component({ selector: "app-example", standalone: true, imports: [GrassrootButton], template: ` <grassroot-button>Start a project</grassroot-button> <grassroot-button variant="secondary">View work</grassroot-button> <grassroot-button variant="ghost">See the work</grassroot-button> <grassroot-button size="lg">Large</grassroot-button> <grassroot-button [disabled]="true">Disabled</grassroot-button> `,})export class ExampleComponent {}ts
<script lang="ts"> import { Button } from "@grassroot/ui-svelte";</script> <Button>Start a project</Button><Button variant="secondary">View work</Button><Button variant="ghost">See the work</Button><Button size="lg">Large</Button><Button disabled>Disabled</Button>ts
import { Button } from "@grassroot/ui-solid"; export function Example() { return ( <> <Button>Start a project</Button> <Button variant="secondary">View work</Button> <Button variant="ghost">See the work</Button> <Button size="lg">Large</Button> <Button disabled>Disabled</Button> </> );}Installation
bash
pnpm dlx grassroot add ui/buttonbash
npx grassroot@latest add ui/buttonbash
yarn dlx grassroot add ui/buttonbash
bunx grassroot add ui/buttonAPI Reference
| Prop | Type | Default |
|---|---|---|
variantVisual style. | "primary" | "secondary" | "ghost" | "link" | undefined | "primary" |
size | "sm" | "md" | "lg" | undefined | "md" |
iconLeftOptional leading icon node (Lucide). | React.ReactNode | — |
toneBrand colour. "accent" (default) is the ember; amber/teal/indigo recolour the primary fill (kept AA-safe) and the ghost/link border+text. Secondary stays the neutral ink option. | Tone | undefined | "accent" |
asRender as a different element/component (e.g. a routing link) while keeping Button styling. | React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined | "button" |
hrefPassed through when `as` renders a link (anchor / SmartLink / next-Link). | string | undefined | — |
loadingIn-flight state: announces `aria-busy`, swaps the leading icon for a spinner, and suspends activation — WITHOUT removing the button from the tab order (the Grassroot rule: a busy control stays findable). Keep the label as the ongoing verb ("Deploying…"), the component won't invent one. | boolean | undefined | false |