|
1 | 1 | --- |
2 | 2 | author: Mark Dumay |
3 | 3 | title: Button |
4 | | -date: 2023-05-21 |
| 4 | +date: 2023-07-30 |
5 | 5 | description: Use the button shortcode to display a button with a hyperlink. |
6 | 6 | layout: docs |
7 | 7 | icon: fa hand-pointer |
@@ -39,9 +39,15 @@ The shortcode supports the following arguments: |
39 | 39 | | toast | No | Optional id of the toast message to display when the button is clicked. | |
40 | 40 | | collapse | No | Optional panel to collapse. Cannot be used together with tooltip. Ignored for active/inactive buttons. | |
41 | 41 | | placement | No | How to position the tooltip: "top" (default), "bottom", "left", or "right". | |
| 42 | +| class | No | Optional class attribute of the button element, e.g. “p-5”. | |
| 43 | +| icon | No | Font Awesome icon class attribute, required unless button title is set. An example value is "fas sort". | |
| 44 | +| order | No | Optional order of the icon, either "first" or "last" (default). | |
| 45 | +| justify | No | Optional justification of the button title and icon, either "start", "end", "center" (default), "between", "around", or "evenly". | |
| 46 | +| cue | No | Optional flag to indicate if an external link should show a visual cue, defaults to setting "main.externalLinks.cue" in the site's parameters. | |
| 47 | +| tab | No | Optional flag to indicate if an external link should open in a new tab, defaults to setting "main.externalLinks.tab" in the site's parameters. | |
42 | 48 | {{< /table >}} |
43 | 49 |
|
44 | | -## Example |
| 50 | +## Examples |
45 | 51 |
|
46 | 52 | ### Statefull buttons |
47 | 53 |
|
@@ -97,6 +103,35 @@ Set the `badge` argument to add a badge to the top right of the button. |
97 | 103 | {{< /example>}} |
98 | 104 | <!-- markdownlint-enable MD037 --> |
99 | 105 |
|
| 106 | +### Buttons with an icon |
| 107 | + |
| 108 | +Set the `icon` argument to add an icon to the button. Use `order` to determine the position of the icon relative to the title. Omit the title to show an icon only. |
| 109 | + |
| 110 | +<!-- markdownlint-disable MD037 --> |
| 111 | +{{< example lang="hugo" >}} |
| 112 | +<div class="hstack gap-3 justify-content-center"> |
| 113 | + {{</* button icon="fab linkedin" cue=false order="first" href="https://linkedin.com" >}}LinkedIn{{< /button */>}}<br> |
| 114 | + {{</* button icon="fab linkedin" cue=false order="last" href="https://linkedin.com" >}}LinkedIn{{< /button */>}}<br> |
| 115 | + {{</* button icon="fab linkedin" href="https://linkedin.com" /*/>}} |
| 116 | +</div> |
| 117 | +{{< /example>}} |
| 118 | +<!-- markdownlint-enable MD037 --> |
| 119 | + |
| 120 | +Use `justify` to adjust the layout of the icon and button title. |
| 121 | + |
| 122 | +<!-- markdownlint-disable MD037 --> |
| 123 | +{{< example lang="hugo" >}} |
| 124 | +<div class="vstack mx-auto w-25"> |
| 125 | + {{</* button icon="fab linkedin" cue=false justify="start" href="https://linkedin.com" >}}LinkedIn{{< /button */>}}<br> |
| 126 | + {{</* button icon="fab linkedin" cue=false justify="end" href="https://linkedin.com" >}}LinkedIn{{< /button */>}}<br> |
| 127 | + {{</* button icon="fab linkedin" cue=false justify="center" href="https://linkedin.com" >}}LinkedIn{{< /button */>}}<br> |
| 128 | + {{</* button icon="fab linkedin" cue=false justify="between" href="https://linkedin.com" >}}LinkedIn{{< /button */>}}<br> |
| 129 | + {{</* button icon="fab linkedin" cue=false justify="around" href="https://linkedin.com" >}}LinkedIn{{< /button */>}}<br> |
| 130 | + {{</* button icon="fab linkedin" cue=false justify="evenly" href="https://linkedin.com" >}}LinkedIn{{< /button */>}}<br> |
| 131 | +</div> |
| 132 | +{{< /example>}} |
| 133 | +<!-- markdownlint-enable MD037 --> |
| 134 | + |
100 | 135 | ### Outlined buttons |
101 | 136 |
|
102 | 137 | Set the `outline` argument to `true` to adjust the style of the button. |
|
0 commit comments