Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/funny-hairs-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': minor
---

Added support for `minHeight` and `minWidth` on `Box`
4 changes: 4 additions & 0 deletions polaris-react/src/components/Box/Box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
--pc-box-border-right: initial;
--pc-box-border-top: initial;
--pc-box-color: initial;
--pc-box-min-height: initial;
--pc-box-min-width: initial;
--pc-box-max-width: initial;
--pc-box-overflow-x: initial;
--pc-box-overflow-y: initial;
Expand All @@ -30,6 +32,8 @@
border-right: var(--pc-box-border-right);
border-top: var(--pc-box-border-top);
color: var(--pc-box-color);
min-height: var(--pc-box-min-height);
min-width: var(--pc-box-min-width);
max-width: var(--pc-box-max-width);
overflow-x: var(--pc-box-overflow-x);
overflow-y: var(--pc-box-overflow-y);
Expand Down
8 changes: 8 additions & 0 deletions polaris-react/src/components/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ export interface BoxProps extends PropsWithChildren {
color?: ColorTokenScale;
/** HTML id attribute */
id?: string;
/** Set minimum height of container */
minHeight?: string;
/** Set minimum width of container */
minWidth?: string;
/** Set maximum width of container */
maxWidth?: string;
/** Clip horizontal content of children */
Expand Down Expand Up @@ -204,6 +208,8 @@ export const Box = forwardRef<HTMLElement, BoxProps>(
children,
color,
id,
minHeight,
minWidth,
maxWidth,
overflowX,
overflowY,
Expand Down Expand Up @@ -269,6 +275,8 @@ export const Box = forwardRef<HTMLElement, BoxProps>(
'--pc-box-border-radius-top-right': borderRadiuses.topRight
? `var(--p-border-radius-${borderRadiuses.topRight})`
: undefined,
'--pc-box-min-height': minHeight ?? undefined,
'--pc-box-min-width': minWidth ?? undefined,
'--pc-box-max-width': maxWidth ?? undefined,
'--pc-box-overflow-x': overflowX ?? undefined,
'--pc-box-overflow-y': overflowY ?? undefined,
Expand Down