Button
Button is used to initiate actions on a page or form.
On this page
Description
Use Button for actions (e.g. in forms). Use links for destinations, or moving from one page to another.
Accessibility
Additional markup is required if setting the tag argument to either :a or :summary.
:arequires you to pass in anhrefattribute:summaryrequires you to wrap the component in a<details>element
Arguments
| Name | Default | Description |
|---|---|---|
base_button_class |
| ClassThe button class to render. |
scheme |
| SymbolOne of |
size |
| SymbolOne of |
block |
| BooleanWhether button is full-width with |
align_content |
| SymbolOne of |
tag |
| SymbolOne of |
type |
| SymbolOne of |
disabled |
| BooleanWhether or not the button is disabled. If true, this option forces |
label_wrap |
| BooleanWhether or not the button label text wraps and the button height expands. |
system_arguments | N/A | Hash |
Examples
Slots
leading_visual
Leading visuals appear to the left of the button text.
Use:
-
leading_visual_iconfor a Octicon. -
leading_visual_svgto render a SVG.
| Name | Default | Description |
|---|---|---|
system_arguments | N/A | HashSame arguments as Octicon. |
trailing_visual
Trailing visuals appear to the right of the button text.
Use:
trailing_visual_counterfor a Counter.
| Name | Default | Description |
|---|---|---|
system_arguments | N/A | HashSame arguments as Counter. |
trailing_action
Trailing action appears to the right of the trailing visual.
Use:
trailing_action_iconfor a Octicon.
| Name | Default | Description |
|---|---|---|
system_arguments | N/A | HashSame arguments as Octicon. |
tooltip
Tooltip that appears on mouse hover or keyboard focus over the button. Use tooltips sparingly and as a last resort.
Important: This tooltip defaults to type: :description. In a few scenarios, type: :label may be more appropriate.
Consult the Tooltip documentation for more information.
| Name | Default | Description |
|---|---|---|
type |
| SymbolOne of |
system_arguments | N/A | HashSame arguments as Tooltip. |