diff --git a/ui/components/ui/box/README.mdx b/ui/components/ui/box/README.mdx
index 23b1a76fc..feea786ed 100644
--- a/ui/components/ui/box/README.mdx
+++ b/ui/components/ui/box/README.mdx
@@ -289,3 +289,95 @@ import Box from '../../ui/box';
button
header
```
+
+### Width
+
+Use the `width` prop to pass a singular `BLOCK_SIZES` or for a responsive width pass an array up to 4 `BLOCK_SIZES`
+
+Responsive widths go from smallest to largest screen sizes
+
+Example: [BLOCK_SIZES.HALF, BLOCK_SIZES.THREE_FOURTHS, BLOCK_SIZES.ONE_FIFTH, BLOCK_SIZES.THREE_SIXTHS]
+
+- BLOCK_SIZES.HALF is the default width for `base screen size (0px)` and up
+- BLOCK_SIZES.THREE_FOURTHS is the width for `small screen size (576px) ` and up
+- BLOCK_SIZES.ONE_FIFTH is the width for `medium screen size (768px)` and up
+- BLOCK_SIZES.THREE_SIXTHS is the width for `large screen size (1280px)` and up
+
+
+
+```jsx
+import {
+ BLOCK_SIZES,
+ DISPLAY,
+ FLEX_WRAP,
+} from '../../../helpers/constants/design-system';
+import Box from '../../ui/box';
+
+<>
+
Static widths
+
+
+ BLOCK_SIZES.FULL
+ BLOCK_SIZES.HALF
+ BLOCK_SIZES.HALF
+ BLOCK_SIZES.ONE_THIRD
+ BLOCK_SIZES.ONE_THIRD
+ BLOCK_SIZES.ONE_THIRD
+ BLOCK_SIZES.ONE_FOURTH
+ BLOCK_SIZES.ONE_FOURTH
+ BLOCK_SIZES.ONE_FOURTH
+ BLOCK_SIZES.ONE_FOURTH
+
+
+ Responsive widths
+
+
+
+ BLOCK_SIZES.FULL, BLOCK_SIZES.HALF, BLOCK_SIZES.ONE_THIRD,
+ BLOCK_SIZES.ONE_FOURTH,
+
+
+ BLOCK_SIZES.FULL, BLOCK_SIZES.HALF, BLOCK_SIZES.ONE_THIRD,
+ BLOCK_SIZES.ONE_FOURTH,
+
+
+ BLOCK_SIZES.FULL, BLOCK_SIZES.HALF, BLOCK_SIZES.ONE_THIRD,
+ BLOCK_SIZES.ONE_FOURTH,
+
+
+ BLOCK_SIZES.FULL, BLOCK_SIZES.HALF, BLOCK_SIZES.ONE_THIRD,
+ BLOCK_SIZES.ONE_FOURTH,
+
+
+>;
+```
diff --git a/ui/components/ui/box/box.scss b/ui/components/ui/box/box.scss
index fead9a9ed..dec3792ac 100644
--- a/ui/components/ui/box/box.scss
+++ b/ui/components/ui/box/box.scss
@@ -230,26 +230,11 @@ $attributesToApplyExtraProperties: margin;
&--width-full {
width: 100%;
}
- // breakpoint classes
- @each $breakpoint, $min-width in $screen-sizes-map {
- @media screen and (min-width: $min-width) {
- &--#{$breakpoint}\:width-full {
- width: 100%;
- }
- }
- }
+
&--height-full {
height: 100%;
}
- // breakpoint classes
- @each $breakpoint, $min-width in $screen-sizes-map {
- @media screen and (min-width: $min-width) {
- &--#{$breakpoint}\:height-full {
- height: 100%;
- }
- }
- }
@each $fraction, $value in design-system.$fractions {
&--width-#{$fraction} {
@@ -274,6 +259,24 @@ $attributesToApplyExtraProperties: margin;
}
}
+ // breakpoint classes
+ @each $breakpoint, $min-width in $screen-sizes-map {
+ @media screen and (min-width: $min-width) {
+ &--#{$breakpoint}\:width-full {
+ width: 100%;
+ }
+ }
+ }
+
+ // breakpoint classes
+ @each $breakpoint, $min-width in $screen-sizes-map {
+ @media screen and (min-width: $min-width) {
+ &--#{$breakpoint}\:height-full {
+ height: 100%;
+ }
+ }
+ }
+
&--height-screen {
height: 100vh;
}
diff --git a/ui/components/ui/box/box.stories.js b/ui/components/ui/box/box.stories.js
index 06b015f33..da5ccfd2c 100644
--- a/ui/components/ui/box/box.stories.js
+++ b/ui/components/ui/box/box.stories.js
@@ -67,7 +67,7 @@ export default {
},
width: {
options: Object.values(BLOCK_SIZES),
- control: 'select',
+ control: 'multi-select',
table: { category: 'display' },
},
height: {
@@ -712,3 +712,275 @@ export const As = (args) => {
>
);
};
+
+export const Width = (args) => {
+ const getColumns = () => {
+ const content = [];
+ for (let i = 0; i < 12; i++) {
+ content.push(
+ ,
+ );
+ }
+ return content;
+ };
+
+ return (
+ <>
+
+ Working demo
+
+
+
+ {args.width.map((item, i) => {
+ return `${item} ${args.width.length === i + 1 ? '' : ', '}`;
+ })}
+
+
+
+ Static widths
+
+
+ {getColumns()}
+
+
+
+ BLOCK_SIZES.FULL
+
+
+ BLOCK_SIZES.HALF
+
+
+ BLOCK_SIZES.HALF
+
+
+ BLOCK_SIZES.ONE_THIRD
+
+
+ BLOCK_SIZES.ONE_THIRD
+
+
+ BLOCK_SIZES.ONE_THIRD
+
+
+ BLOCK_SIZES.ONE_FOURTH
+
+
+ BLOCK_SIZES.ONE_FOURTH
+
+
+ BLOCK_SIZES.ONE_FOURTH
+
+
+ BLOCK_SIZES.ONE_FOURTH
+
+
+
+
+ Responsive widths
+
+
+ {getColumns()}
+
+
+
+ BLOCK_SIZES.FULL, BLOCK_SIZES.HALF, BLOCK_SIZES.ONE_THIRD,
+ BLOCK_SIZES.ONE_FOURTH,
+
+
+ BLOCK_SIZES.FULL, BLOCK_SIZES.HALF, BLOCK_SIZES.ONE_THIRD,
+ BLOCK_SIZES.ONE_FOURTH,
+
+
+ BLOCK_SIZES.FULL, BLOCK_SIZES.HALF, BLOCK_SIZES.ONE_THIRD,
+ BLOCK_SIZES.ONE_FOURTH,
+
+
+ BLOCK_SIZES.FULL, BLOCK_SIZES.HALF, BLOCK_SIZES.ONE_THIRD,
+ BLOCK_SIZES.ONE_FOURTH,
+
+
+
+ >
+ );
+};
+
+Width.args = {
+ width: [
+ BLOCK_SIZES.HALF,
+ BLOCK_SIZES.ONE_FIFTH,
+ BLOCK_SIZES.THREE_FOURTHS,
+ BLOCK_SIZES.ONE_FOURTH,
+ ],
+};