DocsBlog
  • 1.0.0

  • light

    dark

    system

    Switch mode
  • Cerberus

    Acheron

    Elysium

Get Started
Components
Data Grid
Styling
Theming

Concepts

OverviewCompositionCerberus ContextTesting

Layout

Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridGroupNewLink OverlayScrollableStackWrap

Components

AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPaginationNewPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

Utilities

Client OnlyDownload TriggerEnvironmentFeature FlagsFocus TrapForFormat ByteFormat NumberFormat Relative TimeFrameHighlightJSON Tree ViewLocaleLocal StoragePortalPresenceShowsplitPropsTheme

Stack

Used to layout its children in a vertical or horizontal stack.

  • Panda
import { Stack, HStack, VStack } from "styled-system/jsx";

Usage

By default, Stack applies flex-direction: column and gap: 8px to its children.

Horizontal

Use the direction prop to change the direction of the stack.

HStack

Alternatively, you can use the HStack to create a horizontal stack and align its children horizontally.

VStack

Use the VStack to create a vertical stack and align its children vertically.

Responsive Direction

Props

PropTypeDescription
direction'row' | 'column' | ResponsiveValueThe direction of the stack.
gapCerberusSpacingThe gap between the stack items.
alignCSSProperties['align-items']The alignment of the stack items.
justifyCSSProperties['justify-content']The justification of the stack items.

On this page

  • Edit this page on Github
Cerberus Design System | Docs
Copy
import { DecorativeBox } from '@/app/components/decorative-box'
import { Stack } from 'styled-system/jsx'

export function BasicDemo() {
  return (
    <Stack w="3/4">
      <DecorativeBox h="20" />
      <DecorativeBox h="20" />
      <DecorativeBox h="20" />
    </Stack>
  )
}
Copy
import { DecorativeBox } from '@/app/components/decorative-box'
import { Stack } from 'styled-system/jsx'

export function HorizontalDemo() {
  return (
    <Stack direction="horizontal" gap="md" w="3/4">
      <DecorativeBox h="10" />
      <DecorativeBox h="10" />
      <DecorativeBox h="10" />
    </Stack>
  )
}
Copy
import { DecorativeBox } from '@/app/components/decorative-box'
import { HStack } from 'styled-system/jsx'

export function HStackDemo() {
  return (
    <HStack gap="md" w="3/4">
      <DecorativeBox h="10" />
      <DecorativeBox h="5" />
      <DecorativeBox h="20" />
    </HStack>
  )
}
Copy
import { DecorativeBox } from '@/app/components/decorative-box'
import { VStack } from 'styled-system/jsx'

export function VStackDemo() {
  return (
    <VStack gap="md" w="3/4">
      <DecorativeBox h="20" w="50%" />
      <DecorativeBox h="20" w="25%" />
      <DecorativeBox h="20" w="full" />
    </VStack>
  )
}
Copy
import { DecorativeBox } from '@/app/components/decorative-box'
import { Stack } from '@/styled-system/jsx'

export function ResponsiveStackDemo() {
  return (
    <Stack direction={{ base: 'column', md: 'row' }} gap="md" h="100px" w="3/4">
      <DecorativeBox boxSize="20" />
      <DecorativeBox boxSize="20" />
      <DecorativeBox boxSize="20" />
    </Stack>
  )
}