Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Layout and type

Stack

Flex column (or row) with token-based gaps.

import { Stack } from "@stylhero/ui";

Example

Code
import { Paper, Stack } from "@stylhero/ui";

const tile = (label: string) => <Paper key={label} padding={3} outlined>{label}</Paper>;

function StackExample() {
  return (
    <Stack gap={4}>
      <Stack direction="row" gap={2}>{["One", "Two", "Three"].map(tile)}</Stack>
      <Stack gap={2}>{["Column", "of", "items"].map(tile)}</Stack>
    </Stack>
  );
}

Props

PropTypeDefaultDescription
align CSSProperties["alignItems"] -
as ElementType "div"
direction "column" | "row" "column"
gap Space 3
justify CSSProperties["justifyContent"] -
wrap boolean -

Also takes the HTML attributes of its root element (id, style, data-*, aria-*, event handlers…).

Types

type Space = 0 | 1 | 2 | 3 | 4 | 6 | 8 | 12;

Generated from src/components/Stack.tsx. Something wrong or missing? Open an issue.