Skip to content

Commit 76277b1

Browse files
committed
feat(Stack): add ariaLabel prop to improve accessibility
1 parent 27886c9 commit 76277b1

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

packages/orbit-components/src/Stack/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ The table below contains all types of props available in the Stack component.
4141
| tablet | [`Object`](#media-queries) | | Object for setting up properties for the tablet viewport. [See Media queries](#media-queries) |
4242
| wrap | `boolean` | `false` | If `true`, the Stack will have `flex-wrap` set to `wrap`, otherwise it will be `nowrap`. |
4343
| useMargin | `boolean` | `false` | If `true`, the Stack will be using margins instead of gap |
44+
| ariaLabel | `string` | | Optional prop for setting `aria-label` attribute. |
4445

4546
### Media Queries
4647

packages/orbit-components/src/Stack/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const Stack = (props: Props) => {
4747
tablet,
4848
desktop,
4949
largeDesktop,
50+
ariaLabel,
5051
} = props;
5152

5253
const viewportProps = { mediumMobile, largeMobile, tablet, desktop, largeDesktop };
@@ -177,6 +178,7 @@ const Stack = (props: Props) => {
177178
);
178179
}),
179180
)}
181+
aria-label={ariaLabel}
180182
>
181183
{children}
182184
</ComponentTag>

packages/orbit-components/src/Stack/types.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,5 @@ export interface Props extends CommonProps, Common.Globals {
5252
readonly as?: string;
5353
readonly largeDesktop?: CommonProps;
5454
readonly children: React.ReactNode;
55+
readonly ariaLabel?: string;
5556
}

0 commit comments

Comments
 (0)