Button

Displays a callout for user attention.

Installation

ng g @spartan-ng/cli:ui button

Usage

import { HlmButtonImports } from '@spartan-ng/helm/button';
<button hlmBtn>Button</button>

Cursor

Tailwind v4 switched from cursor: pointer to cursor: default for the button component.
If you want to keep the cursor: pointer behavior, add the following code to your CSS file:

src/styles.css
@layer base {
  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }
}

Examples

Size

Default

Outline

Secondary

Ghost

Destructive

Icon

With Icon

Remember to add the data-icon="inline-start" or data-icon="inline-end" attribute to the icon for the correct spacing.

Rounded

Use the rounded-full class to make the button rounded.

Spinner

Render a hlm-spinner component inside the button to show a loading state. Remember to add the data-icon="inline-start" or data-icon="inline-end" attribute to the spinner for the correct spacing.

As Anchor

RTL

To enable RTL support in spartan-ng, see the RTL configuration guide.

Styles

Brain API

BrnButton

Selector: a[brnButton], button[brnButton]

Inputs

PropTypeDefaultDescription
disabled boolean false -

Helm API

HlmButton

Selector: button[hlmBtn], a[hlmBtn]

ExportAs: hlmBtn

Inputs

PropTypeDefaultDescription
variant ButtonVariants['variant'] this._config.variant -
size ButtonVariants['size'] this._config.size -
Button Group Breadcrumb