Knit UI
GitHub

Playground

Loading playground…

false
Playground
<Alert
  variant="light"
  title=""
  withCloseButton={false}
>
  Your changes have been saved.
</Alert>

Examples

Variants

Every visual variant stacked.

Loading example…

VariantsSourceStorybook

Sizes

Every size on the full token scale.

Loading example…

SizesSourceStorybook

With Title

A title is rendered bold above the body and wired as the alert's label.

Loading example…

With TitleSourceStorybook

With Icon

An icon sits in a column beside the body.

Loading example…

With IconSourceStorybook

With Close Button

A close button pinned top-right; wire onClose to dismiss.

Loading example…

With Close ButtonSourceStorybook

Radius

Rounded corners via the radius prop.

Loading example…

RadiusSourceStorybook

Themed

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

Loading example…

ThemedSourceStorybook

Compound Parts

Alert.Title and Alert.Message are the compound parts the default layout composes — usable directly for fully custom alert bodies.

Loading example…

Compound PartsSourceStorybook

Gradient

The gradient variant fills the panel with a linear gradient. With no gradient prop it follows the theme ramp; otherwise it accepts a two-color shorthand, $colorN tokens, or a multi-step stops list. Text renders white.

Loading example…

GradientSourceStorybook

Gradient Presets

A set of curated multi-color gradient presets.

Loading example…

Gradient PresetsSourceStorybook

Gradient Themed

The themed gradient (no gradient prop) derives its ramp from the active theme.

Loading example…

Gradient ThemedSourceStorybook

Gradient Angles

The same two-color gradient swept across a range of angles.

Loading example…

Gradient AnglesSourceStorybook

Shadows

Optional elevation via the shadow prop — the shared ladder from xs to xl.

Loading example…

ShadowsSourceStorybook

Styles

Per-slot styles targets individual parts — here the title and message.

Loading example…

StylesSourceStorybook

Props

PropTypeDefaultDescription
closeButtonLabelstring | undefined"Close"`aria-label` for the close button.
disabled systemboolean | undefined
gradient systemGradientValue | undefinedGradient fill for variant='gradient' — { from, to, deg } or { stops, deg }.
iconReactNodeIcon displayed in a column next to the body.
onClose(() => void) | undefinedCalled when the close button is pressed.
radius systemstring | number | undefinedTheme radius token (e.g. `$sm`) or any CSS value.
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
unset · xs · sm · md · lg · xl
Elevation — drop shadow from the shared ladder.
size system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
xxs · xs · sm · md · lg · xl · xxl
Token size for panel spacing, content gaps, text, and close button metrics.
styles systemSlotStyles<AlertStyles> | undefinedPer-slot style sugar — props spread onto the matching styled part.
theme systemThemeName | null | undefined
unset · blue · red · green · yellow · pink
Applies a theme to this element
titleReactNodeAlert title, rendered bold above the body.
variant system"light" | "outline" | "white" | "transparent" | "default" | "filled" | "gradient" | undefined
filled · light · outline · default · transparent · white · gradient
lightVisual fill — how the theme color ramp is applied.
withCloseButtonboolean | undefinedfalseShow a close button pinned to the top-right.

Style slots

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

SlotUsage
bodystyles={{ body: { … } }}
closeButtonstyles={{ closeButton: { … } }}
contentstyles={{ content: { … } }}
iconstyles={{ icon: { … } }}
messagestyles={{ message: { … } }}
titlestyles={{ title: { … } }}
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<TamaguiElement> | undefined

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