Skip to content

Cluster

Lays children out in a horizontal row that wraps to new lines as needed.

Import

import { Cluster } from "@hyzer-labs/ui"

Demo

near and away are the density distances: context-aware values that tighten inside data-density-shift regions.

AlphaBetaGammaDeltaEpsilon
<Cluster gap="sm">
	<span class="chip">Alpha</span>
	<span class="chip">Beta</span>
	<span class="chip">Gamma</span>
	<span class="chip">Delta</span>
	<span class="chip">Epsilon</span>
</Cluster>

Props

NameTypeDefaultNote
gap'none' | 'xs' | 'sm' | 'md' | 'lg' | 'near' | 'away''sm'near/away are the density distances — they tighten inside data-density-shift regions.
justify'start' | 'center' | 'end' | 'between' | 'around''start'
align'start' | 'center' | 'end' | 'stretch' | 'baseline''center'Shared LayoutAlign scale (Stack/Cluster/Grid).
wrapbooleantrue
padding'none' | 'sm' | 'md' | 'lg' | 'near' | 'away''none'Both axes. Shared LayoutPadding scale — near/away tighten inside data-density-shift regions.
paddingInline'none' | 'sm' | 'md' | 'lg' | 'near' | 'away'Per-axis override — wins over padding on the inline axis. Same LayoutPadding scale.
paddingBlock'none' | 'sm' | 'md' | 'lg' | 'near' | 'away'Per-axis override — wins over padding on the block axis. Same LayoutPadding scale.
asstring'div'
classstringMerged after the hz-cluster class.
childrenSnippet

Theme hooks

What this component promises your CSS. The reference theme styles exactly these — from @layer hz-theme, so your unlayered rules win. See Styling Components for the how.

Root class: .hz-cluster

Data attributes

HookValuesStyles
data-gap'none' | 'xs' | 'sm' | 'md' | 'lg' | 'near' | 'away'Gap between items. Default sm.
data-justify'start' | 'center' | 'end' | 'between' | 'around'justify-content. Default start.
data-align'start' | 'center' | 'end' | 'stretch' | 'baseline'align-items. Default center.
data-wrappresent when wrappingPresent by default; its absence is styled too (:not([data-wrap]) sets nowrap).
data-padding'none' | 'sm' | 'md' | 'lg' | 'near' | 'away'Padding on both axes. Default none.

Accessibility

Cluster is a layout primitive with no ARIA semantics. Reading and focus order follow DOM order.