--- 
title: Button
description: Buttons with variants (primary, secondary, tertiary, danger, cta)
category: components
a1Full: true
group: Actions

module: NxButtonModule
components:
  - name: NxButtonComponent
    selector: button[nxButton], a[nxButton]
  - name: NxIconButtonComponent
    selector: button[nxIconButton], a[nxIconButton]
  - name: NxPlainButtonComponent
    selector: button[nxPlainButton], a[nxPlainButton]
    inputs:
      - name: size
        desc: "The plain button size. Please only use it for the A1 Design."
        default: input<NxPlainButtonSize>('medium')
        type: "InputSignal<'medium' | 'small' | 's' | 'm'>"
      - name: variant
        desc: "The plain button variant. Please only use it for the A1 Design."
        default: input<NxPlainButtonVariant>('primary')
        type: "InputSignal<'primary' | 'secondary'>"
      - name: colorSchemeInput
        desc: "The plain button color scheme. Please only use it for the A1 Design.  When not set, an `accent-attention` surface resolves it to `on-accent-attention` (see `nxSurface`). The `attention` surface goes through `inverse` instead, since `on-brand` pairs with a brand-colored background."
        default: input<NxPlainButtonColorScheme | undefined>(undefined, {
      alias: 'colorScheme',
    })
        type: "InputSignal<'default' | 'on-accent-attention' | 'on-brand' | undefined>"
      - name: critical
        desc: "Whether to show the critical/danger appearance"
        default: input<boolean, BooleanInput>(false, {
      transform: booleanAttribute,
    })
        type: "InputSignalWithTransform<boolean, BooleanInput>"
      - name: disabled
        desc: "Whether the button should be disabled."
        default: input<boolean, BooleanInput>(false, {
      transform: booleanAttribute,
    })
        type: "InputSignalWithTransform<boolean, BooleanInput>"
      - name: inverseInput
        desc: "Whether the button should use the inverse color (for use on dark/colored backgrounds). When not set, it follows the surface (see `nxSurface`)."
        default: input<boolean | undefined, unknown>(undefined, {
      transform: nxOptionalBooleanAttribute,
      alias: 'inverse',
    })
        type: "InputSignalWithTransform<boolean | undefined, unknown>"
      - name: tabIndex
        default: input<number | undefined, NumberInput>(undefined, { transform: tabIndexAttribute })
        type: "InputSignalWithTransform<number | undefined, NumberInput>"
      - name: _tabindexAttribute
        desc: "Use 'tabindex' to handle existing usages of `[tabindex]` bindings on button elements"
        default: input<number | undefined, NumberInput>(undefined, {
      transform: tabIndexAttribute,
      alias: 'tabindex',
    })
        type: "InputSignalWithTransform<number | undefined, NumberInput>"
      - name: loading
        desc: "Whether the button should be in a loading state."
        default: input<boolean, BooleanInput>(false, { transform: booleanAttribute })
        type: "InputSignalWithTransform<boolean, BooleanInput>"
      - name: classNames
        default: input<string | undefined>(undefined, { alias: 'nxPlainButton' })
        type: "InputSignal<string | undefined>"
    methods:
      - name: setTriggerActive
        params: 
        returnType: void
      - name: setTriggerInactive
        params: 
        returnType: void

---
# Overview
<div class="docs-a1">

<!-- example(button-a1-showcase, { "hideHeader": true }) -->

</div>

Buttons are used to make common actions immediately visible and easy to perform. This component allows users to trigger an action – either by clicking on or tapping the button, or by pressing certain keyboard keys (such as Enter or the space bar). Depending on the use case, buttons contain a label and/or an icon. There are multiple styles, sizes, and variations that can be used for different situations. We attach buttons through a directive so that we can rely on the native abilities of a real **`<button>`** tag.

We work with five different types of buttons. The primary's heavy appearance is intended to direct the user to take a suggested primary action; the secondary's lighter design best works to compliment a primary action or to reduce visual noise if there are several hierarchically equal actions on the same page. Emphasis, call-to-action and disabled should be self-explanatory.
