2.16.2
Button Component in Bolt
Button is a branded component to convey call to action. Part of the Bolt “Components” CSS framework that powers the Bolt Design System.
npm install @bolt/components-button
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.
Text button: white text with chevron
Currently only have one defined size (though other options can and will be defined in the future)
{% 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) |
---|---|---|---|---|
|
A Drupal-style attributes object with extra attributes to append to this component. |
object
| — |
|
|
Text inside the button. |
string
| — |
|
|
Transforms the button text to various cases. |
string
|
none
|
|
|
Determines the button tag type for semantic buttons |
string
| — |
|
|
Size of the button. |
string
|
medium
|
|
|
Style of the button determined by information hierarchy. |
string
|
primary
|
|
|
Controls the width of the button. |
string
|
auto
|
|
|
Rounds the corners of the button. |
string
|
regular
|
|
|
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
|
|
|
Icon data as expected by the icon component. Accepts an additional position prop that determines placement within the button. |
object
| — |
|
|
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
|
|
|
Use the align parameter instead. |
| — |
|
|
Use the border_radius parameter instead. |
| — |
|
|
Switch to using the new type prop instead. |
string
|
button
|
|