Stack

Lays its children out in a row or a column with spacing from the scale. Use it for every one-dimensional layout in app code, instead of a styled div.

React examples

Rows inside a column

Hawk 2Online
A column of three rows, 12px apart. The first and last rows are rows of their own.
import { Badge, Button, Stack, Text } from "@kela-systems/ui-components";

export default function StackDefault() {
  return (
    <Stack gap={3} className="w-full max-w-sm">
      <Stack direction="row" justify="between" align="center">
        <Text variant="body-md-medium">Hawk 2</Text>
        <Badge variant="success">Online</Badge>
      </Stack>
      <Text variant="body-sm-regular" tone="neutral-secondary">
        A column of three rows, 12px apart. The first and last rows are rows of their own.
      </Text>
      <Stack direction="row" gap={2} justify="end">
        <Button variant="outline" size="sm">
          Cancel
        </Button>
        <Button size="sm">Launch</Button>
      </Stack>
    </Stack>
  );
}

Props

Stack

NameDefaultDescription
direction
"row" | "column"
"column"
align
"center" | "start" | "end" | "stretch" | "baseline"
justify
"center" | "start" | "end" | "between"
gap
SpacingStep | "auto"
wrap
boolean
false
inline
boolean
false
grow
boolean
false
shrink
boolean
true
clip
boolean
false
padding
SpacingStep
paddingInline
SpacingStep
paddingBlock
SpacingStep
paddingInlineStart
SpacingStep
paddingInlineEnd
SpacingStep
paddingBlockStart
SpacingStep
paddingBlockEnd
SpacingStep

It also takes the attributes of the HTML element it renders.

Weigh Stack against these before you choose.

Read this page as Markdown

Search ARK

Find a page, a primitive or a component.