Active theme set to LightDarkLight high contrastDark high contrast and saved in preferences.
Copied to clipboard.
Error submitting your feedback! Please try again.
We’re hiring frontend developers! View open positions.

ButtonReady

Buttons are used for interface actions. Primary style should be used only once per section for main call-to-action, while other styles can appear more frequently.

Edit in CodePen
Open in new window
Edit in CodePen
Open in new window
Edit in CodePen
Open in new window
Edit in CodePen
Open in new window
Edit in CodePen
Open in new window
Edit in CodePen
Open in new window
Edit in CodePen
Open in new window
Edit in CodePen
Open in new window
Edit in CodePen
Open in new window
Edit in CodePen
Open in new window
Edit in CodePen
Open in new window
Edit in CodePen
Open in new window
View RTL
<nord-stack gap="s" direction="horizontal" wrap>
<nord-button href="#">Default</nord-button>
<nord-button href="#" variant="primary">Primary</nord-button>
<nord-button href="#" variant="danger">Danger</nord-button>
<nord-button href="#" variant="dashed">
<nord-icon slot="start" size="s" name="interface-filter"></nord-icon>
Filter
</nord-button>
<nord-button href="#">
<nord-icon size="s" name="interface-menu-small" label="Options"></nord-icon>
</nord-button>
<nord-button href="#" variant="plain">Plain</nord-button>
<nord-button href="#" disabled>Disabled</nord-button>
</nord-stack>

Properties

PropertyAttributeDescriptionTypeDefault
variantvariant

The style variant of the button.

"default" | "primary" | "dashed" | "plain" | "danger" | "switch""default"
typetype

The type of the button.

"button" | "submit" | "reset""submit"
sizesize

The size of the button. This affects font-size and padding.

"s" | "m" | "l""m"
hrefhref

When provided, renders the button as a link, with its href attribute set to the given value.

string | undefinedundefined
downloaddownload

When provided together with a href property, the button will trigger a file download instead of a page visit.

booleanfalse
targettarget

When provided together with a href property, determines where to open the linked URL. The keywords have special meanings for where to load the URL: “_self” means the current browsing context, “_blank” usually a new tab but users can configure browsers this to open a new window instead, “_parent” means the parent browsing context of the current one, but if no parent exists, behaves as _self, and finally “top” means the topmost browsing context.

"_self" | "_blank" | "_parent" | "_top""_self"
expandexpand

Controls whether the button expands to fill the width of its container.

booleanfalse
loadingloading

Controls whether the button is in loading state. Please note that the spinner is hidden from assistive technologies, so you need to make sure to announce the loading state to e.g. screen reader users. We also recommend disabling all user interactions on the button itself while in loading state.

booleanfalse
disableddisabled

Makes the component disabled. This prevents users from being able to interact with the component, and conveys its inactive state to assistive technologies.

booleanfalse
namename

The name of the form component.

string | undefinedundefined
valuevalue

The value of the form component.

string""
form

Gets the form, if any, associated with the form element.

undefined

Slots

Slot nameDescription
Default slotThe button content
startUsed to place content at the start of button text. Typically used for icons.
endUsed to place content at the end of button text. Typically used for icons.

Methods

Method nameParametersDescription
focus(options?: FocusOptions) => voidoptions: An object which controls aspects of the focusing process.
Programmatically move focus to the component.
blur() => voidN/AProgrammatically remove focus from the component.
click() => voidN/AProgrammatically simulates a click on the component.

CSS Properties

CSS Custom Properties provide more fine grain control over component presentation. We advise utilizing existing properties on the component before using these.

PropertyDescriptionDefault
--n-button-border-radius

Controls the rounded corners of the button, using border radius tokens.

var(--n-border-radius-s)
--n-button-gap

Controls the spacing between items within the button, using our spacing tokens.

var(--n-space-s)
--n-button-gradient

Controls the overlayed gradient background on the button.

linear-gradient(to bottom, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.013) 100%))
--n-button-background-color

Controls the background color of the button, using color tokens.

var(--n-color-button)
--n-button-border-color

Controls the border color of the button, using color tokens.

var(--n-color-border-strong)
--n-button-text-align

Controls the text alignment for the text in the button.

center

Usage #

This section includes guidelines for designers and developers about the usage of this component in different contexts.

Do #

  • Only use one primary button per section, as a main call-to-action.
  • Use clear and accurate labels.
  • Use established button colors appropriately. For example, only use a danger button style for an action that’s difficult or impossible to undo.
  • Prioritize the most important actions. Too many buttons will cause confusion.
  • Be consistent with positioning of buttons in the user interface.
  • Use strong, actionable verbs in labels such as “Add”, “Close”, “Cancel”, or “Save”.

Don’t #

  • Don't use a primary button in every row of a table.
  • Don’t use buttons to link to other pages. Use regular link or a plain style instead where necessary.
  • Don’t use buttons for navigation where the link appears within or following a sentence.
  • Don’t use labels such as “Read more”, “Click here” or “More”.

Content guidelines #

Button labels should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they click a button:

View user settings
Click here

When writing button labels, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):

My tasks
My Tasks

Avoid unnecessary words and articles in button labels, such as “the”, “an” or “a”:

Add item
Add an item

Variants #

This section describes the different component variants, their purpose, and when to use each variant.

NamePurpose
defaultDefault style is the most common button variant. Only switch to another variant if you need to adjust the visual weight of the element.
primaryPrimary style is reserved for main call-to-actions. Should be used only once per content area or panel, e.g. for a “Save” action.
dashedDashed style should be used for actions that trigger filtering.
dangerDanger style should be used for actions that delete data or otherwise make it hard to undo the action.
plainUsed for less important or less common actions. Can be also used for linking to other pages.
disabledUsed for actions that aren’t currently available or not available anymore. Also prevents users from being able to interact with the component, and conveys its inactive state to assistive technologies.
switchSwitch style is reserved for the clinic switcher in the top left corner of an application.

Additional considerations #

  • Users of assistive technology expect a button to submit data or do an action. If you need the button to navigate into another view, use the href property which will output <a> tag instead of a <button>.
  • When you need to disable a button, use disabled property as it conveys this information correctly to assistive technologies like screen readers.
  • Button component provides 3 size variants; small, medium and large. The large size should only be used for marketing purposes or on areas such as an empty space/content notice.

Integration

For integration guidelines, please see Web Components documentation. This documentation explains how to implement and use Nord Web Components across different technologies such as Vue.js, React, or Vanilla JavaScript.

Integration Guidelines

Localization

Nord provides a lightweight solution for localizing its components. Not all components need localizing, as for the most part snippets of text are set per instance. For full localization guidelines, please see Localization documentation.

Localization Guidelines

Troubleshooting

If you experience any issues while using Nord Web Components, please head over to the Support page for more guidelines and ways to contact us.


Was this page helpful?

YesNo
Send feedback

We use this feedback to improve our documentation.