A Base UI (Angular) button is a Tailwind-styled directive you copy in with npx base-ui-cli add button. Put base-button on a native button, then set color and size. There is no runtime package — the source lives in your repo, so you can restyle it or swap in base-progress-button for a loading state.
Install with npx base-ui-cli add button.
Playground
<button base-button color="primary" size="default" [disabled]="false">Button</button>
Add base-button to the <button>. Default button example below.
<button base-button>Button Default</button>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-button-example',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class ButtonExampleComponent {}Install
npx base-ui-cli add button
Use color="" attribute to define button color. Supported colors are "primary", "success", "danger", "warning", "accent", "white" and "black"
<button base-button>Button Default</button> <button base-button color="primary">Button Primary</button> <button base-button color="success">Button Success</button> <button base-button color="danger">Button Danger</button> <button base-button color="accent">Button Accent</button> <button base-button color="warning">Button Warning</button> <button base-button color="black">Button Black</button> <button base-button color="white">Button White</button>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-button-example',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class ButtonExampleComponent {}Install
npx base-ui-cli add button
Use disabled to disable button.
<button base-button disabled>Button Default Disabled</button> <button base-button color="primary" disabled>Button Primary Disabled</button>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-button-example',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class ButtonExampleComponent {}Install
npx base-ui-cli add button
Loading lives on base-progress-button, not base-button. The label fades while a spinner keeps the width stable. Pair with disabled when the action cannot be retried.
<base-progress-button color="primary" [loading]="saving()">Save</base-progress-button> <button base-button color="primary" disabled>Disabled</button>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-button-example',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class ButtonExampleComponent {}Install
npx base-ui-cli add button
Add preferred icon in front or back of the content of the button.
<button base-button> <base-icon name="arrow-left"></base-icon> Button Default </button> <button base-button color="primary"> Button Primary <base-icon name="arrow-right"></base-icon> </button>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-button-example',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class ButtonExampleComponent {}Install
npx base-ui-cli add button
Add a <base-badge> with the preferred content and color, inside the <button> tag. As well the badge can be positioned in the any of the corners of the button with Tailwindcss classes.
<button base-button> <base-icon name="arrow-left"></base-icon> <base-badge class="absolute -right-2 -top-2" color="danger" size="sm">12</base-badge> Button with Badge </button> <button base-button color="primary"> Button Primary <base-badge color="success" size="sm">Free</base-badge> </button>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-button-example',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class ButtonExampleComponent {}Install
npx base-ui-cli add button
Use modifier base-button-stroked and color="" attribute to define button color. Supported colors are "primary", "success", "danger", "warning", "accent", "white" and "black"
<button base-stroked-button>Button Default</button> <button base-stroked-button color="primary">Button Primary</button> <button base-stroked-button color="success">Button Success</button> <button base-stroked-button color="danger">Button Danger</button> <button base-stroked-button color="accent">Button Accent</button> <button base-stroked-button color="warning">Button Warning</button> <button base-stroked-button color="black">Button Black</button> <button base-stroked-button color="white">Button White</button>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-button-example',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class ButtonExampleComponent {}Install
npx base-ui-cli add button
Use attribute size="" to define the size of the button. Supported sizes are "sm", "lg", "xl", "xxl", if size="" is not given, the button will be rendered with its default size.
<button base-button size="sm">Small</button> <button base-button>Default</button> <button base-button size="lg">Large</button> <button base-button size="xl">Extra Large</button> <button base-button size="xxl">Huge</button>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-button-example',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class ButtonExampleComponent {}Install
npx base-ui-cli add button
Add base-icon-button to the <button> tag and the preferred icon from our Icon Pack. And use color="" attribute to define button color. Supported colors are "primary", "success", "danger", "warning", "accent", "white", "black" and "transparent"
<button base-icon-button> <base-icon name="arrow-left"></base-icon> </button> <button base-icon-button color="primary"> <base-icon name="menu"></base-icon> </button>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-button-example',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class ButtonExampleComponent {}Install
npx base-ui-cli add button
Add base-icon-stroked-button to the <button> tag and the preferred icon from our Icon Pack. And use color="" attribute to define button color. Supported colors are "primary", "success", "danger", "warning", "accent", "white", "black" and "transparent"
<button base-stroked-icon-button> <base-icon name="arrow-left"></base-icon> </button> <button base-stroked-icon-button color="primary"> <base-icon name="menu"></base-icon> </button>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-button-example',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class ButtonExampleComponent {}Install
npx base-ui-cli add button
Use attribute size="" to define the size of the button. Supported sizes are "sm", "lg", "xl", "xxl", if size="" is not given, the button will be rendered with its default size.
<button base-icon-button size="sm"> <base-icon name="heart"></base-icon> </button> <button base-icon-button size="xxl"> <base-icon name="maximize"></base-icon> </button>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-button-example',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class ButtonExampleComponent {}Install
npx base-ui-cli add button
Site-wide VPAT-style notes live on the accessibility report.
Run the following command to add this component to your project:
npx base-ui-cli add button
For AI agents
Copy a prompt with the registry name, CLI install, and import — or add the Base UI MCP server.
npx -y base-ui-ng-mcp
Base UI provides standalone components. Import the exact elements you want to use into your component.
// Install: npx base-ui-cli add button
// Paths are relative to aliases.components (default: src/app/components)
import { BaseButtonDirective } from './button/base-button.directive';
import { IconButtonDirective } from './button/base-icon-button.directive';
import { IconStrokedButtonDirective } from './button/base-icon-stroked-button.directive';
import { BaseLinkDirective } from './button/base-link.directive';
import { StrokedButtonDirective } from './button/base-stroked-button.directive';
@Component({
selector: 'app-your-component',
imports: [
BaseButtonDirective,
BaseLinkDirective,
IconButtonDirective,
IconStrokedButtonDirective,
StrokedButtonDirective
],
template: `...`
})
export class YourComponent {} API for button — generated from JSDoc in the library source.
| API | Member | Type | Default | Description |
|---|---|---|---|---|
[base-button] | class | string | '' | Extra classes merged via `cn()`. |
[base-button] | color | ButtonColor | 'default' | The semantic visual color. Defaults to 'default'. |
[base-button] | size | ButtonSize | 'default' | The size of the button. Defaults to 'default'. |
[base-button] | width | string | — | Optional custom width (e.g. '100%'). |
[base-icon-button] | class | string | '' | Extra classes merged via `cn()`. |
[base-icon-button] | color | IconButtonColor | 'default' | The semantic visual color. Defaults to 'default'. |
[base-icon-button] | size | IconButtonSize | 'default' | The size of the button. Defaults to 'default'. |
[base-link] | color | LinkColor | 'default' | The semantic visual color. Defaults to 'default'. |
[base-link] | size | LinkSize | 'default' | The size of the link. Defaults to 'default'. |
[base-link] | width | string | — | Optional custom width (e.g. '100%'). |
[base-stroked-button] | class | string | '' | Extra classes merged via `cn()`. |
[base-stroked-button] | color | StrokedButtonColor | 'default' | The semantic visual color. Defaults to 'default'. |
[base-stroked-button] | size | StrokedButtonSize | 'default' | The size of the button. Defaults to 'default'. |
[base-stroked-button] | width | string | — | Optional custom width (e.g. '100%'). |
[base-stroked-icon-button] | class | string | '' | Extra classes merged via `cn()`. |
[base-stroked-icon-button] | color | IconStrokedButtonColor | 'default' | The semantic visual color. Defaults to 'default'. |
[base-stroked-icon-button] | size | IconStrokedButtonSize | 'default' | The size of the button. Defaults to 'default'. |
Page Content