diff --git a/.changeset/heavy-eagles-train.md b/.changeset/heavy-eagles-train.md new file mode 100644 index 00000000000..225e45c0899 --- /dev/null +++ b/.changeset/heavy-eagles-train.md @@ -0,0 +1,5 @@ +--- +'polaris.shopify.com': patch +--- + +Updated `AlphaStack` component docs diff --git a/polaris.shopify.com/content/components/alpha-stack.md b/polaris.shopify.com/content/components/alpha-stack.md index da6eb3997f7..b0303d648a1 100644 --- a/polaris.shopify.com/content/components/alpha-stack.md +++ b/polaris.shopify.com/content/components/alpha-stack.md @@ -1,6 +1,6 @@ --- title: Alpha stack -description: Use to lay out a vertical pile of elements sitting on top of each other. A stack is made of flexible items that wrap each of the stack’s children. Options allow different spacing and alignments. +description: Use to display elements vertically with items placed directly below the preceding item. category: Structure keywords: - layout @@ -10,16 +10,22 @@ status: examples: - fileName: alpha-stack-default.tsx title: Default - - fileName: alpha-stack-with-align.tsx - title: Horizontal alignment description: >- - Horizontal alignment for children can be set with the align property. + By default, stack is left aligned and stacked items are spaced with 16px in between. - fileName: alpha-stack-with-spacing.tsx - title: Vertical spacing + title: Spacing description: >- - Vertical spacing for children can be set with the spacing property. Spacing options are provided using our spacing tokens. + Spacing between stack child can be adjusted using the Space token. - fileName: alpha-stack-with-full-width-children.tsx - title: Full width children + title: Full width + description: >- + Use a boolean to make Stack full width. + - fileName: alpha-stack-with-align.tsx + title: Alignment description: >- - Set children to full width + Use to vertically align Stack. --- + +## Related components + +- To display elements horizontally, use [Inline](https://polaris.shopify.com/components/inline). diff --git a/polaris.shopify.com/pages/examples/alpha-stack-default.tsx b/polaris.shopify.com/pages/examples/alpha-stack-default.tsx index 2550e7242e0..b95e2b3f011 100644 --- a/polaris.shopify.com/pages/examples/alpha-stack-default.tsx +++ b/polaris.shopify.com/pages/examples/alpha-stack-default.tsx @@ -1,21 +1,47 @@ import React from 'react'; -import {AlphaStack, Badge, Text} from '@shopify/polaris'; +import {AlphaStack, Text} from '@shopify/polaris'; import {withPolarisExample} from '../../src/components/PolarisExampleWrapper'; function AlphaStackExample() { return ( -
- - - AlphaStack + + + + + + ); +} + +const Placeholder = ({ + label = '', + height = 'auto', + width = 'auto', + childWidth = 'auto', +}) => { + return ( +
+
+ + {label} - One - Two - Three - +
); -} +}; export default withPolarisExample(AlphaStackExample); diff --git a/polaris.shopify.com/pages/examples/alpha-stack-with-align.tsx b/polaris.shopify.com/pages/examples/alpha-stack-with-align.tsx index 9b372e91360..c19d69582b8 100644 --- a/polaris.shopify.com/pages/examples/alpha-stack-with-align.tsx +++ b/polaris.shopify.com/pages/examples/alpha-stack-with-align.tsx @@ -1,66 +1,68 @@ import React from 'react'; -import {AlphaStack, Badge, Box, Inline, Text} from '@shopify/polaris'; +import {AlphaStack, Box, Page, Inline, Text} from '@shopify/polaris'; import {withPolarisExample} from '../../src/components/PolarisExampleWrapper'; function AlphaStackWithAlignExample() { return ( -
- - - with align start - - - + + - - AlphaStack - - - One - Two - Three - + + + -
- - - with align center - - - + - - AlphaStack - - - One - Two - Three - + + + + + -
- - - with align end - - - + - - AlphaStack - - - One - Two - Three - + + + -
+ ); } +const Placeholder = ({ + label = '', + height = 'auto', + width = 'auto', + childAlign, +}) => { + return ( +
+ +
+ + {label} + +
+
+
+ ); +}; + export default withPolarisExample(AlphaStackWithAlignExample); diff --git a/polaris.shopify.com/pages/examples/alpha-stack-with-full-width-children.tsx b/polaris.shopify.com/pages/examples/alpha-stack-with-full-width-children.tsx index bedb38c8273..edf335bc218 100644 --- a/polaris.shopify.com/pages/examples/alpha-stack-with-full-width-children.tsx +++ b/polaris.shopify.com/pages/examples/alpha-stack-with-full-width-children.tsx @@ -1,21 +1,47 @@ import React from 'react'; -import {AlphaStack, Badge, Text} from '@shopify/polaris'; +import {AlphaStack, Text} from '@shopify/polaris'; import {withPolarisExample} from '../../src/components/PolarisExampleWrapper'; function AlphaStackWithFullWidthChildrenExample() { return ( -
- - - AlphaStack + + + + + + ); +} + +const Placeholder = ({ + label = '', + height = 'auto', + width = '100%', + childWidth = 'auto', +}) => { + return ( +
+
+ + {label} - One - Two - Three - +
); -} +}; export default withPolarisExample(AlphaStackWithFullWidthChildrenExample); diff --git a/polaris.shopify.com/pages/examples/alpha-stack-with-spacing.tsx b/polaris.shopify.com/pages/examples/alpha-stack-with-spacing.tsx index 6235e604924..4333868c0d5 100644 --- a/polaris.shopify.com/pages/examples/alpha-stack-with-spacing.tsx +++ b/polaris.shopify.com/pages/examples/alpha-stack-with-spacing.tsx @@ -1,66 +1,64 @@ import React from 'react'; -import {AlphaStack, Badge, Box, Inline, Text} from '@shopify/polaris'; +import {AlphaStack, Text} from '@shopify/polaris'; import {withPolarisExample} from '../../src/components/PolarisExampleWrapper'; function AlphaStackWithSpacingExample() { return ( -
- - - with spacing 0 - - - - - - AlphaStack - - - One - Two - Three - - - -
- - - with spacing 4 - - - - - - AlphaStack - - - One - Two - Three - - - -
- - - with spacing 10 + + + + + + + + ); +} + +const SpacingBackground = ({children, width}) => { + return ( +
+ {children} +
+ ); +}; + +const Placeholder = ({ + label = '', + height = 'auto', + width = 'auto', + childWidth = 'auto', +}) => { + return ( +
+
+ + {label} - - - - - AlphaStack - - - One - Two - Three - - - +
); -} +}; export default withPolarisExample(AlphaStackWithSpacingExample);