Stack component is a layout component that stacks its children vertically or horizontally.
Default stack is using vertical direction with a gap of --dds-spacing-600
/ 24px between its children.
<dap-ds-stack> <dap-ds-button>Button 1</dap-ds-button> <dap-ds-button>Button 2</dap-ds-button> <dap-ds-button>Button 3</dap-ds-button> </dap-ds-stack>
You can set the direction
to row
or row-reverse
to stack the children horizontally.
Horizontal stack is using the gap of --dds-spacing-200
/ 8px between its children.
<dap-ds-stack direction="row"> <dap-ds-button>Button 1</dap-ds-button> <dap-ds-button>Button 2</dap-ds-button> <dap-ds-button>Button 3</dap-ds-button> </dap-ds-stack>
You can set the spacing
to a custom value to adjust the space between the children. Any dds-spacing-
variable number can be used.
<dap-ds-stack direction="row" spacing="600"> <dap-ds-button>Button 1</dap-ds-button> <dap-ds-button>Button 2</dap-ds-button> <dap-ds-button>Button 3</dap-ds-button> </dap-ds-stack>
import { DapDSStack } from 'dap-design-system/dist/dds'
import { DapDSStackReact } from 'dap-design-system/dist/react'
Name | Description |
---|---|
(default) | The content of the stack. |
Property | Type | Default | Description |
---|---|---|---|
direction | CSSFlexDirection | 'column' | The direction of the stack. Default is column . Can be column , column-reverse , row , or row-reverse . |
spacing | Spacing | The spacing of the stack. Uses the system spacing scale (100, 200, 300...etc) | |
endMargin | boolean | false | Adds margin to the end of the stack. |
startMargin | boolean | false | Adds margin to the start of the stack. |
No custom events available.
No CSS parts available.