Skip to content

Commit 0ca2625

Browse files
authored
Add aria_labelledby and aria_describedby properties to button component (#1979)
1 parent 8785b65 commit 0ca2625

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

.changeset/big-feet-live.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cloudfour/patterns': minor
3+
---
4+
5+
Add `aria_labelledby` and `aria_describedby` properties to button component

src/components/button/button.stories.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ You can override the `content_start_icon` value to a different icon.
212212

213213
- `aria_disabled` (string, `'true'`/`'false'`): Sets the button's `aria-disabled` attribute.
214214
- `aria_expanded` (string, `'true'`/`'false'`): Sets the button's `aria-expanded` attribute.
215+
- `aria_labelledby` (string): Sets the button's `aria-labelledby` attribute.
216+
- `aria_describedby` (string): Sets the button's `aria-describedby` attribute.
215217
- `class` (string): Append a class to the root element.
216218
- `content_start_icon` (string): The name of the [icon](/docs/design-icons--page) to render in the `content_start` block.
217219
- `content_end_icon` (string): The name of the [icon](/docs/design-icons--page) to render in the `content_end` block.

src/components/button/button.twig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
{% if aria_expanded %}
2222
aria-expanded="{{ aria_expanded }}"
2323
{% endif %}
24+
{% if aria_labelledby %}
25+
aria-labelledby="{{ aria_labelledby }}"
26+
{% endif %}
27+
{% if aria_describedby %}
28+
aria-describedby="{{ aria_describedby }}"
29+
{% endif %}
2430
{% if tag_name == 'a' %}
2531
href="{{ href|default('#') }}"
2632
{% elseif tag_name == 'button' %}

0 commit comments

Comments
 (0)