Skip to main content
PimentCSS v1.0.1, what's new
Home

Buttons

Primary, outline, and transparent variants with icon slots and touch targets.

Overview

Action buttons live in scss/components/_button.scss. Three variants share one base .btn class: primary (filled action surface), outline (bordered on primary surface), and transparent (text action on muted backgrounds). Pair with Button group for segmented toolbars.

VariantClassTypical use
Primary.btn--primaryMain call to action, one per view when possible
Outline.btn--outlineSecondary actions, cancel beside primary
Transparent.btn--transparentTertiary actions in headers, cards, tables

Prerequisites

Variants and states

Default, hover, focus, and disabled for each variant. Toggle light/dark in the header to verify contrast on primary and outline.

Default
Hover
Focus
Disabled
Primary
Transparent
Outline

Matrix uses .btn--hover and .btn--focus for documentation previews. In your app, rely on :hover and :focus-visible.

Icons in buttons

Place icons in .btn__icon (20px slot). Icons are decorative when visible text is present: set aria-hidden="true" on the icon element. Leading and trailing icons are supported via flex gap. See the Icons guide for library choice, slot sizes, and SVG patterns.

Icon-only

Square touch target via .btn--icon-only (min 44×44px). Always provide aria-label; never rely on the icon alone.

For navigation that looks like a button, use <a class="btn btn--primary"> with a real href. Do not use <button> for in-page navigation. For text links, see Links & breadcrumb.

In context

Primary + outline pairs work well in cards and forms. Keep one primary action per panel.

Newsletter

Semantic action colors from --surface-action and --text-on-action.

Class reference

ClassDescription
.btnBase: flex, typography, min-height, transitions
.btn--primaryFilled action (--surface-action)
.btn--outlineBordered on --surface-primary
.btn--transparentTransparent background, action text color
.btn--icon-onlySquare icon-only (44px min)
.btn__iconIcon slot (1.25rem)
.btn--hover / .btn--focusDoc preview modifiers only
.focus-visibleSimulates focus ring in docs

Customize (Sass)

  1. Override button tokens

    Adjust height, padding, and radius. Keep $btn-min-height at or above 2.75rem (44px) for touch targets.
    @use "pimentcss-design-system" with (
      $btn-min-height: 2.75rem,
      $btn-padding-x: 1.25rem,
      $btn-border-radius: 0.5rem,
      $surface-action: var(--primary-600),
    );
  2. Rebuild CSS

    Regenerate your theme CSS after variable changes.
    npm run build:css

See Customization for partial imports and semantic token overrides.

Accessibility (RGAA / WCAG)

Button checklist

  • Native control, prefer <button type="button"> for actions; use <a class="btn"> only for navigation.
  • Accessible name, visible text or aria-label on icon-only buttons.
  • Disabled, use disabled or aria-disabled="true"; do not rely on color alone.
  • Focus, never remove :focus-visible; ring uses --focus-ring (3px).
  • Contrast, primary text on --surface-action ≥ 4.5:1 in light and dark (Colors).

Next steps