Knit UI
GitHub

Playground

Loading playground…

false
Playground
<CloseButton
  variant="subtle"
  size="md"
  disabled={false}
/>

Examples

Variants

Every visual variant side by side at the default size.

Loading example…

VariantsSourceStorybook

Sizes

The full seven-step size scale, from xxs to xxl.

Loading example…

SizesSourceStorybook

Shadows

The inherited shadow elevation ladder, from xs to xl.

Loading example…

ShadowsSourceStorybook

Disabled

Disabled state — reduced opacity and pointer events off.

Loading example…

DisabledSourceStorybook

Custom Icon

Custom icon replaces the default glyph entirely.

Loading example…

Custom IconSourceStorybook

Custom Aria Label

Custom aria-label overrides the default "Close" label for accessibility.

Loading example…

Custom Aria LabelSourceStorybook

Themed

The palette ramp follows the active theme — same component, different accent.

Loading example…

ThemedSourceStorybook

Gradient

Gradient fill — themed default (no gradient prop), a two-color shorthand, a token gradient, and a multi-step stops gradient.

Loading example…

GradientSourceStorybook

Gradient Presets

Curated gradient presets for the gradient variant.

Loading example…

Gradient PresetsSourceStorybook

Gradient Themed

Themed gradient (no gradient prop) — the $color5$color9 ramp follows the active theme.

Loading example…

Gradient ThemedSourceStorybook

Matrix

Full variant × size matrix for visual regression.

Loading example…

MatrixSourceStorybook

Styles

Per-slot styles targets individual parts — here the icon glyph.

Loading example…

StylesSourceStorybook

Props

PropTypeDefaultDescription
childrenReactNodeExtra content rendered after the icon (e.g. a `VisuallyHidden` label).
disabled systemboolean | undefinedfalse
gradient systemGradientValue | undefinedGradient fill for variant='gradient' — { from, to, deg } or { stops, deg }.
iconReactNodeNode to replace the default close icon. When set, `iconSize` is ignored.
iconSizestring | number | undefinedOverride the `✕` glyph font size. Ignored when `icon` is set.
radius systemstring | number | undefined
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
size systemstring | number | undefined
xxs · xs · sm · md · lg · xl · xxl
mdControls the square width/height, radius and icon size.
styles systemSlotStyles<CloseButtonStyles> | undefinedPer-slot style sugar — props spread onto the matching styled part.
theme systemThemeName | null | undefined
unset · blue · red · green · yellow · pink · gray
Active theme accent — recolors the button via the palette ramp.
variant system"light" | "outline" | "white" | "transparent" | "default" | "filled" | "subtle" | "gradient" | undefined
filled · light · outline · subtle · transparent · white · default · gradient
subtleVisual variant — how the theme color ramp is applied.

Style slots

Every part of CloseButton can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotUsage
iconstyles={{ icon: { … } }}
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<TamaguiElement> | undefined

Plus 497 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.