Skip to content

Commit 489f96a

Browse files
committed
Add printHidden prop to Box
1 parent 8b31e39 commit 489f96a

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

.changeset/fresh-eyes-compete.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': minor
3+
---
4+
5+
Added `printHidden` prop to `Box`

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,10 @@
139139
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
140140
@include visually-hidden;
141141
}
142+
143+
.printHidden {
144+
@media print {
145+
// stylelint-disable-next-line declaration-no-important -- generated by polaris-migrator DO NOT COPY
146+
display: none !important;
147+
}
148+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ export interface BoxProps extends React.AriaAttributes {
174174
insetInlineEnd?: Spacing;
175175
/** Opacity of box */
176176
opacity?: string;
177+
/** Visually hide the contents during print */
178+
printHidden?: boolean;
177179
/** Visually hide the contents (still announced by screenreader) */
178180
visuallyHidden?: boolean;
179181
/** z-index of box */
@@ -217,6 +219,7 @@ export const Box = forwardRef<HTMLElement, BoxProps>(
217219
shadow,
218220
tabIndex,
219221
width,
222+
printHidden,
220223
visuallyHidden,
221224
position,
222225
insetBlockStart,
@@ -326,6 +329,7 @@ export const Box = forwardRef<HTMLElement, BoxProps>(
326329
const className = classNames(
327330
styles.Box,
328331
visuallyHidden && styles.visuallyHidden,
332+
printHidden && styles.printHidden,
329333
as === 'ul' && styles.listReset,
330334
);
331335

0 commit comments

Comments
 (0)