# 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`.

Package: `@kela-systems/ui-components` 4.1.0

```tsx
import { Stack } from "@kela-systems/ui-components";
```

Links (Kela sign-in needed): [Storybook](https://main--6af1efd9453270bb59a6c00c.chromatic.com/?path=/docs/layout-stack--docs), [Source](https://github.com/Kela-Systems/kela/tree/main/packages/next/ui-components/src/layout)

## Examples

### Rows inside a column

```tsx
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

A `className` on a part adds layout only: placement, sizing and spacing. Pick a look with a variant.

### Stack

| Variant | Values | Default |
| --- | --- | --- |
| `direction` | `row`, `column` | `column` |
| `align` | `center`, `start`, `end`, `stretch`, `baseline` |  |
| `justify` | `center`, `start`, `end`, `between` |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `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` |  |  |

Also takes the attributes of the HTML element it renders.

## Related

- [Grid](https://ark.kela.design/product/components/grid.md)
- [Text](https://ark.kela.design/product/components/text.md)
