Button
Offer a primary action and a secondary choice.
Examples
Offer a primary action and a secondary choice
React code
import { Button } from "@accelerate/react/components";
export function Example() {
return (
<>
<Button variant="primary">Save draft</Button>
<Button variant="outline">Cancel</Button>
</>
);
}Angular code
import { Component } from "@angular/core";
import { AccButton } from "@accelerate/angular/components";
@Component({
selector: "app-example",
imports: [
AccButton,
],
template: `
<button accButton variant="primary">Save draft</button>
<button accButton variant="outline">Cancel</button>
`,
})
export class Example {}Variants, sizing, and disabled state
React code
import { Button } from "@accelerate/react/components";
export function Example() {
return (
<>
<Button size="sm">Small</Button>
<Button size="lg" variant="secondary">Large</Button>
<Button variant="destructive">Remove</Button>
<Button variant="ghost">See details</Button>
<Button variant="link">Learn more</Button>
<Button disabled>Unavailable</Button>
</>
);
}Angular code
import { Component } from "@angular/core";
import { AccButton } from "@accelerate/angular/components";
@Component({
selector: "app-example",
imports: [
AccButton,
],
template: `
<button accButton size="sm">Small</button>
<button accButton size="lg" variant="secondary">Large</button>
<button accButton variant="destructive">Remove</button>
<button accButton variant="ghost">See details</button>
<button accButton variant="link">Learn more</button>
<button accButton disabled>Unavailable</button>
`,
})
export class Example {}Installation
Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.
- React
@accelerate/ui@0.4.0and@accelerate/react@0.4.0- Angular
@accelerate/ui@0.4.0and@accelerate/angular@0.2.0
Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.
Usage
Choose primary, secondary, outline, ghost, destructive, or link. Optional sizes are sm, lg, and icon.
Import the React component Button from @accelerate/react/components. For Angular, add AccButton to the standalone component’s imports and use <button accButton>.
Examples use these React parts: Button. The Angular examples show the corresponding directives and template hosts.
API reference
- variant
- primary (default), secondary, outline, ghost, destructive, or link.
- size
- sm, lg, or icon.
- type
- Defaults to button. Use submit to submit a form.
- disabled
- Uses the native disabled state.