Inputs@knitui/components
CloseButton
CloseButton mirrors Mantine's CloseButton, built on ActionIcon. It renders a centered ✕ glyph by default and inherits all ActionIcon props except loading and children (children are appended after the icon, useful for a VisuallyHidden label). Accent comes from the theme prop + palette ramp.
import { CloseButton } from "@knitui/components";Playground
Loading playground…
<CloseButton
variant="subtle"
size="md"
disabled={false}
/>Examples
Variants
Every visual variant side by side at the default size.
Loading example…
Sizes
The full seven-step size scale, from xxs to xxl.
Loading example…
Shadows
The inherited shadow elevation ladder, from xs to xl.
Loading example…
Disabled
Disabled state — reduced opacity and pointer events off.
Loading example…
Custom Icon
Custom icon replaces the default ✕ glyph entirely.
Loading example…
Custom Aria Label
Custom aria-label overrides the default "Close" label for accessibility.
Loading example…
Themed
The palette ramp follows the active theme — same component, different accent.
Loading example…
Gradient
Gradient fill — themed default (no gradient prop), a two-color shorthand, a token gradient, and a multi-step stops gradient.
Loading example…
Gradient Presets
Curated gradient presets for the gradient variant.
Loading example…
Gradient Themed
Themed gradient (no gradient prop) — the $color5→$color9 ramp follows the active theme.
Loading example…
Matrix
Full variant × size matrix for visual regression.
Loading example…
Styles
Per-slot styles targets individual parts — here the icon glyph.
Loading example…
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Extra content rendered after the icon (e.g. a `VisuallyHidden` label). |
disabled system | boolean | undefined | false | |
gradient system | GradientValue | undefined | — | Gradient fill for variant='gradient' — { from, to, deg } or { stops, deg }. |
icon | ReactNode | — | Node to replace the default close icon. When set, `iconSize` is ignored. |
iconSize | string | number | undefined | — | Override the `✕` glyph font size. Ignored when `icon` is set. |
radius system | string | number | undefined | — | |
shadow system | "xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined | — | |
size system | string | number | undefinedxxs · xs · sm · md · lg · xl · xxl | md | Controls the square width/height, radius and icon size. |
styles system | SlotStyles<CloseButtonStyles> | undefined | — | Per-slot style sugar — props spread onto the matching styled part. |
theme system | ThemeName | null | undefinedunset · 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" | undefinedfilled · light · outline · subtle · transparent · white · default · gradient | subtle | Visual 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.
| Slot | Usage |
|---|---|
icon | styles={{ icon: { … } }} |
Accessibility & DOM props (2)
| Prop | Type |
|---|---|
key | Key | null | undefined |
ref | Ref<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.