# Cluster

Wraps related inline items with responsive spacing and alignment.

`Cluster` groups related items in a wrapping row. It works well for actions, filters, tags, metadata, and other content that should flow onto additional lines when space runs out.

```tsx
import { Badge, Cluster } from "@zentara-co/zenos-ui";

function ClusterExample() {
  return (
    <Cluster gap="2" align="center" justify="center" className="w-full">
      <Badge>Production</Badge>
      <Badge variant="default" color="success">
        Healthy
      </Badge>
      <Badge variant="default" color="information">
        12 services
      </Badge>
    </Cluster>
  );
}
```

## Import

```tsx
import { Cluster } from "@zentara-co/zenos-ui";
```

## Distribution

Use `justify` to distribute the whole group and `align` to align items across the row.

```tsx
import { Button, Cluster, Stack, Text } from "@zentara-co/zenos-ui";

function ClusterAlignmentExample() {
  const values = ["start", "center", "between"] as const;

  return (
    <Stack gap="4" className="w-full">
      {values.map((justify) => (
        <Stack key={justify} gap="2">
          <Text size="s" color="subtle" className="capitalize">
            {justify}
          </Text>
          <Cluster
            justify={justify}
            gap="2"
            className="rounded-xl border border-border bg-background-neutral-card p-3"
          >
            <Button size="sm" variant="primary">
              Cancel
            </Button>
            <Button size="sm">Continue</Button>
          </Cluster>
        </Stack>
      ))}
    </Stack>
  );
}
```

## Responsive wrapping

Wrapping is enabled by default. `gap`, `align`, `justify`, and `wrap` accept breakpoint values.

```tsx
import { Badge, Cluster } from "@zentara-co/zenos-ui";

function ClusterWrapExample() {
  return (
    <Cluster gap={{ base: "2", md: "3" }} wrap={{ base: true, lg: false }} className="w-full">
      {[
        "Authentication",
        "Infrastructure",
        "Observability",
        "Data protection",
        "Incident response",
      ].map((label) => (
        <Badge key={label} variant="soft" color="gray">
          {label}
        </Badge>
      ))}
    </Cluster>
  );
}
```

Use Stack with `direction="row"` when you need row-specific sizing, scrolling, or explicit flex behavior beyond this focused wrapping relationship.

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | ElementType | div | Rendered semantic element. |
| gap | Responsive<Spacing> | 2 | Space between children. |
| align | Responsive<Align> | — | Cross-axis alignment. |
| justify | Responsive<Justify> | — | Main-axis distribution. |
| wrap | Responsive<boolean> | true | Responsive wrapping. |
| native props | React.HTMLAttributes<HTMLElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

## Accessibility

Cluster adds no roles or keyboard behavior. Render it as `nav`, `ul`, or another semantic element when the grouped content requires that meaning, and preserve the natural DOM order when changing visual distribution.

Source: https://zenos-ui.pages.dev/layout/cluster/