Lynx

Dialog

A modal component that appears in the center of the screen to draw user attention and contains title, body, and footer.

Engine ≥ 3.6<overlay>
Available since@seed-design/lynx-react@0.7.0, @seed-design/lynx-css@0.11.0
Loading Lynx example…

Installation

npx @seed-design/cli add ui:dialog

The Dialog in @seed-design/lynx-react wraps @lynx-js/lynx-ui-dialog. The Registry's DialogContent assembles Positioner, Backdrop, and Header internally, and DialogAction provides ActionButton and close action together.

Usage

import {
  DialogAction,
  DialogBody,
  DialogContent,
  DialogFooter,
  DialogRoot,
  DialogTrigger,
} from "@/components/ui/dialog";
import { ActionButton } from "@seed-design/lynx-react";

export function App() {
  return (
    <DialogRoot size="medium">
      <DialogTrigger>
        <ActionButton variant="neutralSolid">Open Dialog</ActionButton>
      </DialogTrigger>
      <DialogContent title="Title" description="Additional description">
        <DialogBody>
          <text>Body content</text>
        </DialogBody>
        <DialogFooter>
          <DialogAction variant="neutralSolid">Close</DialogAction>
        </DialogFooter>
      </DialogContent>
    </DialogRoot>
  );
}

The Registry's DialogContent assembles Positioner, Backdrop, and Header internally. DialogTrigger must be placed outside Content to open the Dialog by tapping. The showCloseButton of DialogContent defaults to true and renders a close ActionButton in the header. If you don't need a close button, set showCloseButton={false}.

DialogBody is rendered as native <scroll-view scroll-y> and scrolls vertically within the maximum height of the Content. DialogAction accepts ActionButton props and renders with close action.

Props

DialogRoot

Prop

Type

DialogTrigger

Prop

Type

DialogContent

Prop

Type

title?React.ReactNode
description?React.ReactNode
children?React.ReactNode
container?string | undefined
overlayLevel?1 | 2 | 3 | 4 | undefined

DialogBody

Prop

Type

bg?(string & {}) | ScopedColorBg | ScopedColorPalette | ScopedColorBanner | undefined
background?(string & {}) | ScopedColorBg | ScopedColorPalette | ScopedColorBanner | undefined
color?(string & {}) | ScopedColorPalette | ScopedColorFg | undefined
borderColor?(string & {}) | ScopedColorPalette | ScopedColorStroke | undefined
borderWidth?0 | (string & {}) | 1 | undefined
borderTopWidth?0 | (string & {}) | 1 | undefined
borderRightWidth?0 | (string & {}) | 1 | undefined
borderBottomWidth?0 | (string & {}) | 1 | undefined
borderLeftWidth?0 | (string & {}) | 1 | undefined
borderRadius?0 | (string & {}) | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | "full" | undefined
borderTopLeftRadius?0 | (string & {}) | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | "full" | undefined
borderTopRightRadius?0 | (string & {}) | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | "full" | undefined
borderBottomRightRadius?0 | (string & {}) | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | "full" | undefined
borderBottomLeftRadius?0 | (string & {}) | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | "full" | undefined
width?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
minWidth?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
maxWidth?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
height?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
minHeight?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
maxHeight?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
top?0 | (string & {}) | undefined
left?0 | (string & {}) | undefined
right?0 | (string & {}) | undefined
bottom?0 | (string & {}) | undefined
padding?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
p?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
paddingX?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
px?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
paddingY?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
py?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
paddingTop?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | "safeArea" | undefined
pt?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | "safeArea" | undefined
paddingRight?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
pr?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
paddingBottom?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | "safeArea" | undefined
pb?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | "safeArea" | undefined
paddingLeft?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
pl?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
display?(string & {}) | "flex" | "none" | undefined
position?(string & {}) | "relative" | "absolute" | "fixed" | undefined
overflowX?(string & {}) | "visible" | "hidden" | undefined
overflowY?(string & {}) | "visible" | "hidden" | undefined
zIndex?Property.ZIndex | undefined
flexGrow?boolean | Property.FlexGrow | undefined
flexShrink?boolean | Property.FlexShrink | undefined
flexDirection?(string & {}) | "row" | "column" | "rowReverse" | "columnReverse" | undefined
flexWrap?boolean | "nowrap" | "wrap" | undefined
justifyContent?(string & {}) | "flexStart" | "flexEnd" | "center" | "spaceBetween" | "spaceAround" | undefined
justifySelf?Property.JustifySelf | undefined
alignItems?(string & {}) | "flexStart" | "flexEnd" | "center" | "stretch" | undefined
alignContent?(string & {}) | "flexStart" | "flexEnd" | "center" | "stretch" | undefined
alignSelf?(string & {}) | "flexStart" | "flexEnd" | "center" | "stretch" | undefined
gap?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined

DialogFooter

Prop

Type

bg?(string & {}) | ScopedColorBg | ScopedColorPalette | ScopedColorBanner | undefined
background?(string & {}) | ScopedColorBg | ScopedColorPalette | ScopedColorBanner | undefined
color?(string & {}) | ScopedColorPalette | ScopedColorFg | undefined
borderColor?(string & {}) | ScopedColorPalette | ScopedColorStroke | undefined
borderWidth?0 | (string & {}) | 1 | undefined
borderTopWidth?0 | (string & {}) | 1 | undefined
borderRightWidth?0 | (string & {}) | 1 | undefined
borderBottomWidth?0 | (string & {}) | 1 | undefined
borderLeftWidth?0 | (string & {}) | 1 | undefined
borderRadius?0 | (string & {}) | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | "full" | undefined
borderTopLeftRadius?0 | (string & {}) | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | "full" | undefined
borderTopRightRadius?0 | (string & {}) | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | "full" | undefined
borderBottomRightRadius?0 | (string & {}) | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | "full" | undefined
borderBottomLeftRadius?0 | (string & {}) | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | "full" | undefined
width?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
minWidth?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
maxWidth?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
height?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
minHeight?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
maxHeight?(string & {}) | "full" | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
top?0 | (string & {}) | undefined
left?0 | (string & {}) | undefined
right?0 | (string & {}) | undefined
bottom?0 | (string & {}) | undefined
padding?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
p?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
paddingX?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
px?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
paddingY?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
py?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
paddingTop?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | "safeArea" | undefined
pt?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | "safeArea" | undefined
paddingRight?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
pr?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
paddingBottom?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | "safeArea" | undefined
pb?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | "safeArea" | undefined
paddingLeft?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
pl?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
display?(string & {}) | "flex" | "none" | undefined
position?(string & {}) | "relative" | "absolute" | "fixed" | undefined
overflowX?(string & {}) | "visible" | "hidden" | undefined
overflowY?(string & {}) | "visible" | "hidden" | undefined
zIndex?Property.ZIndex | undefined
flexGrow?boolean | Property.FlexGrow | undefined
flexShrink?boolean | Property.FlexShrink | undefined
flexDirection?(string & {}) | "row" | "column" | "rowReverse" | "columnReverse" | undefined
flexWrap?boolean | "nowrap" | "wrap" | undefined
justifyContent?(string & {}) | "flexStart" | "flexEnd" | "center" | "spaceBetween" | "spaceAround" | undefined
justifySelf?Property.JustifySelf | undefined
alignItems?(string & {}) | "flexStart" | "flexEnd" | "center" | "stretch" | undefined
alignContent?(string & {}) | "flexStart" | "flexEnd" | "center" | "stretch" | undefined
alignSelf?(string & {}) | "flexStart" | "flexEnd" | "center" | "stretch" | undefined
gap?0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | undefined
style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined

DialogAction

Prop

Type

icon?React.ReactElement<LynxIconElementProps, string | React.JSXElementConstructor<any>> | undefined
prefixIcon?React.ReactElement<LynxIconElementProps, string | React.JSXElementConstructor<any>> | undefined
suffixIcon?React.ReactElement<LynxIconElementProps, string | React.JSXElementConstructor<any>> | undefined
flexGrow?boolean | Property.FlexGrow | undefined
children?React.ReactNode
bindtap?EventHandler<BaseTouchEvent<Target>> | undefined
main-thread:bindtap?EventHandler<BaseTouchEvent<Element>> | undefined
accessibility-label?string | undefined
accessibility-element?boolean | undefined
accessibility-traits?"disabled" | "none" | "text" | "image" | "button" | "link" | "header" | "search" | "selected" | "playable" | "keyboard" | "summary" | "updating" | "adjustable" | "tabbar" | undefined

Examples

Trigger

Tapping <DialogTrigger> opens the Dialog. Lynx does not support React's asChild, and Trigger renders a native view wrapping child elements.

Loading Lynx example…

Controlled

To open and close the Dialog in ways other than Trigger, control state with open and onOpenChange.

Loading Lynx example…

Size

You can change the Dialog width with the size prop of <DialogRoot>. "medium" is the default and "large" is supported. For both sizes, small screens use the recipe's viewport-based width, and larger screens apply the Dialog token's maximum width for each size. Content height is limited by the recipe's maximum height.

Loading Lynx example…

Body

<DialogBody> is a body slot with the seed-dialog__body selector applied. It is rendered as native <scroll-view scroll-y> and scrolls vertically within the maximum height of Content. The default horizontal padding is provided by the recipe's body token (x6).

Unlike the web version, Lynx does not display a header divider or bottom fade mask by observing overflow state.

Loading Lynx example…

Custom Body

<DialogBody> accepts existing Lynx styled props. You can redefine height, min-height, and alignment with className or style. If you need to override the Recipe's default padding, specify paddingLeft and paddingRight directly in style to avoid being affected by CSS load order. Only explicitly specify when removing the default horizontal padding to place full-bleed content.

Loading Lynx example…

Show Close Button

The Registry's DialogContent supports showCloseButton and defaults to true. Setting it to false hides the close ActionButton in the header, allowing you to provide explicit close action in the footer and other areas.

Loading Lynx example…

DialogFooter provides only flex layout. Button arrangement is constructed directly by specifying flex-direction, justify-content, gap, and others on child view.

Loading Lynx example…

Prevent Close

Lynx's DialogAction does not support the preventDefault() method from React events. You can prevent closing by making Dialog controlled and conditionally ignoring onOpenChange(false).

Loading Lynx example…

onOpenChange Details

Lynx's onOpenChange passes only the changed open value. The second argument details.reason from the React version is not supported. If you need the close reason, record it in a separate state in the event handlers of app-owned buttons and Trigger.

Confirm Before Close

Unlike React examples, Lynx does not support showing confirmation Dialogs for closeButton, escapeKeyDown, interactOutside separately. Since Lynx callbacks alone cannot distinguish close reasons, for actions that need confirmation, open the confirmation Dialog first in the handler of an app-owned button and directly control the open of the original Dialog.

Portalled

When you specify container for DialogContent, it renders on the native overlay layer. You can specify the display order of the overlay layer with overlayLevel.

Loading Lynx example…

Responsive

Automatic switching components like React's ResponsiveDialog are not provided in Lynx. Directly select Dialog and BottomSheet in your app based on screen size, or connect the same controlled state to both components.

Web Version Differences

ItemWebLynx
User eventsonClickbindtap or public callback
Rendering elementsHTML elements and Portalnative <view>, <text>, <scroll-view> and overlay
State propopen, defaultOpen, onOpenChangeSame. Internally connected to lynx-ui-dialog's show, defaultShow, onShowChange
Trigger compositionasChild supportedNot supported. Trigger renders a view wrapping child elements
Body slotDialogBody providedDialogBody provided. Uses native <scroll-view scroll-y> and seed-dialog__body selector with default horizontal padding from recipe body token(x6)
Close buttonshowCloseButton supportedDefault support in Registry's DialogContent. Hidden with showCloseButton={false}
Close reasondetails.reason in onOpenChangeOnly boolean open value provided
Portal / overlayPortal componentDialogContent's container, overlayLevel
Responsive DialogResponsiveDialog providedNot provided. Dialog and BottomSheet combined directly in app
Mount controllazyMount, unmountOnExitforceMount supported
Imperative ref APINoneNot supported

Table of contents