Concepts
OverviewCompositionTestingLayout
Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrapComponents
AccordionAdmonitionAvatarButtonCheckboxComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsProgressPrompt ModalRadioRatingSelectSwitchTableTabsTagTextTextareaToggleTooltipUtilities
Feature FlagsForLocal StoragePortalShowsplitPropsTheme1import { Stack } from "styled-system/jsx"2import { DecorativeBox } from "compositions/lib/decorative-box"3
4const Demo = () => {5 return (6 <Stack>7 <DecorativeBox h="20" />8 <DecorativeBox h="20" />9 <DecorativeBox h="20" />10 </Stack>11 )12}
Usage
By default, Stack applies flex-direction: column
and gap: 8px
to its
children.
1import { HStack, Stack, VStack } from "styled-system/jsx";
1<Stack>2 <div />3 <div />4</Stack>
Examples
Horizontal
Use the direction
prop to change the direction of the stack.
1import { Stack } from "styled-system/jsx";2import { DecorativeBox } from "compositions/lib/decorative-box";3
4const Demo = () => {5 return (6 <Stack direction="horizontal" gap="md">7 <DecorativeBox h="10" />8 <DecorativeBox h="10" />9 <DecorativeBox h="10" />10 </Stack>11 );12};
HStack
Alternatively, you can use the HStack
to create a horizontal stack and align
its children horizontally.
1import { HStack } from "styled-system/jsx";2import { DecorativeBox } from "compositions/lib/decorative-box";3const Demo = () => {4 return (5 <HStack gap="md">6 <DecorativeBox h="10" />7 <DecorativeBox h="10" />8 <DecorativeBox h="10" />9 </HStack>10 );11};
VStack
Use the VStack
to create a vertical stack and align its children vertically.
1import { VStack } from "styled-system/jsx";2import { DecorativeBox } from "compositions/lib/decorative-box";3
4const Demo = () => {5 return (6 <VStack gap="md">7 <DecorativeBox h="10" />8 <DecorativeBox h="10" />9 <DecorativeBox h="10" />10 </VStack>11 );12};
On this page