In Review

Stack

Variants

Default

Item 1
Item 2
Item 3
  {{ govieStack({
    "direction": "column",
    "itemsAlignment": "start",
    "itemsDistribution": "start",
    "gap": 2,
    "hasDivider": false,
    "wrap": false,
    "fixedHeight": "300px",
    "children": [
      "<div class="gi-bg-gray-300 gi-p-2 gi-h-[50px] gi-w-[100px] gi-flex gi-items-center gi-justify-center">Item 1</div>",
      "<div class="gi-bg-gray-300 gi-p-2 gi-h-[50px] gi-w-[100px] gi-flex gi-items-center gi-justify-center">Item 2</div>",
      "<div class="gi-bg-gray-300 gi-p-2 gi-h-[50px] gi-w-[100px] gi-flex gi-items-center gi-justify-center">Item 3</div>"
    ]
  }) }}
  import { Stack } from "@govie-ds/stack";

  <Stack
      direction={{ base: 'column', md: 'row' }}
      itemsAlignment="center"
      itemsDistribution="center"
      gap={{ base: 5, md: 3 }}
      fixedHeight="200px"
      >
      <div className="gi-bg-gray-300 gi-p-2">Item 1</div>
      <div className="gi-bg-gray-300 gi-p-2">Item 2</div>
      <div className="gi-bg-gray-300 gi-p-2">Item 3</div>
  </Stack>;

Usage

Best Practices

When to use this component

Use the Stack component to arrange items vertically or horizontally with consistent spacing, alignment, and responsive layout options. It’s ideal for stacking related elements, like buttons, cards, or form fields, in a flexible and organised way.

When not to use this component

Avoid using the Stack component for complex grid layouts or when precise control over individual item positioning is required.

Status

Figma Library
Considering
Local HTML
N/A
Global HTML
Beta
Global React
Beta