Free
Pro

Button

A Ply button is a Tailwind-styled directive you copy in with npx ply-ui-cli add button. Put ply-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 ply-progress-button for a loading state.

When to use

  • Primary and secondary actions on forms, dialogs, and toolbars.
  • When you want a native button element with Ply colors and sizes, not a custom element.
  • Loading submits — pair with ply-progress-button so the width stays stable.

When not to use

  • Navigation that should be a link — use ply-link or routerLink on an anchor.
  • A row of related toggles — use button-group or a checkbox/toggle instead.

Install with npx ply-ui-cli add button.

free

Playground

Playground

Color
Size

HTML

<button ply-button color="primary" size="default" [disabled]="false">Button</button>

Default Button

Add ply-button to the <button>. Default button example below.

Button Color

Use color="" attribute to define button color. Supported colors are "primary", "success", "danger", "warning", "accent", "white" and "black"

Button Disabled

Use disabled to disable button.

Button Loading

Loading lives on ply-progress-button, not ply-button. The label fades while a spinner keeps the width stable. Pair with disabled when the action cannot be retried.

Button with Icon

Add preferred icon in front or back of the content of the button.

Button with Badge

Add a <ply-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.

Stroked Button

Use modifier ply-button-stroked and color="" attribute to define button color. Supported colors are "primary", "success", "danger", "warning", "accent", "white" and "black"

Button Size

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.

Icon Button

Add ply-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"

Icon Stroked Button

Add ply-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"

Icon Button Sizes

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.

Keyboard & accessibility

Role
Native button. Disabled controls are not in the tab order.
Focus
Focus follows DOM order. Loading uses aria-busy on ply-progress-button and blocks activation.

Shortcuts

  • TabMove focus to the next control
  • EnterActivate the focused button
  • SpaceActivate the focused button

Site-wide VPAT-style notes live on the accessibility report.

Installation

Run the following command to add this component to your project:

bash

npx ply-ui-cli add button

API Reference

For AI agents

Copy a prompt with the registry name, CLI install, and import — or add the Ply MCP server.

bash

npx -y ply-ui-mcp

Ply provides standalone components. Import the exact elements you want to use into your component.

typescript (Example)

// Install: npx ply-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 reference for button
APIMemberTypeDefaultDescription
[ply-button]classstring''Extra classes merged via `cn()`.
[ply-button]colorButtonColor'default'The semantic visual color. Defaults to 'default'.
[ply-button]sizeButtonSize'default'The size of the button. Defaults to 'default'.
[ply-button]widthstringOptional custom width (e.g. '100%').
[ply-icon-button]classstring''Extra classes merged via `cn()`.
[ply-icon-button]colorIconButtonColor'default'The semantic visual color. Defaults to 'default'.
[ply-icon-button]sizeIconButtonSize'default'The size of the button. Defaults to 'default'.
[ply-link]colorLinkColor'default'The semantic visual color. Defaults to 'default'.
[ply-link]sizeLinkSize'default'The size of the link. Defaults to 'default'.
[ply-link]widthstringOptional custom width (e.g. '100%').
[ply-stroked-button]classstring''Extra classes merged via `cn()`.
[ply-stroked-button]colorStrokedButtonColor'default'The semantic visual color. Defaults to 'default'.
[ply-stroked-button]sizeStrokedButtonSize'default'The size of the button. Defaults to 'default'.
[ply-stroked-button]widthstringOptional custom width (e.g. '100%').
[ply-stroked-icon-button]classstring''Extra classes merged via `cn()`.
[ply-stroked-icon-button]colorIconStrokedButtonColor'default'The semantic visual color. Defaults to 'default'.
[ply-stroked-icon-button]sizeIconStrokedButtonSize'default'The size of the button. Defaults to 'default'.