Wrap
Wrapping inline layout. Like Inline but each child gets uniform gap whether or not lines wrap — the right fit for tag clouds, chip rows, and lists of variable-width buttons.
Plain <div>; preserves child semantics. The visual ordering matches DOM order so keyboard tab-stops follow what you see.
Preview
tsx
import { Box, Wrap } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Wrap gap="2" padding="4" background="bg.subtle" borderRadius="md">
<Box padding="2" background="bg.surface" borderRadius="sm">
tag-one
</Box>
<Box padding="2" background="bg.surface" borderRadius="sm">
tag-two
</Box>
<Box padding="2" background="bg.surface" borderRadius="sm">
tag-three
</Box>
<Box padding="2" background="bg.surface" borderRadius="sm">
tag-four
</Box>
<Box padding="2" background="bg.surface" borderRadius="sm">
tag-five
</Box>
</Wrap>
);
}
Independent row + column gap
Section titled “Independent row + column gap”gap controls both axes equally. Use rowGap and columnGap independently when the row distance should differ from the column distance after wrapping — common in tag clouds where a tighter column gap and a looser row gap reads cleanly.
Preview
tsx
import { Box, Wrap } from '@arshad-shah/cynosure-react';
const TAGS = ['design', 'systems', 'tokens', 'typography', 'layout', 'forms', 'overlays', 'a11y'];
export default function Example() {
return (
<Wrap rowGap="3" columnGap="2" padding="4" background="bg.subtle" borderRadius="md">
{TAGS.map((t) => (
<Box key={t} padding="2" background="bg.surface" borderRadius="full">
{t}
</Box>
))}
</Wrap>
);
}
Align and justify
Section titled “Align and justify”align controls cross-axis alignment of items within a row; justify distributes items along the main axis. align="center" keeps mixed-height chips visually centered after wrapping.
Preview
tsx
import { Box, Wrap } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Wrap
gap="2"
justify="center"
align="center"
padding="4"
background="bg.subtle"
borderRadius="md"
>
{['short', 'a longer chip', 'mid', 'tiny', 'one more'].map((label) => (
<Box key={label} padding="2" background="bg.surface" borderRadius="full">
{label}
</Box>
))}
</Wrap>
);
}
PropTypeDefaultDescription
className
string
—
Additional class names appended after Cynosure's base classes.
style
CSSProperties
—
Inline style overrides merged last.
children
ReactNode
—
Wrapped items.
columnGap
—
Gap between adjacent items on the inline axis. Overrides `gap`'s columns.
paddingX
—
Horizontal padding (left + right). Overrides `padding` on the X axis.
paddingY
—
Vertical padding (top + bottom). Overrides `padding` on the Y axis.
height
—
Element height. Accepts a `SpaceToken`, `LengthValue`, or named alias.
minWidth
—
Minimum width — useful for preventing flex children from collapsing.
background
—
Background colour. Use a `ColorToken` like `"bg.surface"` for theme awareness.
borderColor
—
Border colour. Pair with `borderWidth` to make the border visible.
opacity
Responsive<number | `${number}`>
—
Opacity 0–1. Use sparingly — prefer surface tokens over translucency.
overflowX
—
Horizontal-axis overflow control. Overrides `overflow` for the X axis.
display
—
CSS `display` value. `"contents"` removes the element's box from layout.
position
—
CSS `position`. Pair with `top`/`right`/`bottom`/`left` for placement.
top
—
Top inset (when positioned). Accepts a `SpaceToken`, `"auto"`, `"0"`, or `LengthValue`.
flex
Responsive<"1" | "none" | "auto" | "initial" | (string & {})>
—
Shorthand: `1 | auto | none | initial | <css>`. Resolves to `flex` on the child.
asChild
boolean
—
When `true`, renders the primitive's single React child via `Slot`,
forwarding className/style/ref/event handlers onto it.
as
ElementType
"div"
Rendered intrinsic element or component.
ref
ForwardedRef<Element>
—
Recipes
Section titled “Recipes”- Tag list:
<Wrap gap="2">{tags.map((t) => <Chip key={t}>{t}</Chip>)}</Wrap>. - Filter bar: combine
WrapwithChip+Checkboxitems so the bar reflows naturally on narrow viewports. - For predictable column layouts (cards in a grid), prefer
SimpleGrid— Wrap is for variable-width items where the column count is data-driven.