← Back to all components

Figma Button

Custom button component based on Figma design system. Features primary, secondary, and tertiary variants with exact color matching.

View in Figma →

Live Preview

Button • Interactive Explorer

Explore all button variants with live preview, code generation, and accessibility information

Button Type

Size

Background

Inspect Mode

Show design specs

primary⭐ Most used
♿ Accessibility Spec
Contrast Ratio:7.5:1 AAA
✓ Passes WCAG AAA: Excellent contrast. Optimal for all users and conditions.
<FigmaButton
  type="primary"
  size="regular"
  state="default"
  background="light"
  onClick={handleClick}
  disabled={false}
>
  Primary Button
</FigmaButton>

Design Tokens

Complete design token definitions for all button variants. Export and integrate these tokens into your design system.

{
  "primary": {
    "light": {
      "default": {
        "background": "#C94F1A",
        "text": "#FFFFFF",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "hover": {
        "background": "#D76F33",
        "text": "#FFFFFF",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "focus": {
        "background": "#D76F33",
        "text": "#FFFFFF",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "outline": "2px solid #141217",
        "outlineOffset": "2px"
      },
      "disabled": {
        "background": "#EAEAEA",
        "text": "#858585",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "cursor": "not-allowed"
      }
    },
    "dark": {
      "default": {
        "background": "#C94F1A",
        "text": "#FFFFFF",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "hover": {
        "background": "#D76F33",
        "text": "#FFFFFF",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "focus": {
        "background": "#D76F33",
        "text": "#FFFFFF",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "outline": "2px solid #FFFFFF",
        "outlineOffset": "2px"
      },
      "disabled": {
        "background": "#4A4A4A",
        "text": "#808080",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "cursor": "not-allowed"
      }
    }
  },
  "secondary": {
    "light": {
      "default": {
        "background": "transparent",
        "text": "#141217",
        "border": "1px solid #828488",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "hover": {
        "background": "#F2F2F2",
        "text": "#141217",
        "border": "1px solid #828488",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "focus": {
        "background": "#F2F2F2",
        "text": "#141217",
        "border": "1px solid #141217",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "outline": "2px solid #141217",
        "outlineOffset": "2px"
      },
      "disabled": {
        "background": "#E5E5E5",
        "text": "#858585",
        "border": "1px solid #969696",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "cursor": "not-allowed"
      }
    },
    "dark": {
      "default": {
        "background": "transparent",
        "text": "#FFFFFF",
        "border": "1px solid #666666",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "hover": {
        "background": "#333333",
        "text": "#FFFFFF",
        "border": "1px solid #666666",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "focus": {
        "background": "#333333",
        "text": "#FFFFFF",
        "border": "1px solid #FFFFFF",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "outline": "2px solid #FFFFFF",
        "outlineOffset": "2px"
      },
      "disabled": {
        "background": "#2A2A2A",
        "text": "#555555",
        "border": "1px solid #444444",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "cursor": "not-allowed"
      }
    }
  },
  "tertiary": {
    "light": {
      "default": {
        "background": "transparent",
        "text": "#C34400",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "hover": {
        "background": "#F2F2F2",
        "text": "#C34400",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "focus": {
        "background": "#F2F2F2",
        "text": "#C34400",
        "border": "1px solid #141217",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "outline": "2px solid #141217",
        "outlineOffset": "2px"
      },
      "disabled": {
        "background": "transparent",
        "text": "#858585",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "cursor": "not-allowed"
      }
    },
    "dark": {
      "default": {
        "background": "transparent",
        "text": "#FF9D6A",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "hover": {
        "background": "#333333",
        "text": "#FF9D6A",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px"
      },
      "focus": {
        "background": "#333333",
        "text": "#FF9D6A",
        "border": "1px solid #FFFFFF",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "outline": "2px solid #FFFFFF",
        "outlineOffset": "2px"
      },
      "disabled": {
        "background": "transparent",
        "text": "#555555",
        "border": "none",
        "padding": "16px 8px",
        "fontSize": "14px",
        "height": "30px",
        "borderRadius": "2px",
        "cursor": "not-allowed"
      }
    }
  },
  "sizes": {
    "small": {
      "padding": "12px 6px",
      "fontSize": "12px",
      "height": "24px"
    },
    "regular": {
      "padding": "16px 8px",
      "fontSize": "14px",
      "height": "30px"
    },
    "large": {
      "padding": "20px 10px",
      "fontSize": "18px",
      "height": "40px"
    }
  }
}

Color Semantics & Usage

PRIMARY
Meaning:

Primary action, positive emphasis

Common Uses:
  • • Save
  • • Submit
  • • Create
  • • Confirm
AAA on light background (7.5:1)
SECONDARY
Meaning:

Alternative action, medium emphasis

Common Uses:
  • • Cancel
  • • Close
  • • Skip
  • • Decline
AA on light background (5.2:1)
TERTIARY
Meaning:

Low emphasis, helper text action

Common Uses:
  • • Learn More
  • • Help
  • • Additional Options
AAA on light background (6.8:1)

Button State Flow

Understanding how button states transition based on user interactions. States are visual feedback, not application state.

⚪

Default

Initial state, button is ready

🖱️

Hover

User moves mouse over button

⌨️

Focus

User tabs to button or clicks

🚫

Disabled

Button cannot be interacted with

Mouse Over
Mouse Leave
Tab / Mouse Down
disabled=true
⚪

Default

Visual:

Button appears with default styling

Triggered by:

Page load, button enabled

Interactive:

Yes, button responds to input

🖱️

Hover

Visual:

Button appears with hover styling

Triggered by:

Mouse enters button area

Interactive:

Yes, button responds to input

⌨️

Focus

Visual:

Button appears with focus styling

Triggered by:

Tab key or mouse down

Interactive:

Yes, button responds to input

🚫

Disabled

Visual:

Button appears with disabled styling

Triggered by:

disabled={true} prop

Interactive:

No, user cannot interact

State Rules & Behavior

1.

Focus can appear WITH Hover

If a user tabs to a button while hovering, both hover and focus visual feedback is applied

2.

Disabled blocks all transitions

When disabled=true, hover/focus states are ignored. Button shows disabled styling instead

3.

Focus ring is always visible

Focus state includes a 2px ring around the button for accessibility (helps keyboard users)

4.

Click triggers action immediately

Focus state doesn't guarantee action will trigger. User must press Enter or Space

Implementation Notes

// Button state is controlled by:
// 1. Component state (isLoading, isDisabled)
// 2. User interaction (hover, focus)
// 3. Visual state prop (default, hover, focus, disabled)

const [isDisabled, setIsDisabled] = useState(false);
const [isLoading, setIsLoading] = useState(false);

<FigmaButton
  type="primary"
  size="regular"
  state={isDisabled ? 'disabled' : 'default'}
  disabled={isDisabled}
  onClick={handleClick}
>
  {isLoading ? 'Loading...' : 'Save Changes'}
</FigmaButton>

// CSS handles state transitions automatically:
// :hover → hover state
// :focus-visible → focus state
// :disabled → disabled state

Keyboard Navigation Demo

Test keyboard accessibility. Use Tab to navigate, Enter/Space to activate, Escape to unfocus.

Keyboard Controls
Tab Move to next
Shift+Tab Move to previous
Enter Activate button
Space Activate button
↑ ↓ Navigate buttons
Esc Unfocus
Click below or use Tab to focus the first button, then use keyboard controls:

Keyboard Event Log

Keyboard events will appear here...

✓ What We Do Right

  • • Semantic <button> element
  • • Full keyboard access (Tab, Enter, Space)
  • • Visible focus indicators (2px ring)
  • • Focus management (Shift+Tab works)
  • • ARIA attributes included
  • • Screen reader compatible

⚠️ Accessibility Notes

  • • Focus order: Left to right, top to bottom
  • • Disabled buttons not focusable (best practice)
  • • Focus ring color: High contrast (#141217)
  • • Touch targets: 30px height minimum
  • • Keyboard hints: Tooltip on focus
  • • Screen reader: Announces button state

Keyboard Accessibility Checklist

Real-World Usage Examples

See button patterns in realistic UI contexts. These examples show best practices for sizing, type selection, and grouping.

Form Submission

Standard form with primary submit and secondary cancel buttons

Code Example

Copy this pattern to your project

<form className="space-y-4">
  <input type="text" placeholder="Name" />
  <textarea placeholder="Message" />
  <div className="flex gap-2">
    <FigmaButton type="primary" size="regular">
      Submit
    </FigmaButton>
    <FigmaButton type="secondary" size="regular">
      Cancel
    </FigmaButton>
  </div>
</form>

Best Practices for This Example

✓

Primary button for main action (Submit)

✓

Secondary button for cancel/alternative

✓

Use regular size for web forms

✓

Group related actions horizontally

Touch Target Sizing Guide

WCAG 2.5.5 (Level AAA) recommends minimum 44x44px touch targets. Use this guide to choose the right button size for your use case.

Small (24px)
Height:24px
WCAG Compliance:⚠️ Only with spacing
Best For:
  • • Toolbars
  • • Compact grids
  • • Dense layouts
Requires 6px+ spacing between buttons
Regular (30px)Most used
Height:30px
WCAG Compliance:✓ AA with adequate width
Best For:
  • • Forms
  • • Cards
  • • Standard interfaces
Large (40px)AAA Compliant
Height:40px
WCAG Compliance:✓ Always compliant
Best For:
  • • Mobile CTAs
  • • Primary actions
  • • Prominent buttons

Button Types & Semantics

Each button type serves a specific purpose. Choose based on the action's importance and context.

🎯 Primary
Color:#C94F1A
Purpose:Highest emphasis, main action
Use for:
  • Save, Submit, Create
  • Confirm actions
  • Primary CTAs
✓ AAA Compliance (7.5:1)
📋 Secondary
Color:#828488
Purpose:Medium emphasis, alternative action
Use for:
  • Cancel, Close
  • Skip, Decline
  • Alternative flows
✓ AA Compliance (5.2:1)
ℹ️ Tertiary
Color:#C34400
Purpose:Lowest emphasis, helper action
Use for:
  • Learn More
  • Help, Options
  • Additional actions
✓ AAA Compliance (6.8:1)

Full Variants Matrix

Complete reference of all 72 button combinations (for developers who need comprehensive documentation)

Accessibility

  • ✓ WCAG 2.1 AA Compliant
  • ✓ Keyboard Navigation
  • ✓ Screen Reader Support
  • ✓ Focus Indicators

Version

v1.0.0 - Enhanced Demo

Last updated: 2025-11-30

Variants

primarysecondarytertiary

Code

Source /src/components/design-system/FigmaButton/FigmaButton.demo.tsx