Button Component for Zoro

”

We built a large contact sheet of scenarios and tested our new button components against it.

UX Discovery Statement

Project Challenges

A complete refactor of arguably the most important component in any ecommerce store. The button. Language, states, size, color, and development patterns all shape how well this one component gets understood.


What was the strategy, and how did we balance all of it to land on a successful component? Keep reading.

Project Conclusions

On the surface, buttons seem like a simple component. Understand how crucial a part they play in the user journey, though, and building a great button component group turns into real work.

 

What is a Button?

We asked ourselves this question early on, then kept redefining the answer as our UX research went deeper. We had to sharpen it further in the later stages to land on a solid component definition. We landed here: the purpose of our button component is to help users understand what actions are available to them, so they feel confident about what happens next.

 

Project deliverables available for download in the sidebar.

Project Specifics
Challenge #1
Challenge #2
Challenge #3
Challenge

How many button types do we need? What will their relationships to each other look like?

Solution

We reviewed the major action flows through the ecommerce path and CMS content. Three main button types emerged. That lines up with what most other design systems use.

Challenge

How do we make sure our new design system button component will be suitable for 99% of all user flow scenarios?

Solution

We built a large contact sheet of scenarios and tested our new button components against it. From there, we spawned conversations from the results and made small pivots where needed.

Challenge

We have the button types, states, and usage specs. But what about verbiage? There needed to be a guide for that too.

Solution

We’ve done extensive research for UX best practices. These work done here shines through in the final button component definition PDF.

Defining Button Types

We landed on three button types, ranked from most important actions to least important. Three turned out to be the right number. Two would have overlapped in meaning and confused users. Four would have spread that meaning too thin and confused them a different way.

Defining Button HTML Properties

Button properties are well documented, and generally well understood, so this part came easier than the rest of the component work. We researched which properties needed defining and leaned on common UX practices to lock them in.

Defining Button Verbiage

This property didn’t behave like the others. It might have slipped past us entirely without the UX research to flag how much it mattered.

We treated verbiage with the same weight as the UI properties, and set out to find a solid answer for how a button’s copy should read. Leading with a verb, and being specific about what happens after the click, mattered more than we expected going in.

Thinking Through User Flows

We had to be sure we’d covered every angle of how we’d defined the button component. So we took popular user flows and put the button properties to the test against them.

Building a Better Coding Syntax

We moved from old-school CSS to Sass, which gave us shorthand syntax plus variables and functions that transpile into browser-ready CSS.

Those functions kept the DRY fundamentals intact. We wrote the common property patterns once, across every button type and state, and injected variables wherever the patterns varied. That came to about 90 lines of code, where the old CSS approach would have run five times the complexity. It also meant whoever wrote the component styles could hand it off and explain it to the rest of the dev team without a struggle.

// Start Button Helper Mixins (functions)
=button-size($padding, $font-size, $icon-size)
  padding: $padding
  font-size: $font-size
  i.fa
    font-size: $icon-size
=main-buttons($border-color, $background-color, $color)
  border-color: $border-color
  background-color: $background-color
  color: $color
  &:link &:visited
    color: $color
  &:not([disabled])
    &:hover, &:focus
      border-color: $border-color
      background-color: darken($background-color, 5%)
      color: $color
  &:not([disabled])
    &:active, &:active:hover, &:active:focus
      border-color: $border-color
      background-color: darken($background-color, 5%)
      box-shadow: inset 0 0 10px 5px rgba(0, 0, 0, 0.15)
=tertiary-buttons($border-color, $background-color, $color, $inverted)
  border-color: $border-color
  background-color: $white
  background-clip: padding-box
  @if $inverted
    border-color: $color
    background-color: transparent
  color: $color
  &:link &:visited
    color: $color
  &:hover, &:focus
    background-color: $border-color
    color: $background-color
    @if $inverted
      background-color: transparent
      color: $color
      box-shadow: inset 0 0 0 1px $color-silverado
  &:active, &:active:hover, &:active:focus
    border-color: transparent
    background-size: contain
    box-shadow: inset 0 0 0 2px $color
    @if $inverted
      background-color: transparent
// End Button Helper Mixins (functions)
// Start Button Style Selectors
// Button Base
.btn
  display: inline-flex
  align-items: center
  justify-content: center
  padding: 10px 15px
  border-radius: 4px
  font-weight: $font_weight_bold
  &:disabled, &[disabled], &[disabled]:hover
    border-color: $med-gray
    background-color: $light-gray
    color: $med-gray
    cursor: not-allowed
  i.fa
    margin: 0 0 0 10px
    font-size: 18px
  i.fa.fa-shopping-cart, i.fa.fa-lock, i.fa.fa-plus-circle, i.fa.fa-book, i.fa.fa-credit-card
    margin: 0 10px 0 0
// Button Size Variations ($padding, $font-size, $icon-size)
.btn-sm
  +button-size(5px 10px, 12px, 14px)
.btn-lg
  +button-size(15px 30px, 18px, 24px)
  i.fa.fa-shopping-cart, i.fa.fa-lock
    font-size: 24px
// Button Types ($border-color, $background-color, $color, $inverted)
.btn-primary, a.btn-primary
  +main-buttons($orange, $orange, $white) //orange btn
.btn-secondary, a.btn-secondary
  +main-buttons($blue, $blue, $light-gray) //blue btn
.btn-tertiary, a.btn-tertiary
  +tertiary-buttons($blue, $white, $blue, $inverted: false) //white btn
.btn-inverted, a.btn-inverted
  +tertiary-buttons($med-gray, $med-gray, $light-gray, $inverted: true) //invert transparent btn
// End Button Style Selectors

Project deliverables available for download in the sidebar.

The End.

Thanks for reading!
ClientZoro
My RoleUX Project Management, UX Documentation, Mockups, Development
ToolsSketch, Sass, Visual Studio Code
WebsiteZoro.com

Project Overview

A popular ecommerce store needed a well-defined, modern approach to their button component using best UX standards.

Who is Zoro?

Zoro is an established half-billion dollar revenue eCommerce store selling supplies and tools.