2.12.0

Bolt Button

Button Component in Bolt

Bolt's Component Explorer is being upgraded. It'll return in a future release!

Button is a branded component to convey call to action. Part of the Bolt “Components” CSS framework that powers the Bolt Design System.

Install via NPM
npm install @bolt/components-button

Description

Buttons are the core of our action components. Their affordance is immediate and can be use for most actions and allow users to access the target with a single interaction. Buttons clearly provide a next step for the user.

Our Buttons depend on the theme they are contained in and change in appearance based on said theme. The themes and button colors were designed together to ensure the proper amount affordance and clarity.

Xlight and light themes

Dark and xdark themes

Dos

Don'ts

  {% include "@bolt-components-button/button.twig" with {
  text: "This is a button"
} only %}

Note: when assigning component props as HTML attributes on a web component, make sure to use kebab-case.

Prop Name Description Type Default Value Option(s)
Attributes

A Drupal-style attributes object with extra attributes to append to this component.

object
Text *

Text inside the button.

string
Transform

Transforms the button text to various cases.

string none
  • uppercase, lowercase, capitalize, none
Type

Determines the button tag type for semantic buttons

string
  • button, submit, reset
Size

Size of the button.

string medium
  • xsmall, small, medium, large, xlarge
Style

Style of the button determined by information hierarchy.

string primary
  • primary, secondary, text
Width

Controls the width of the button.

string auto
  • auto, full, full@small
Border_radius

Rounds the corners of the button.

string regular
  • regular or full
Align

Horizontal alignment of items (text and icon) inside the button. Note: the values left and right are deprecated, use start and end instead.

string center
  • start, center, end
Icon

Icon data as expected by the icon component. Accepts an additional position prop that determines placement within the button.

object
    • position

      Where to position the icon within the button

      • before or after
    • attributes

      A Drupal-style attributes object with extra attributes to append to this component.

    • name

      Icon name.

      • academy, add-open, add-solid, agile, app-development, app-exchange, arrow-left, asset-data, asset-infographic, asset-interactive, asset-link, asset-media, asset-podcast, asset-presentation, asset-text, asset-video, bolt-logo-colored, brand-operations, calendar, careers, case-management, chart-bar, check, check-circle, check-solid, chevron-down, chevron-left, chevron-right, chevron-up, close, close-circled, close-open, close-solid, cloud, co-browse, communications, copy-to-clipboard, credit-card, customer-decision-hub, customer-onboarding, customer-service, data-integrations, documentation, download, email, energy, entertainment, exclamation, exit-full-screen, external-link, eye, eye-off, face-happy, face-sad, facebook, facebook-solid, field-service, field-service-gray, filter, financial, full-screen, github, global, government, healthcare, hospitality, industries, info-open, info-solid, insurance, integration, intelligent-virtual-assistant, java, knowledgebase, launchpad, life-sciences, linkedin, linkedin-solid, lock, manufacturing, map-pin, map-pin-solid, marketing, marketing-gray, menu, minus-open, minus-solid, mobility, more, omni-channel, partners, pencil, platform, podcast, print, product, product-delivery, refresh, reporting, retail, robo-auto, sales-automation, scalability, search, share, star-solid, support, system-admin, training, transportation, twitter, twitter-solid, unlock, upload, user, user-interface, video, vision, warning, watch, workforce-intelligence, youtube-solid
    • background

      Background shape. This applies only to 'xlarge' icons.

      • circle or square
    • size

      Icon size.

      • small, medium, large, xlarge
    • color

      Icon color. Currently only support default (black) and teal.

      • teal or blue
IconOnly

Make the button to display only the icon and hide the text (which is still required). You are required to pass both text and icon data for this option to work.

boolean false
ItemAlignment

Use the align parameter instead.

Rounded

Use the border_radius parameter instead.

Tag

Switch to using the new type prop instead.

string button
  • a, link, button, submit, reset