Knit UI
GitHub

Playground

Loading playground…

true
true
true
false
false
Playground
<Dialog
  opened
  size="md"
  withCloseButton
  withBorder
  keepMounted={false}
  withinPortal={false}
  zIndex={300}
  position={{ bottom: "$xl", right: "$xl" }}
>
  This is a dialog message.
</Dialog>

Examples

Sizes

All seven content widths stacked to compare the size presets.

Loading example…

SizesSourceStorybook

Shadows

All five shadow levels stacked to compare elevation. Each always-open panel is offset vertically (and rendered with withinPortal={false}) so the drop shadows sit side by side without overlapping. The dialog defaults to shadow="md".

Loading example…

ShadowsSourceStorybook

Trigger

Controlled open/close via a trigger button — demonstrates the opened + onClose pattern.

Loading example…

TriggerSourceStorybook

Without Close Button

Close button hidden — useful when dismissal is handled via action buttons inside the dialog.

Loading example…

Without Close ButtonSourceStorybook

Keep Mounted

keepMounted keeps the node in the DOM while closed — only display is toggled.

Loading example…

Keep MountedSourceStorybook

Corner Positions

Pinned to each viewport corner to verify position prop behaviour.

Loading example…

Corner PositionsSourceStorybook

Styles

Per-slot styles targets individual parts — here the content frame and the closeButton.

Loading example…

StylesSourceStorybook

With Actions

Rich content — title, body copy, and action buttons showing a realistic use-case.

Loading example…

With ActionsSourceStorybook

Props

PropTypeDefaultDescription
opened requiredbooleantrueOpened state.
animationfalse | MotionPresetName | MotionPreset | undefineda subtle rise-in fade. Reduced motion is always honoured (collapses to instant). Exit animates unless `keepMounted`.Enter/exit animation — a motion preset name, an inline {@link MotionPreset}, or `false` to disable.
childrenReactNodeThis is a dialog message.Dialog content.
closeButtonPropsCloseButtonProps | undefined
disabled systemboolean | undefined
durationnumber | undefinedAnimation speed in ms — overrides the preset's duration while keeping its easing. Ignored when `animation` is `false` or reduced motion is on.
keepMountedboolean | undefinedfalseKeep mounted in the DOM while closed (toggles display instead of unmounting).
onClose(() => void) | undefinedCalled when the close button is pressed.
positionAffixPosition | undefined{ bottom: "$xl", right: "$xl" }Viewport corner to pin to.
radius systemstring | number | undefined
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
unset · xs · sm · md · lg · xl
Elevation — drop shadow from the shared ladder.
size systemstring | number | undefined
xxs · xs · sm · md · lg · xl · xxl
"md"Content width — xxs through xxl, plus custom number or CSS width.
styles systemSlotStyles<DialogStyles> | undefinedPer-slot style sugar — props spread onto the matching styled part.
theme systemThemeName | null | undefinedApplies a theme to this element
withBorderboolean | undefinedtrueShow the outline border.
withCloseButtonboolean | undefinedtrueShow the close button (top-inline-end).
withinPortalboolean | undefinedtrueRender inside a `Portal`.
zIndexnumber | undefined300Root `z-index`.

Style slots

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

SlotUsage
closeButtonstyles={{ closeButton: { … } }}
contentstyles={{ content: { … } }}
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<TamaguiElement> | undefined

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