Knit UI
GitHub

Playground

Loading playground…

Playground
<Spacer
  w="$md"
  h="$md"
/>

Examples

Horizontal

Horizontal spacer — reserves a fixed amount of space between two inline elements.

Loading example…

HorizontalSourceStorybook

Vertical

Vertical spacer — reserves a fixed amount of vertical space between stacked elements.

Loading example…

VerticalSourceStorybook

Spacer Sizes

Multiple spacer sizes using Tamagui $size tokens — shows how spacing scales across a row.

Loading example…

Spacer SizesSourceStorybook

Flex Grow

Flex-grow layout — Spacer with flex={1} expands to fill available space, pushing siblings apart.

Loading example…

Flex GrowSourceStorybook

Minimum Size

Minimum size guarantee — the spacer resists collapsing even inside a flex container that tries to shrink it.

Loading example…

Minimum SizeSourceStorybook

Props

PropTypeDefaultDescription
disabled systemboolean | undefined
hnumber | Animated.AnimatedNode | GetThemeValueForKey<"height"> | null | undefined
$xxs · $xs · $sm · $md · $lg · $xl · $xxl
$mdHeight of the spacer from the $size scale (also sets `mih` by default).
mihnumber | Animated.AnimatedNode | GetThemeValueForKey<"minHeight"> | null | undefined
unset · $xxs · $xs · $sm · $md · $lg · $xl · $xxl
Override the minimum height (defaults to `h`).
miwnumber | Animated.AnimatedNode | GetThemeValueForKey<"minWidth"> | null | undefined
unset · $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 systemThemeName | null | undefinedApplies a theme to this element
wnumber | Animated.AnimatedNode | GetThemeValueForKey<"width"> | null | undefined
$xxs · $xs · $sm · $md · $lg · $xl · $xxl
$mdWidth of the spacer from the $size scale (also sets `miw` by default).
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<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.