Skip to content
Log in

Button styling reference

On this page

A Button is a standalone action a person can press, labeled with text, an icon, or both. Follow the POS styling API rules when styling it.

Where it appears

Buttons appear on most screens of the POS, including the Pay button in the cart, the buttons on the payment screens, and the buttons in most dialogs. Some older screens still use a button with no parts, and styles written against these parts do not reach them. Items in a nav or menu are not Buttons; they are list buttons.

Parts

Part What it is Available from
button-root The whole button, with the fill and corners. v22.0.4
button-label The text. Not shown on an icon-only button. v22.0.4
button-leading-icon The icon before the text, or the icon of an icon-only button. v22.0.4
button-trailing-icon The icon after the text, such as a chevron. v22.0.4
button-badge The badge pinned to the corner, when the button has one. v22.0.4
button-tooltip The name an icon-only button shows on hover and keyboard focus. v22.0.4
button-loading-indicator What shows in place of the label and icons while the button is loading. v22.0.4

The Available from column shows the first release that carries the name.

Named buttons

Some buttons have a name of their own beside button-root, so you can style one without changing every button. A name can also come first in a selector, to reach a part inside that one button.

Name What it is Available from
cart-checkout-button The button in the cart that opens the full checkout, such as the Pay button. v22.0.4
cart-fast-checkout-button The button in the cart that takes payment in one tap, labeled Charge, when fast checkout is on. v22.0.4

Attributes

Narrow button-root by one of these, inside :where(), to style one kind of button.

Attribute Values Default Available from
data-variant filled, tonal, text tonal v22.0.4
data-tone neutral, primary, critical, success neutral v22.0.4
data-size tiny, small, base, large, xlarge, xxlarge base v22.0.4

Component properties

Set these on button-root to change every button, or on a named button’s part to change one.

Property What it sets Default Available from
--sc-button-bg The button’s fill, in place of the variant’s, such as an action’s configured color. none v22.0.4
--sc-button-color The text and icon color, in place of the variant’s. none v22.0.4
--sc-button-state How strongly the hover and press shading shows, from 0 to 1, such as to light a button while the parent is hovered. none v22.0.4
--sc-button-icon-size The width and height of the icons, in place of the size’s. none v22.0.4
--sc-button-icon-stroke The stroke width of the icons, in place of the size’s. none v22.0.4
--sc-button-icon-color The icons’ color, in place of the text color. none v22.0.4

Examples

Each example is tested against the POS on every change.

“Make the buttons our brand color.” Set the component properties on the whole button:

```css

part~=’button-root’ { –sc-button-bg: #0b5394; –sc-button-color: #ffffff; } ```

“Make the button text bolder.”

```css

[part~=’button-label’] { font-weight: 700; letter-spacing: 0.5px; } ```

“Make the icons a different color from the text.” The icons draw in the text color unless a property says otherwise:

```css

part~=’button-root’ { –sc-button-icon-color: #0b5394; } ```

“Make the icons in filled buttons thinner.” Narrow the whole button by the variant, and set the property there:

```css

–sc-button-icon-stroke: 1.5; } ```

“Make primary buttons darker.” Narrow by the variant as well as the tone. Every kind of button reads --sc-button-bg, so setting it by tone alone would give primary text buttons a fill:

```css

–sc-button-bg: #083b6b; } ```

“Make the icons in large buttons bigger.” Each size has an icon size of its own, and the property replaces all of them unless narrowed by size:

```css

–sc-button-icon-size: 28px; } ```

“Make filled buttons lighter while pressed.” A state goes last, and the property applies in that state only:

```css

–sc-button-bg: #3b7dd8; } ```

“Take the shadow off the badges on buttons.”

```css

[part~=’button-badge’] { box-shadow: none; } ```

“Make the tooltips dark, and the loading indicator our brand color.”

```css

[part~=’button-tooltip’] { background-color: #1f2933; color: #ffffff; }

[part~=’button-loading-indicator’] { color: #0b5394; } ```

“Make the keyboard focus ring thicker.” Keep it visible:

```css

outline-color: #0b5394; outline-style: solid; outline-width: 3px; } ```

“Make only the Pay button green.” Use the button’s name, so other buttons keep their color:

```css

[part~=’cart-checkout-button’] { –sc-button-bg: #1a7f37; } ```

“Make only the Pay button’s text bigger.” Put the name first, then the part inside it:

```css

[part~=’cart-checkout-button’] [part~=’button-label’] { font-size: 18px; } ```

What can’t be styled yet

  • One particular button that has no name of its own.
  • Colors the POS sets on a button for where it sits, which win over yours: the customer button’s colors in the cart, the text color of the buttons on the checkout bar, and the fill of the buttons that expand and collapse cart items.
  • The hover shading of the icon-only button at the end of an order’s item or bundle row, which the POS turns on while the row is hovered and which wins over a --sc-button-state you set.

If you need one of these, raise a support case that names the screen and the button.

Retired

None yet. A part, property, or attribute value is retired before it is removed: it is listed here with what replaces it and the major release that removes it, and it keeps working until that release. See When parts change.

Was this article helpful?

Was this article helpful?