Buttons are one of the most common UI elements. They make it possible for users to interact with a system and take action by making selections. Buttons are used on forms, website homepages, dialog boxes, and toolbars.

Where this element can be seen?

Element is considered as BT-related one, therefore it can be seen across the whole application, for example, Add To Cart (PDP, PLP), Checkout, My Account, CMS pages, etc.

How should this element be designed?

<aside> ➡️ By default, buttons in ScandiPWA have the following types:

Adding additional types is nice, but if they are only used in one place, i.e. in the menu, they can be omitted.

</aside>

<aside> ➡️ Buttons should always have text with 100% line height inside of them.

</aside>

The button should be displayed in the following state:

<aside> ℹ️ Usually, styling this element takes from-to: 4-5h

</aside>

An example display of the button element

An example display of the button element

How the design may look like?

Design example 1

Design example 2


How to develop styles for this element?

In ScandiPWA, buttons are not separate React components. Instead, their styles are defined in scandipwa/src/style/abstract/_button.scss and automatically applied to all button elements, as well as elements with the Button class

<aside> ➡️ The button styles use variables defined in scandipwa/src/style/base/_button.scss – if you only need to change simple attributes like color, borders, and padding, you can simply override this file, instead of the entire button style.

</aside>

When styling buttons, you need to understand that they have different states and variations, so that your code covers all possible cases:

Note that some of the variations above use the BEM methodology to select elements.

<aside> ➡️ The & stands for the parent selector – in this case a selector for the button.

</aside>

How the implementation may look like?

Implementation example #1

Implementation example #2