Skip to content

Commit c820763

Browse files
nayeobkimavelinechazdeanlaurkim
authored
[Layout foundations] Update layout component docs and guidance (#8379)
### WHY are these changes introduced? Resolves #8315. Updates layout component documentation and guidance in preparation for marking them beta in v11. ### WHAT is this pull request doing? Updates `AlphaCard`, `AlphaStack`, `Inline`, `Bleed`, `Columns`, and `Box` documentation. ### How to 🎩 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [x] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [x] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide --------- Co-authored-by: aveline <[email protected]> Co-authored-by: Chaz Dean <[email protected]> Co-authored-by: Lo Kim <[email protected]>
1 parent 3526fc2 commit c820763

File tree

50 files changed

+248
-501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+248
-501
lines changed

.changeset/popular-coins-occur.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'polaris.shopify.com': patch
3+
---
4+
5+
Updated documentation and guidance for `AlphaCard`, `AlphaStack`, `Box`, `Bleed`, `Columns`, and `Inline`

polaris.shopify.com/content/components/deprecated/card.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,55 +26,55 @@ status:
2626
Card was built prior to layout primitives like box, inline, and alpha stack.
2727
The new layout primitives can be used in combination to achieve similar results to card, or the existing legacy card.
2828
examples:
29-
- fileName: card-default.tsx
29+
- fileName: deprecated-card-default.tsx
3030
title: Default
3131
description: Use when you have a simple message to communicate to merchants that doesn’t require any secondary steps.
32-
- fileName: card-with-header-actions.tsx
32+
- fileName: deprecated-card-with-header-actions.tsx
3333
title: With header actions
3434
description: Use for less important card actions, or actions merchants may do before reviewing the contents of the card. For example, merchants may want to add items to a card containing a long list, or enter a customer’s new address.
35-
- fileName: card-with-footer-actions.tsx
35+
- fileName: deprecated-card-with-footer-actions.tsx
3636
title: With footer actions
3737
description: Use footer actions for a card’s most important actions, or actions merchants should do after reviewing the contents of the card. For example, merchants should review the contents of a shipment before an important action like adding tracking information. Footer actions can be left or right aligned with the `footerActionAlignment` prop.
38-
- fileName: card-with-multiple-footer-actions.tsx
38+
- fileName: deprecated-card-with-multiple-footer-actions.tsx
3939
title: With multiple footer actions
4040
description: When multiple secondary footer actions are provided, they will render in an action list popover activated by a disclosure button. The disclosure button text can be customized with the `secondaryFooterActionsDisclosureText` prop.
41-
- fileName: card-with-custom-footer-actions.tsx
41+
- fileName: deprecated-card-with-custom-footer-actions.tsx
4242
title: With custom footer actions
4343
description: Use to present actionable content that is optional or not the primary purpose of the page.
44-
- fileName: card-with-destructive-footer-action.tsx
44+
- fileName: deprecated-card-with-destructive-footer-action.tsx
4545
title: With destructive footer action
4646
description: Use when a card action will delete merchant data or be otherwise difficult to recover from.
47-
- fileName: card-with-multiple-sections.tsx
47+
- fileName: deprecated-card-with-multiple-sections.tsx
4848
title: With multiple sections
4949
description: Use when you have two related but distinct pieces of information to communicate to merchants. Multiple sections can help break up complicated concepts to make them easier to scan and understand.
50-
- fileName: card-with-multiple-titled-sections.tsx
50+
- fileName: deprecated-card-with-multiple-titled-sections.tsx
5151
title: With multiple titled sections
5252
description: Use when you have two related but distinct pieces of information to communicate to merchants that are complex enough to require a title to introduce them.
53-
- fileName: card-with-sections-and-actions.tsx
53+
- fileName: deprecated-card-with-sections-and-actions.tsx
5454
title: With sections and actions
5555
description: Use when your card section has actions that apply only to that section.
56-
- fileName: card-with-subsection.tsx
56+
- fileName: deprecated-card-with-subsection.tsx
5757
title: With subsection
5858
description: Use when your card sections need further categorization.
59-
- fileName: card-with-destructive-action.tsx
59+
- fileName: deprecated-card-with-destructive-action.tsx
6060
title: With destructive action
6161
description: Use when a card action applies only to one section and will delete merchant data or be otherwise difficult to recover from.
62-
- fileName: card-with-a-subdued-section.tsx
62+
- fileName: deprecated-card-with-a-subdued-section.tsx
6363
title: With a subdued section
6464
description: Use to indicate when one of the sections in your card contains inactive or disabled content.
65-
- fileName: card-with-subdued-for-secondary-content.tsx
65+
- fileName: deprecated-card-with-subdued-for-secondary-content.tsx
6666
title: With subdued for secondary content
6767
description: Use for content that you want to deprioritize. Subdued cards don’t stand out as much as cards with white backgrounds so don’t use them for information or actions that are critical to merchants.
68-
- fileName: card-with-separate-header.tsx
68+
- fileName: deprecated-card-with-separate-header.tsx
6969
title: With separate header
7070
description: Use to be able to use custom React elements as header content.
71-
- fileName: card-with-custom-react-node-title.tsx
71+
- fileName: deprecated-card-with-custom-react-node-title.tsx
7272
title: With custom React Node title
7373
description: Use to render custom content such as icons, links, or buttons in a card section’s header.
74-
- fileName: card-with-all-elements.tsx
74+
- fileName: deprecated-card-with-all-elements.tsx
7575
title: With all elements
7676
description: Use as a broad example that includes most props available to card.
77-
- fileName: card-with-flushed-sections.tsx
77+
- fileName: deprecated-card-with-flushed-sections.tsx
7878
title: With flushed sections
7979
description: Use when you need further control over the spacing of your card sections.
8080
---

polaris.shopify.com/content/components/layout-and-structure/alpha-card.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: Cards are used to group similar concepts and tasks together for mer
44
category: Layout and structure
55
keywords:
66
- layout
7+
- card
8+
- responsive
79
- container
810
- box
911
- grid
@@ -26,18 +28,20 @@ status:
2628
examples:
2729
- fileName: alpha-card-default.tsx
2830
title: Default
31+
description: >-
32+
By default, cards have an 8px border radius and uses `--p-surface` as the background and `--p-shadow-card` as the shadow. There is padding of `space-5` (20px) around children and `space-4` (16px) for small screens.
2933
- fileName: alpha-card-with-subdued-background.tsx
3034
title: With subdued background
3135
description: >-
3236
Use for content that you want to deprioritize. Subdued cards don’t stand out as much as cards with white backgrounds so don’t use them for information or actions that are critical to merchants.
3337
- fileName: alpha-card-with-varying-padding.tsx
3438
title: With varying padding
3539
description: >-
36-
Use the `padding` property to adjust the spacing within a card. You can also specify spacing values at different breakpoints.
40+
Use the `padding` property to adjust the spacing of content within a card. The `padding` prop supports responsive spacing with the [Breakpoints tokens](https://polaris.shopify.com/tokens/breakpoints).
3741
- fileName: alpha-card-with-rounded-corners.tsx
3842
title: Rounded corners
3943
description: >-
40-
Cards have an 8px border radius by default. Rounding may also be applied responsively with the roundedAbove prop. This enables cards to be softened on larger screens, but squared off when they are full bleed on smaller devices.
44+
Cards can have a border radius applied responsively with the `roundedAbove` prop.
4145
---
4246

4347
## Best practices
@@ -50,3 +54,9 @@ Cards should:
5054
- Stick to single user flows or break more complicated flows into multiple sections
5155
- Avoid too many call-to-action buttons or links and only one primary call to action per card
5256
- Use calls to action on the bottom of the card for next steps and use the space in the upper right corner of the card for persistent, optional actions (such as Edit)
57+
58+
---
59+
60+
## Related components
61+
62+
- For more flexibility on styling, [use the Box component](https://polaris.shopify.com/components/layout-and-structure/box)

polaris.shopify.com/content/components/layout-and-structure/alpha-stack.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
---
22
title: Alpha stack
3-
description: Use to display elements vertically with items placed directly below the preceding item.
3+
description: Use to display children vertically with full width by default. Based on CSS Flexbox.
44
category: Layout and structure
55
keywords:
66
- layout
7+
- stack spacing
8+
- vertical centering
9+
- fill available space
10+
- fill space
11+
- equal width
12+
- right-aligned stack
13+
- stack layout
714
status:
815
value: Alpha
916
message: This component is a work in progress and ready for exploratory usage, with breaking changes expected in minor version updates. Please use with caution. Learn more about our [component lifecycles](/getting-started/components-lifecycle).
1017
examples:
11-
- fileName: alpha-stack-default.tsx
12-
title: Default
13-
description: >-
14-
By default, stack is left aligned and stacked items are spaced with 16px in between.
1518
- fileName: alpha-stack-with-gap.tsx
1619
title: Gap
1720
description: >-
18-
Gaps between stack children can be adjusted using the Space token.
19-
- fileName: alpha-stack-with-full-width-children.tsx
20-
title: Full width
21-
description: >-
22-
Use a boolean to make Stack full width.
21+
Control the vertical space between children using the `gap` prop.
2322
- fileName: alpha-stack-with-align.tsx
24-
title: Alignment
23+
title: Align
2524
description: >-
26-
Use to horizontally align Stack.
25+
Control the horizontal alignment of children using the `align` prop.
2726
---
2827

2928
## Best practices

polaris.shopify.com/content/components/layout-and-structure/bleed.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,18 @@ status:
88
value: Alpha
99
message: This component is a work in progress and ready for exploratory usage, with breaking changes expected in minor version updates. Please use with caution. Learn more about our [component lifecycles](/getting-started/components-lifecycle).
1010
examples:
11-
- fileName: bleed-vertical.tsx
12-
title: Vertical
13-
description: >-
14-
Content will bleed vertically into the surrounding layout using the vertical prop.
1511
- fileName: bleed-horizontal.tsx
1612
title: Horizontal
1713
description: >-
18-
Content will bleed horizontally into the surrounding layout using the horizontal prop.
14+
Content will bleed horizontally into the surrounding layout using the `marginInline` prop.
15+
- fileName: bleed-vertical.tsx
16+
title: Vertical
17+
description: >-
18+
Content will bleed vertically into the surrounding layout using the `marginBlock` prop.
1919
- fileName: bleed-specific-direction.tsx
2020
title: Specific direction
2121
description: >-
22-
Content will bleed into the surrounding layout in a specific direction using the top, bottom, left, or right prop.
23-
- fileName: bleed-all-directions.tsx
24-
title: All directions
25-
description: >-
26-
Content will bleed into the surrounding layout in all directions using the spacing prop.
22+
Negative margins can be added in a specific direction using the [Spacing tokens](https://polaris.shopify.com/tokens/spacing).
2723
---
2824

2925
## Bleed values

polaris.shopify.com/content/components/layout-and-structure/box.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@ description: Box is the most primitive layout component. It’s a way to access
44
category: Layout and structure
55
keywords:
66
- layout
7+
- box
8+
- responsive
9+
- tokens
710
status:
811
value: Alpha
912
message: This component is a work in progress and ready for exploratory usage, with breaking changes expected in minor version updates. Please use with caution. Learn more about our [component lifecycles](/getting-started/components-lifecycle).
1013
examples:
11-
- fileName: box-default.tsx
12-
title: Default
13-
description: >-
14-
By default, box has no padding, borders, border radius, background, or shadows.
1514
- fileName: box-with-color.tsx
1615
title: Color
1716
description: >-
1817
Background color of box and text color inside a box can be adjusted using the [Color tokens](https://polaris.shopify.com/tokens/colors).
1918
- fileName: box-with-border.tsx
20-
title: Border
19+
title: Border width
2120
description: >-
2221
Border width can be adjusted using the [Shape tokens](https://polaris.shopify.com/tokens/shape), and a subset of tokens allows different types of border.
2322
- fileName: box-with-border-radius.tsx
@@ -27,11 +26,11 @@ examples:
2726
- fileName: box-with-padding.tsx
2827
title: Padding
2928
description: >-
30-
Padding can be added to either all sides, left, right, top, and bottom, using the [Spacing tokens](https://polaris.shopify.com/tokens/spacing).
29+
Padding can be added to either all sides, left, right, top, and bottom, using the [Spacing tokens](https://polaris.shopify.com/tokens/spacing). The `padding` prop supports responsive spacing with the [Breakpoints tokens](https://polaris.shopify.com/tokens/breakpoints).
3130
- fileName: box-with-shadow.tsx
3231
title: Shadow
3332
description: >-
34-
Shadow can be applied using the Shadow token. The base is [--p-shadow-base](https://polaris.shopify.com/tokens/depth).
33+
Shadow can be applied using the [Depth tokens](https://polaris.shopify.com/tokens/depth).
3534
---
3635

3736
## Related components

polaris.shopify.com/content/components/layout-and-structure/columns.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
---
22
title: Columns
3-
description: Displays content horizontally in one or more columns with equal spacing between.
3+
description: Use to lay out children horizontally with equal gap between columns. Based on [CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/grid).
44
category: Layout and structure
55
keywords:
66
- layout
7+
- columns
8+
- grid
9+
- responsive
710
status:
811
value: Alpha
912
message: This component is a work in progress and ready for exploratory usage, with breaking changes expected in minor version updates. Please use with caution. Learn more about our [component lifecycles](/getting-started/components-lifecycle).
1013
examples:
11-
- fileName: columns-default.tsx
12-
title: Default
13-
description: >-
14-
By default, there are 6 columns with 16px spacing between them.
1514
- fileName: columns-with-varying-gap.tsx
1615
title: Gap
1716
description: >-
18-
Use the gap prop to set the amount of space between columns.
17+
Use the `gap` prop to set the amount of space between columns. The `gap` prop supports responsive spacing with the [Breakpoints tokens](https://polaris.shopify.com/tokens/breakpoints).
1918
- fileName: columns-with-fixed-widths.tsx
2019
title: Column width
2120
description: >-
22-
Individual column width can be adjusted.
21+
The `columns` property accepts CSS column shorthand syntax, or an array of strings mapping to common widths in the admin such as `oneThird`, `oneHalf`, and `twoThirds`. For responsive columns, use the same syntax passed into an object with the breakpoints.
2322
- fileName: columns-with-set-number.tsx
2423
title: Number of columns
2524
description: >-
26-
Use the columns prop to set the number and width of columns across breakpoints.
25+
Control the number of columns using the `columns` prop. Column numbers can be responsively set using the [Breakpoints tokens](https://polaris.shopify.com/tokens/breakpoints).
2726
---
2827

2928
## Related components

polaris.shopify.com/content/components/layout-and-structure/divider.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
22
title: Divider
3-
description: Use to separate or group content
3+
description: Use to separate or group content.
44
category: Layout and structure
55
keywords:
66
- layout
7+
- divider
8+
- border
79
status:
810
value: Alpha
911
message: This component is a work in progress and ready for exploratory usage, with breaking changes expected in minor version updates. Please use with caution. Learn more about our [component lifecycles](/getting-started/components-lifecycle).
Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,42 @@
11
---
22
title: Inline
3-
description: Use to arrange items in a horizontal row with equal spacing around them. Items wrap onto multiple lines when needed.
3+
description: Use to display children horizontally in a row. Based on CSS Flexbox.
44
category: Layout and structure
55
keywords:
66
- layout
7+
- inline
8+
- flexbox
9+
- flex
10+
- responsive
11+
- flexible items
12+
- row of components
13+
- rows
14+
- vertical centering
15+
- horizontal row of components
16+
- stack
717
status:
818
value: Alpha
919
message: This component is a work in progress and ready for exploratory usage, with breaking changes expected in minor version updates. Please use with caution. Learn more about our [component lifecycles](/getting-started/components-lifecycle).
1020
examples:
11-
- fileName: inline-default.tsx
12-
title: Default
13-
description: >-
14-
Items are vertically centered with 16px of space around them. They’ll wrap onto multiple lines when needed.
1521
- fileName: inline-with-non-wrapping.tsx
1622
title: Non-wrapping
1723
description: >-
18-
Use to create Inline where the children will not wrap to new rows on small screens.
24+
The default wrapping behavior of children can be overridden using the `wrap` prop.
1925
- fileName: inline-with-gap.tsx
2026
title: Gap
2127
description: >-
22-
Use to control gaps around items in inline in standard increments.
23-
- fileName: inline-with-vertical-alignment.tsx
24-
title: Vertical alignment
28+
Control the horizontal and vertical space between children using the `gap` prop. The `gap` prop supports responsive spacing with the [Breakpoints tokens](https://polaris.shopify.com/tokens/breakpoints).
29+
- fileName: inline-with-block-align.tsx
30+
title: Block align
2531
description: >-
26-
Use to vertically align Inline.
27-
- fileName: inline-with-horizontal-alignment.tsx
28-
title: Horizontal alignment
32+
Control the vertical alignment of children using the `blockAlign` prop.
33+
- fileName: inline-with-align.tsx
34+
title: Align
2935
description: >-
30-
Use to horizontally align Inline.
36+
Control the horizontal alignment of children using the `align` prop.
3137
---
3238

3339
## Related components
3440

35-
- To display elements vertically, [use the AlphaStack component](https://polaris.shopify.com/components/layout-and-structure/alpha-stack)
41+
- To create the large-scale structure of pages, [use the Columns component](https://polaris.shopify.com/components/layout-and-structure/columns)
42+
- To display elements vertically, [use the AlphaStack component](https://polaris.shopify.com/components/alphastack)

polaris.shopify.com/next.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,11 @@ const layoutAndStructure = [
440440
destination: '/components/layout-and-structure/stack',
441441
permanent: false,
442442
},
443+
{
444+
source: '/components/layout-and-structure/stack',
445+
destination: '/components/layout-and-structure/alpha-stack',
446+
permanent: false,
447+
},
443448
];
444449

445450
const lists = [

0 commit comments

Comments
 (0)