Skip to content

Commit a1a2f94

Browse files
avelinelaurkim
authored andcommitted
[Layout] Add ul support to Box (#7803)
### WHY are these changes introduced? Supports #7458 ### WHAT is this pull request doing? `Box` can now be rendered as a `ul` with reset styles
1 parent 3bd2edf commit a1a2f94

File tree

4 files changed

+1396
-1381
lines changed

4 files changed

+1396
-1381
lines changed

.changeset/happy-llamas-doubt.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@shopify/polaris': minor
3+
'polaris.shopify.com': patch
4+
---
5+
6+
Added support for `ul` element on `Box`

polaris-react/src/components/Box/Box.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,11 @@
112112
.visuallyHidden {
113113
@include visually-hidden;
114114
}
115+
116+
.listReset {
117+
list-style-type: none;
118+
margin-block-start: 0;
119+
margin-block-end: 0;
120+
outline: none;
121+
padding-inline-start: 0;
122+
}

polaris-react/src/components/Box/Box.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919

2020
import styles from './Box.scss';
2121

22-
type Element = 'div' | 'span' | 'section';
22+
type Element = 'div' | 'span' | 'section' | 'ul';
2323
type Overflow = 'hidden' | 'scroll';
2424
type Position = 'relative' | 'absolute' | 'fixed' | 'sticky';
2525

@@ -321,6 +321,7 @@ export const Box = forwardRef<HTMLElement, BoxProps>(
321321
const className = classNames(
322322
styles.Box,
323323
visuallyHidden && styles.visuallyHidden,
324+
as === 'ul' && styles.listReset,
324325
);
325326

326327
return createElement(

0 commit comments

Comments
 (0)