import { Meta, ArgTypes, Canvas } from '@storybook/blocks';
import { Meta, ArgTypes, Canvas } from '@storybook/blocks';
import { Stack } from './Stack';
import { Stack, HorizontalStack } from './index';
import * as Stories from './Stack.internal.story';
import * as Stories from './Stack.internal.story';
<Meta title="MDX|Stack" component={Stack} />
<Meta title="MDX|Stack" component={Stack} />
@ -8,6 +8,8 @@ import * as Stories from './Stack.internal.story';
The `Stack` component is designed to assist with layout and positioning of elements within a container, offering a simple and flexible way to stack elements vertically or horizontally. This documentation outlines the proper usage of the Stack component and provides guidance on when to use it over the Grid or Flex components.
The `Stack` component is designed to assist with layout and positioning of elements within a container, offering a simple and flexible way to stack elements vertically or horizontally. This documentation outlines the proper usage of the Stack component and provides guidance on when to use it over the Grid or Flex components.
There is also a `HorizontalStack` component, which is a thin wrapper around Stack, equivalent to `<Stack direction="row">`.
### Usage
### Usage
#### When to use
#### When to use
@ -28,7 +30,15 @@ Use the `Grid` component instead for these use cases:
Use the `Flex` component instead for these use cases:
Use the `Flex` component instead for these use cases:
- **Centering:** Perfect for centering elements both vertically and horizontally.
- **Alignment:** More options for item alignment.
- **Dynamic Order:** Easily reorder elements for responsive layouts without changing code.
- **Flex items:** Custom flex basis or configure how items stretch and wrap.