Layout@knitui/components
Spacer
Spacer is a fixed-size invisible element that reserves space between other elements. Set w for horizontal gaps and h for vertical gaps. miw/mih default to w/h so the space never collapses.
import { Spacer } from "@knitui/components";Playground
Loading playground…
<Spacer
w="$md"
h="$md"
/>Examples
Horizontal
Horizontal spacer — reserves a fixed amount of space between two inline elements.
Loading example…
Vertical
Vertical spacer — reserves a fixed amount of vertical space between stacked elements.
Loading example…
Spacer Sizes
Multiple spacer sizes using Tamagui $size tokens — shows how spacing scales across a row.
Loading example…
Flex Grow
Flex-grow layout — Spacer with flex={1} expands to fill available space, pushing siblings apart.
Loading example…
Minimum Size
Minimum size guarantee — the spacer resists collapsing even inside a flex container that tries to shrink it.
Loading example…
Props
| Prop | Type | Default | Description |
|---|---|---|---|
disabled system | boolean | undefined | — | |
h | number | Animated.AnimatedNode | GetThemeValueForKey<"height"> | null | undefined$xxs · $xs · $sm · $md · $lg · $xl · $xxl | $md | Height of the spacer from the $size scale (also sets `mih` by default). |
mih | number | Animated.AnimatedNode | GetThemeValueForKey<"minHeight"> | null | undefinedunset · $xxs · $xs · $sm · $md · $lg · $xl · $xxl | — | Override the minimum height (defaults to `h`). |
miw | number | Animated.AnimatedNode | GetThemeValueForKey<"minWidth"> | null | undefinedunset · $xxs · $xs · $sm · $md · $lg · $xl · $xxl | — | Override the minimum width (defaults to `w`). |
shadow system | "xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined | — | |
theme system | ThemeName | null | undefined | — | Applies a theme to this element |
w | number | Animated.AnimatedNode | GetThemeValueForKey<"width"> | null | undefined$xxs · $xs · $sm · $md · $lg · $xl · $xxl | $md | Width of the spacer from the $size scale (also sets `miw` by default). |
Accessibility & DOM props (2)
| Prop | Type |
|---|---|
key | Key | null | undefined |
ref | Ref<TamaguiElement> | undefined |
Plus 494 inherited style props from Box — the full Tamagui/React Native style surface, including token shorthands like p, mx, bg and c. See Tokens for the scales they accept, or the full list.