Stack is a layout component that makes it easy to stack elements together and apply a space between them.
Stack components use a modified version of the CSS lobotomized owl selector to add spacing between it's children.
Stack's primary use case is to layout items and control the spacing between each
item. If you have a more complicated use case, such as changing the margin on
the last child, you can combine Stack and Flex and use
justify-content: space-between
for more control of the layout.
To stack elements in horizontal or vertical direction only, use the VStack
and
HStack
components.
You can also use the Stack
component as well and pass the direction
prop.
You can pass responsive values to the Stack
component to change stack
direction and/or spacing between elements.
In some scenarios, you might want to add dividers between stacked elements. Pass
the divider
prop and set it's value to the StackDivider
or any custom React
element.
The future can be even brighter but a goal without a plan is just a wish
You deserve good things. With a whooping 10-15% interest rate per annum, grow your savings on your own terms with our completely automated process
Pass the direction
and set it to row
. Optionally, you can use align
and
justify
to adjust the alignment and distribution of the items.
The future can be even brighter but a goal without a plan is just a wish
You deserve good things. With a whooping 10-15% interest rate per annum, grow your savings.
Name | Type | Description |
---|---|---|
direction | Responsive(row, column, row-reverse, column-reverse) | The direction to stack the elements |
divider | ReactElement | The divider element to use between elements |
children | ReactNode | The elements to be stackes |
spacing | MarginProps | The space between each stack item. Defaults to 0.5rem |
align | FlexProps["alignItems"] | The alignment of the stack item. Similar to align-items |
justify | FlexProps["justifyContent"] | The distribution of the stack item. Similar to justify-content |
shouldWrapChildren | boolean | If true , the children will be wrapped in a Box with display: inline-block , and the Box will take the spacing props |