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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQAumujy5kXaOKurr6zgTP2krHrFVXi2kj8seRYrlvq2GssUjReh5MiVpQbLFQNy9HsmcasqpBNVsXytWTw0ZDjA=

Overlays

By the end of this page the detail column shows the contact’s fields as text again. The toolbar has Edit, which opens the editor in a dialog, and Delete, which asks first. A toast says when a contact is saved.

Our screen needs four things to appear above the page: an editor, a question, a hint and a notice. Which component draws each one? An overlay is a component that TILE draws above the page, and we use four of them:

  • A Dialog is modal. The page behind it is inert until it closes. Use it for a task the user finishes or cancels before going on, as step 1 does for the editor.
  • A Popover opens beside its trigger and closes when the user clicks elsewhere. Use it for short content that belongs to one control, as step 2 does for the delete question.
  • A Tooltip shows a short hint on hover or focus. Use it to name a control or explain a value, as step 3 does for the role. It never takes focus, so put nothing in it that the user has to click.
  • A Toast reports something that happened and goes away by itself. Use it when the user does not have to answer, as step 4 does for a save.

A dialog, a popover and a tooltip each have a Trigger that opens it and a Content that holds it. asChild on a trigger makes our button the trigger. Without it, the trigger wraps our button in a button of its own.

A toast has neither. It is open while open on its Toast.Root is true.

Dialog, Popover, Tooltip and Toast list the parts of each. TILE has more overlays than these four, such as Menu for a list of actions and AlertDialog for a question the user must answer.

  1. Move the editor into a dialog. The dialog is controlled, so it can close itself when the editor saves. The trigger is an icon-only button, which shows its label as a tooltip on its own. Add src/overlays/ContactsScreen.tsx:

    import
    (alias) namespace React
    import React
    React
    , {
    function useState<S>(initialState: S | (() => S)): [S, React.Dispatch<React.SetStateAction<S>>] (+1 overload)

    Returns a stateful value, and a function to update it.

    @version ― 16.8.0

    @see ― https://react.dev/reference/react/useState

    useState
    } from 'react';
    import * as
    import Button
    Button
    from '@dxos/react-ui/Button';
    import * as
    import Dialog
    Dialog
    from '@dxos/react-ui/Dialog';
    8 collapsed lines
    import * as
    import Layout
    Layout
    from '@dxos/react-ui/Layout';
    import * as
    import Panel
    Panel
    from '@dxos/react-ui/Panel';
    import * as
    import Popover
    Popover
    from '@dxos/react-ui/Popover';
    import * as
    import Toast
    Toast
    from '@dxos/react-ui/Toast';
    import * as
    import Toolbar
    Toolbar
    from '@dxos/react-ui/Toolbar';
    import * as
    import Tooltip
    Tooltip
    from '@dxos/react-ui/Tooltip';
    import * as
    import Typography
    Typography
    from '@dxos/react-ui/Typography';
    import { type
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ,
    const CONTACTS: Contact[]
    CONTACTS
    } from '../contacts.ts';
    import {
    const ContactEditor: ({ contact, onSave }: ContactEditorProps) => React.JSX.Element

    Edits a copy of contact; nothing changes until Save.

    ContactEditor
    } from '../inputs/ContactEditor.tsx';
    2 collapsed lines
    import {
    const ContactList: ({ contacts, selected, onSelect }: ContactListProps) => React.JSX.Element

    One row per contact; the list scrolls inside its own viewport.

    ContactList
    } from '../layout/ContactsScreen.tsx';
    type
    type EditDialogProps = {
    label: string;
    contact: Contact;
    onSave: (contact: Contact) => void;
    }
    EditDialogProps
    = {
    label: string
    label
    : string;
    contact: Contact
    contact
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ;
    onSave: (contact: Contact) => void
    onSave
    : (
    contact: Contact
    contact
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ) => void;
    };
    /** The editor from the last page, in a dialog that closes on Save. */
    export const
    const EditDialog: ({ label, contact, onSave }: EditDialogProps) => React.JSX.Element

    The editor from the last page, in a dialog that closes on Save.

    EditDialog
    = ({
    label: string
    label
    ,
    contact: Contact
    contact
    ,
    onSave: (contact: Contact) => void
    onSave
    }:
    type EditDialogProps = {
    label: string;
    contact: Contact;
    onSave: (contact: Contact) => void;
    }
    EditDialogProps
    ) => {
    const [
    const open: boolean
    open
    ,
    const setOpen: React.Dispatch<React.SetStateAction<boolean>>
    setOpen
    ] =
    useState<boolean>(initialState: boolean | (() => boolean)): [boolean, React.Dispatch<React.SetStateAction<boolean>>] (+1 overload)

    Returns a stateful value, and a function to update it.

    @version ― 16.8.0

    @see ― https://react.dev/reference/react/useState

    useState
    (false);
    return (
    <
    import Dialog
    Dialog
    .
    function Root({ lazyMount, unmountOnExit, closeOnInteractOutside, placement, ...props }: Dialog.RootProps): React.JSX.Element
    export Root
    Root
    open?: boolean | undefined

    The controlled open state of the dialog

    open
    ={
    const open: boolean
    open
    }
    onOpenChange?: ((details: OpenChangeDetails) => void) | undefined

    Function to call when the dialog's open state changes

    onOpenChange
    ={({
    open: boolean
    open
    }) =>
    const setOpen: (value: React.SetStateAction<boolean>) => void
    setOpen
    (
    open: boolean
    open
    )}>
    <
    import Dialog
    Dialog
    .
    const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the dialog from a Button.

    Trigger
    PolymorphicProps.asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    icon?: string | undefined

    Leading icon.

    icon
    ='ph--pencil-simple--regular'
    label?: string | undefined

    Visible text; children take precedence.

    Required: names the button (aria-label) and shows in a Tooltip.

    label
    ={
    label: string
    label
    }
    iconOnly?: boolean | undefined

    A control-sized square inset in a block-sized cell (follow-up 19), showing only the icon.

    iconOnly
    />
    </
    import Dialog
    Dialog
    .
    const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the dialog from a Button.

    Trigger
    >
    <
    import Dialog
    Dialog
    .
    const Content: React.ForwardRefExoticComponent<Omit<DialogContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    container?: React.RefObject<HTMLElement | null>;
    placement?: Dialog.Placement;
    scrim?: boolean;
    closeOnInteractOutside?: boolean;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled surface at level='raised' over a scrim, centred in the viewport: a column of Header, Body and Footer.

    Content
    >
    <
    import Dialog
    Dialog
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Dialog
    Dialog
    .
    const Title: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    srOnly?: boolean;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >{
    contact: Contact
    contact
    .
    name: string
    name
    }</
    import Dialog
    Dialog
    .
    const Title: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    srOnly?: boolean;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >
    <
    import Dialog
    Dialog
    .
    const CloseTrigger: React.ForwardRefExoticComponent<Omit<DialogCloseTriggerProps, "children"> & {
    children?: React.ReactNode;
    icon?: string;
    label?: string;
    } & React.RefAttributes<HTMLButtonElement>>
    export CloseTrigger
    CloseTrigger
    />
    </
    import Dialog
    Dialog
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Dialog
    Dialog
    .
    const Body: React.ForwardRefExoticComponent<Omit<Pick<ScrollAreaRootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<Layout.ContainerProps, "gap"> & {
    align?: "start" | "center";
    children?: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Body

    Composed scroll (decision 5): a gutter='md' Container as the viewport, so the thumb sits in the end gutter; gap spaces its rows, since they are the Container's own items. The element carries ScrollArea's data-scope, since parts cannot rescope a composed child (finding 10).

    Body
    >
    <
    const ContactEditor: ({ contact, onSave }: ContactEditorProps) => React.JSX.Element

    Edits a copy of contact; nothing changes until Save.

    ContactEditor
    contact: Contact
    contact
    ={
    contact: Contact
    contact
    }
    onSave: (contact: Contact) => void
    onSave
    ={(
    next: Contact
    next
    ) => {
    onSave: (contact: Contact) => void
    onSave
    (
    next: Contact
    next
    );
    const setOpen: (value: React.SetStateAction<boolean>) => void
    setOpen
    (false);
    }}
    />
    </
    import Dialog
    Dialog
    .
    const Body: React.ForwardRefExoticComponent<Omit<Pick<ScrollAreaRootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<Layout.ContainerProps, "gap"> & {
    align?: "start" | "center";
    children?: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Body

    Composed scroll (decision 5): a gutter='md' Container as the viewport, so the thumb sits in the end gutter; gap spaces its rows, since they are the Container's own items. The element carries ScrollArea's data-scope, since parts cannot rescope a composed child (finding 10).

    Body
    >
    </
    import Dialog
    Dialog
    .
    const Content: React.ForwardRefExoticComponent<Omit<DialogContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    container?: React.RefObject<HTMLElement | null>;
    placement?: Dialog.Placement;
    scrim?: boolean;
    closeOnInteractOutside?: boolean;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled surface at level='raised' over a scrim, centred in the viewport: a column of Header, Body and Footer.

    Content
    >
    </
    import Dialog
    Dialog
    .
    function Root({ lazyMount, unmountOnExit, closeOnInteractOutside, placement, ...props }: Dialog.RootProps): React.JSX.Element
    export Root
    Root
    >
    );
    };

    onSave saves the contact, then calls setOpen(false). A dialog that holds its own state would stay open after Save, because the editor’s Save button is not a Dialog.CloseTrigger.

  2. Ask before deleting. A popover is lighter than a dialog for a yes-or-no question. Popover.CloseTrigger closes it without deleting:

    import * as
    import Button
    Button
    from '@dxos/react-ui/Button';
    1 collapsed line
    import * as
    import Dialog
    Dialog
    from '@dxos/react-ui/Dialog';
    import * as
    import Layout
    Layout
    from '@dxos/react-ui/Layout';
    1 collapsed line
    import * as
    import Panel
    Panel
    from '@dxos/react-ui/Panel';
    import * as
    import Popover
    Popover
    from '@dxos/react-ui/Popover';
    42 collapsed lines
    import * as
    import Toast
    Toast
    from '@dxos/react-ui/Toast';
    import * as
    import Toolbar
    Toolbar
    from '@dxos/react-ui/Toolbar';
    import * as
    import Tooltip
    Tooltip
    from '@dxos/react-ui/Tooltip';
    import * as
    import Typography
    Typography
    from '@dxos/react-ui/Typography';
    import { type
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ,
    const CONTACTS: Contact[]
    CONTACTS
    } from '../contacts.ts';
    import {
    const ContactEditor: ({ contact, onSave }: ContactEditorProps) => React.JSX.Element

    Edits a copy of contact; nothing changes until Save.

    ContactEditor
    } from '../inputs/ContactEditor.tsx';
    import {
    const ContactList: ({ contacts, selected, onSelect }: ContactListProps) => React.JSX.Element

    One row per contact; the list scrolls inside its own viewport.

    ContactList
    } from '../layout/ContactsScreen.tsx';
    type
    type EditDialogProps = {
    label: string;
    contact: Contact;
    onSave: (contact: Contact) => void;
    }
    EditDialogProps
    = {
    label: string
    label
    : string;
    contact: Contact
    contact
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ;
    onSave: (contact: Contact) => void
    onSave
    : (
    contact: Contact
    contact
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ) => void;
    };
    /** The editor from the last page, in a dialog that closes on Save. */
    export const
    const EditDialog: ({ label, contact, onSave }: EditDialogProps) => React.JSX.Element

    The editor from the last page, in a dialog that closes on Save.

    EditDialog
    = ({
    label: string
    label
    ,
    contact: Contact
    contact
    ,
    onSave: (contact: Contact) => void
    onSave
    }:
    type EditDialogProps = {
    label: string;
    contact: Contact;
    onSave: (contact: Contact) => void;
    }
    EditDialogProps
    ) => {
    const [
    const open: boolean
    open
    ,
    const setOpen: React.Dispatch<React.SetStateAction<boolean>>
    setOpen
    ] =
    useState<boolean>(initialState: boolean | (() => boolean)): [boolean, React.Dispatch<React.SetStateAction<boolean>>] (+1 overload)

    Returns a stateful value, and a function to update it.

    @version ― 16.8.0

    @see ― https://react.dev/reference/react/useState

    useState
    (false);
    return (
    <
    import Dialog
    Dialog
    .
    function Root({ lazyMount, unmountOnExit, closeOnInteractOutside, placement, ...props }: Dialog.RootProps): React.JSX.Element
    export Root
    Root
    open?: boolean | undefined

    The controlled open state of the dialog

    open
    ={
    const open: boolean
    open
    }
    onOpenChange?: ((details: OpenChangeDetails) => void) | undefined

    Function to call when the dialog's open state changes

    onOpenChange
    ={({
    open: boolean
    open
    }) =>
    const setOpen: (value: React.SetStateAction<boolean>) => void
    setOpen
    (
    open: boolean
    open
    )}>
    <
    import Dialog
    Dialog
    .
    const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the dialog from a Button.

    Trigger
    PolymorphicProps.asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    icon?: string | undefined

    Leading icon.

    icon
    ='ph--pencil-simple--regular'
    label?: string | undefined

    Visible text; children take precedence.

    Required: names the button (aria-label) and shows in a Tooltip.

    label
    ={
    label: string
    label
    }
    iconOnly?: boolean | undefined

    A control-sized square inset in a block-sized cell (follow-up 19), showing only the icon.

    iconOnly
    />
    </
    import Dialog
    Dialog
    .
    const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the dialog from a Button.

    Trigger
    >
    <
    import Dialog
    Dialog
    .
    const Content: React.ForwardRefExoticComponent<Omit<DialogContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    container?: React.RefObject<HTMLElement | null>;
    placement?: Dialog.Placement;
    scrim?: boolean;
    closeOnInteractOutside?: boolean;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled surface at level='raised' over a scrim, centred in the viewport: a column of Header, Body and Footer.

    Content
    >
    <
    import Dialog
    Dialog
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Dialog
    Dialog
    .
    const Title: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    srOnly?: boolean;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >{
    contact: Contact
    contact
    .
    name: string
    name
    }</
    import Dialog
    Dialog
    .
    const Title: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    srOnly?: boolean;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >
    <
    import Dialog
    Dialog
    .
    const CloseTrigger: React.ForwardRefExoticComponent<Omit<DialogCloseTriggerProps, "children"> & {
    children?: React.ReactNode;
    icon?: string;
    label?: string;
    } & React.RefAttributes<HTMLButtonElement>>
    export CloseTrigger
    CloseTrigger
    />
    </
    import Dialog
    Dialog
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Dialog
    Dialog
    .
    const Body: React.ForwardRefExoticComponent<Omit<Pick<ScrollAreaRootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<Layout.ContainerProps, "gap"> & {
    align?: "start" | "center";
    children?: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Body

    Composed scroll (decision 5): a gutter='md' Container as the viewport, so the thumb sits in the end gutter; gap spaces its rows, since they are the Container's own items. The element carries ScrollArea's data-scope, since parts cannot rescope a composed child (finding 10).

    Body
    >
    <
    const ContactEditor: ({ contact, onSave }: ContactEditorProps) => React.JSX.Element

    Edits a copy of contact; nothing changes until Save.

    ContactEditor
    contact: Contact
    contact
    ={
    contact: Contact
    contact
    }
    onSave: (contact: Contact) => void
    onSave
    ={(
    next: Contact
    next
    ) => {
    onSave: (contact: Contact) => void
    onSave
    (
    next: Contact
    next
    );
    const setOpen: (value: React.SetStateAction<boolean>) => void
    setOpen
    (false);
    }}
    />
    </
    import Dialog
    Dialog
    .
    const Body: React.ForwardRefExoticComponent<Omit<Pick<ScrollAreaRootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<Layout.ContainerProps, "gap"> & {
    align?: "start" | "center";
    children?: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Body

    Composed scroll (decision 5): a gutter='md' Container as the viewport, so the thumb sits in the end gutter; gap spaces its rows, since they are the Container's own items. The element carries ScrollArea's data-scope, since parts cannot rescope a composed child (finding 10).

    Body
    >
    </
    import Dialog
    Dialog
    .
    const Content: React.ForwardRefExoticComponent<Omit<DialogContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    container?: React.RefObject<HTMLElement | null>;
    placement?: Dialog.Placement;
    scrim?: boolean;
    closeOnInteractOutside?: boolean;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled surface at level='raised' over a scrim, centred in the viewport: a column of Header, Body and Footer.

    Content
    >
    </
    import Dialog
    Dialog
    .
    function Root({ lazyMount, unmountOnExit, closeOnInteractOutside, placement, ...props }: Dialog.RootProps): React.JSX.Element
    export Root
    Root
    >
    );
    };
    /** Asks before it deletes, in a popover beside the button. */
    type
    type DeletePopoverProps = {
    label: string;
    onDelete: () => void;
    }

    Asks before it deletes, in a popover beside the button.

    DeletePopoverProps
    = {
    label: string
    label
    : string;
    onDelete: () => void
    onDelete
    : () => void;
    };
    export const
    const DeletePopover: ({ label, onDelete }: DeletePopoverProps) => React.JSX.Element
    DeletePopover
    = ({
    label: string
    label
    ,
    onDelete: () => void
    onDelete
    }:
    type DeletePopoverProps = {
    label: string;
    onDelete: () => void;
    }

    Asks before it deletes, in a popover beside the button.

    DeletePopoverProps
    ) => (
    <
    import Popover
    Popover
    .
    function Root({ lazyMount, unmountOnExit, positioning, ...props }: Popover.RootProps): React.JSX.Element
    export Root
    Root
    >
    <
    import Popover
    Popover
    .
    const Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the popover from a Button.

    Trigger
    PolymorphicProps.asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    variant?: Button.Variant | undefined
    variant
    ='destructive'
    icon?: string | undefined

    Leading icon.

    icon
    ='ph--trash--regular'
    label?: string | undefined

    Visible text; children take precedence.

    Required: names the button (aria-label) and shows in a Tooltip.

    label
    ={
    label: string
    label
    }
    iconOnly?: boolean | undefined

    A control-sized square inset in a block-sized cell (follow-up 19), showing only the icon.

    iconOnly
    />
    </
    import Popover
    Popover
    .
    const Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the popover from a Button.

    Trigger
    >
    <
    import Popover
    Popover
    .
    const Content: React.ForwardRefExoticComponent<Omit<PopoverContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    arrow?: boolean;
    container?: React.RefObject<HTMLElement | null>;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled panel at level='popup', padded by the size's gap, with an arrow unless arrow={false}.

    Content
    >
    <
    import Popover
    Popover
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Popover
    Popover
    .
    const Title: React.ForwardRefExoticComponent<Omit<PopoverTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >Delete this contact?</
    import Popover
    Popover
    .
    const Title: React.ForwardRefExoticComponent<Omit<PopoverTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >
    </
    import Popover
    Popover
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>

    One-axis layout box: the primitive that replaces hand-written flex … wrapper divs.

    gap is restricted to the named steps of the theme spacing ramp (see

    Gap

    ), which is the point of the prop — an off-ramp gap-2/gap-3 literal in a container is the drift it prevents. Anything the props don't cover (padding, sizing, overflow, colour) goes through classNames; the component deliberately grows no padding or colour props, since components own their own spacing.

    There is no implicit align. Row-centering is the common case, but defaulting it would silently restyle any consumer relying on the CSS stretch initial value.

    Use asChild to project the layout onto a semantic element (<header>, <ul>, <a>).

    @example

    <Flex column gap='sm'>…</Flex>
    <Flex gap='sm' justify='end'>…</Flex>
    <Flex center classNames='h-full text-fg-subtle' role='status'>{t('empty.message')}</Flex>

    Flex
    gap?: Layout.Gap | undefined
    gap
    ='sm'
    justify?: Layout.Justify | undefined
    justify
    ='end'>
    <
    import Popover
    Popover
    .
    const CloseTrigger: React.ForwardRefExoticComponent<Omit<PopoverCloseTriggerProps, "children"> & {
    children?: React.ReactNode;
    icon?: string;
    label?: string;
    } & React.RefAttributes<HTMLButtonElement>>
    export CloseTrigger
    CloseTrigger
    asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    >Keep</
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    >
    </
    import Popover
    Popover
    .
    const CloseTrigger: React.ForwardRefExoticComponent<Omit<PopoverCloseTriggerProps, "children"> & {
    children?: React.ReactNode;
    icon?: string;
    label?: string;
    } & React.RefAttributes<HTMLButtonElement>>
    export CloseTrigger
    CloseTrigger
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    variant?: Button.Variant | undefined
    variant
    ='destructive'
    onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined
    onClick
    ={
    onDelete: () => void
    onDelete
    }>
    Delete
    </
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    >
    </
    import Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>

    One-axis layout box: the primitive that replaces hand-written flex … wrapper divs.

    gap is restricted to the named steps of the theme spacing ramp (see

    Gap

    ), which is the point of the prop — an off-ramp gap-2/gap-3 literal in a container is the drift it prevents. Anything the props don't cover (padding, sizing, overflow, colour) goes through classNames; the component deliberately grows no padding or colour props, since components own their own spacing.

    There is no implicit align. Row-centering is the common case, but defaulting it would silently restyle any consumer relying on the CSS stretch initial value.

    Use asChild to project the layout onto a semantic element (<header>, <ul>, <a>).

    @example

    <Flex column gap='sm'>…</Flex>
    <Flex gap='sm' justify='end'>…</Flex>
    <Flex center classNames='h-full text-fg-subtle' role='status'>{t('empty.message')}</Flex>

    Flex
    >
    </
    import Popover
    Popover
    .
    const Content: React.ForwardRefExoticComponent<Omit<PopoverContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    arrow?: boolean;
    container?: React.RefObject<HTMLElement | null>;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled panel at level='popup', padded by the size's gap, with an arrow unless arrow={false}.

    Content
    >
    </
    import Popover
    Popover
    .
    function Root({ lazyMount, unmountOnExit, positioning, ...props }: Popover.RootProps): React.JSX.Element
    export Root
    Root
    >
    );

    The destructive Button.Root calls onDelete and closes nothing itself. Step 4 clears the selection on a delete, and the screen then stops rendering DeletePopover.

  3. Explain the role. A tooltip can wrap any element, not only a button:

    import * as
    import Tooltip
    Tooltip
    from '@dxos/react-ui/Tooltip';
    import * as
    import Typography
    Typography
    from '@dxos/react-ui/Typography';
    65 collapsed lines
    import { type
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ,
    const CONTACTS: Contact[]
    CONTACTS
    } from '../contacts.ts';
    import {
    const ContactEditor: ({ contact, onSave }: ContactEditorProps) => React.JSX.Element

    Edits a copy of contact; nothing changes until Save.

    ContactEditor
    } from '../inputs/ContactEditor.tsx';
    import {
    const ContactList: ({ contacts, selected, onSelect }: ContactListProps) => React.JSX.Element

    One row per contact; the list scrolls inside its own viewport.

    ContactList
    } from '../layout/ContactsScreen.tsx';
    type
    type EditDialogProps = {
    label: string;
    contact: Contact;
    onSave: (contact: Contact) => void;
    }
    EditDialogProps
    = {
    label: string
    label
    : string;
    contact: Contact
    contact
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ;
    onSave: (contact: Contact) => void
    onSave
    : (
    contact: Contact
    contact
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ) => void;
    };
    /** The editor from the last page, in a dialog that closes on Save. */
    export const
    const EditDialog: ({ label, contact, onSave }: EditDialogProps) => React.JSX.Element

    The editor from the last page, in a dialog that closes on Save.

    EditDialog
    = ({
    label: string
    label
    ,
    contact: Contact
    contact
    ,
    onSave: (contact: Contact) => void
    onSave
    }:
    type EditDialogProps = {
    label: string;
    contact: Contact;
    onSave: (contact: Contact) => void;
    }
    EditDialogProps
    ) => {
    const [
    const open: boolean
    open
    ,
    const setOpen: React.Dispatch<React.SetStateAction<boolean>>
    setOpen
    ] =
    useState<boolean>(initialState: boolean | (() => boolean)): [boolean, React.Dispatch<React.SetStateAction<boolean>>] (+1 overload)

    Returns a stateful value, and a function to update it.

    @version ― 16.8.0

    @see ― https://react.dev/reference/react/useState

    useState
    (false);
    return (
    <
    import Dialog
    Dialog
    .
    function Root({ lazyMount, unmountOnExit, closeOnInteractOutside, placement, ...props }: Dialog.RootProps): React.JSX.Element
    export Root
    Root
    open?: boolean | undefined

    The controlled open state of the dialog

    open
    ={
    const open: boolean
    open
    }
    onOpenChange?: ((details: OpenChangeDetails) => void) | undefined

    Function to call when the dialog's open state changes

    onOpenChange
    ={({
    open: boolean
    open
    }) =>
    const setOpen: (value: React.SetStateAction<boolean>) => void
    setOpen
    (
    open: boolean
    open
    )}>
    <
    import Dialog
    Dialog
    .
    const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the dialog from a Button.

    Trigger
    PolymorphicProps.asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    icon?: string | undefined

    Leading icon.

    icon
    ='ph--pencil-simple--regular'
    label?: string | undefined

    Visible text; children take precedence.

    Required: names the button (aria-label) and shows in a Tooltip.

    label
    ={
    label: string
    label
    }
    iconOnly?: boolean | undefined

    A control-sized square inset in a block-sized cell (follow-up 19), showing only the icon.

    iconOnly
    />
    </
    import Dialog
    Dialog
    .
    const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the dialog from a Button.

    Trigger
    >
    <
    import Dialog
    Dialog
    .
    const Content: React.ForwardRefExoticComponent<Omit<DialogContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    container?: React.RefObject<HTMLElement | null>;
    placement?: Dialog.Placement;
    scrim?: boolean;
    closeOnInteractOutside?: boolean;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled surface at level='raised' over a scrim, centred in the viewport: a column of Header, Body and Footer.

    Content
    >
    <
    import Dialog
    Dialog
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Dialog
    Dialog
    .
    const Title: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    srOnly?: boolean;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >{
    contact: Contact
    contact
    .
    name: string
    name
    }</
    import Dialog
    Dialog
    .
    const Title: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    srOnly?: boolean;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >
    <
    import Dialog
    Dialog
    .
    const CloseTrigger: React.ForwardRefExoticComponent<Omit<DialogCloseTriggerProps, "children"> & {
    children?: React.ReactNode;
    icon?: string;
    label?: string;
    } & React.RefAttributes<HTMLButtonElement>>
    export CloseTrigger
    CloseTrigger
    />
    </
    import Dialog
    Dialog
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Dialog
    Dialog
    .
    const Body: React.ForwardRefExoticComponent<Omit<Pick<ScrollAreaRootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<Layout.ContainerProps, "gap"> & {
    align?: "start" | "center";
    children?: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Body

    Composed scroll (decision 5): a gutter='md' Container as the viewport, so the thumb sits in the end gutter; gap spaces its rows, since they are the Container's own items. The element carries ScrollArea's data-scope, since parts cannot rescope a composed child (finding 10).

    Body
    >
    <
    const ContactEditor: ({ contact, onSave }: ContactEditorProps) => React.JSX.Element

    Edits a copy of contact; nothing changes until Save.

    ContactEditor
    contact: Contact
    contact
    ={
    contact: Contact
    contact
    }
    onSave: (contact: Contact) => void
    onSave
    ={(
    next: Contact
    next
    ) => {
    onSave: (contact: Contact) => void
    onSave
    (
    next: Contact
    next
    );
    const setOpen: (value: React.SetStateAction<boolean>) => void
    setOpen
    (false);
    }}
    />
    </
    import Dialog
    Dialog
    .
    const Body: React.ForwardRefExoticComponent<Omit<Pick<ScrollAreaRootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<Layout.ContainerProps, "gap"> & {
    align?: "start" | "center";
    children?: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Body

    Composed scroll (decision 5): a gutter='md' Container as the viewport, so the thumb sits in the end gutter; gap spaces its rows, since they are the Container's own items. The element carries ScrollArea's data-scope, since parts cannot rescope a composed child (finding 10).

    Body
    >
    </
    import Dialog
    Dialog
    .
    const Content: React.ForwardRefExoticComponent<Omit<DialogContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    container?: React.RefObject<HTMLElement | null>;
    placement?: Dialog.Placement;
    scrim?: boolean;
    closeOnInteractOutside?: boolean;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled surface at level='raised' over a scrim, centred in the viewport: a column of Header, Body and Footer.

    Content
    >
    </
    import Dialog
    Dialog
    .
    function Root({ lazyMount, unmountOnExit, closeOnInteractOutside, placement, ...props }: Dialog.RootProps): React.JSX.Element
    export Root
    Root
    >
    );
    };
    /** Asks before it deletes, in a popover beside the button. */
    type
    type DeletePopoverProps = {
    label: string;
    onDelete: () => void;
    }

    Asks before it deletes, in a popover beside the button.

    DeletePopoverProps
    = {
    label: string
    label
    : string;
    onDelete: () => void
    onDelete
    : () => void;
    };
    export const
    const DeletePopover: ({ label, onDelete }: DeletePopoverProps) => React.JSX.Element
    DeletePopover
    = ({
    label: string
    label
    ,
    onDelete: () => void
    onDelete
    }:
    type DeletePopoverProps = {
    label: string;
    onDelete: () => void;
    }

    Asks before it deletes, in a popover beside the button.

    DeletePopoverProps
    ) => (
    <
    import Popover
    Popover
    .
    function Root({ lazyMount, unmountOnExit, positioning, ...props }: Popover.RootProps): React.JSX.Element
    export Root
    Root
    >
    <
    import Popover
    Popover
    .
    const Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the popover from a Button.

    Trigger
    PolymorphicProps.asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    variant?: Button.Variant | undefined
    variant
    ='destructive'
    icon?: string | undefined

    Leading icon.

    icon
    ='ph--trash--regular'
    label?: string | undefined

    Visible text; children take precedence.

    Required: names the button (aria-label) and shows in a Tooltip.

    label
    ={
    label: string
    label
    }
    iconOnly?: boolean | undefined

    A control-sized square inset in a block-sized cell (follow-up 19), showing only the icon.

    iconOnly
    />
    </
    import Popover
    Popover
    .
    const Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the popover from a Button.

    Trigger
    >
    <
    import Popover
    Popover
    .
    const Content: React.ForwardRefExoticComponent<Omit<PopoverContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    arrow?: boolean;
    container?: React.RefObject<HTMLElement | null>;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled panel at level='popup', padded by the size's gap, with an arrow unless arrow={false}.

    Content
    >
    <
    import Popover
    Popover
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Popover
    Popover
    .
    const Title: React.ForwardRefExoticComponent<Omit<PopoverTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >Delete this contact?</
    import Popover
    Popover
    .
    const Title: React.ForwardRefExoticComponent<Omit<PopoverTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >
    </
    import Popover
    Popover
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>

    One-axis layout box: the primitive that replaces hand-written flex … wrapper divs.

    gap is restricted to the named steps of the theme spacing ramp (see

    Gap

    ), which is the point of the prop — an off-ramp gap-2/gap-3 literal in a container is the drift it prevents. Anything the props don't cover (padding, sizing, overflow, colour) goes through classNames; the component deliberately grows no padding or colour props, since components own their own spacing.

    There is no implicit align. Row-centering is the common case, but defaulting it would silently restyle any consumer relying on the CSS stretch initial value.

    Use asChild to project the layout onto a semantic element (<header>, <ul>, <a>).

    @example

    <Flex column gap='sm'>…</Flex>
    <Flex gap='sm' justify='end'>…</Flex>
    <Flex center classNames='h-full text-fg-subtle' role='status'>{t('empty.message')}</Flex>

    Flex
    gap?: Layout.Gap | undefined
    gap
    ='sm'
    justify?: Layout.Justify | undefined
    justify
    ='end'>
    <
    import Popover
    Popover
    .
    const CloseTrigger: React.ForwardRefExoticComponent<Omit<PopoverCloseTriggerProps, "children"> & {
    children?: React.ReactNode;
    icon?: string;
    label?: string;
    } & React.RefAttributes<HTMLButtonElement>>
    export CloseTrigger
    CloseTrigger
    asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    >Keep</
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    >
    </
    import Popover
    Popover
    .
    const CloseTrigger: React.ForwardRefExoticComponent<Omit<PopoverCloseTriggerProps, "children"> & {
    children?: React.ReactNode;
    icon?: string;
    label?: string;
    } & React.RefAttributes<HTMLButtonElement>>
    export CloseTrigger
    CloseTrigger
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    variant?: Button.Variant | undefined
    variant
    ='destructive'
    onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined
    onClick
    ={
    onDelete: () => void
    onDelete
    }>
    Delete
    </
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    >
    </
    import Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>

    One-axis layout box: the primitive that replaces hand-written flex … wrapper divs.

    gap is restricted to the named steps of the theme spacing ramp (see

    Gap

    ), which is the point of the prop — an off-ramp gap-2/gap-3 literal in a container is the drift it prevents. Anything the props don't cover (padding, sizing, overflow, colour) goes through classNames; the component deliberately grows no padding or colour props, since components own their own spacing.

    There is no implicit align. Row-centering is the common case, but defaulting it would silently restyle any consumer relying on the CSS stretch initial value.

    Use asChild to project the layout onto a semantic element (<header>, <ul>, <a>).

    @example

    <Flex column gap='sm'>…</Flex>
    <Flex gap='sm' justify='end'>…</Flex>
    <Flex center classNames='h-full text-fg-subtle' role='status'>{t('empty.message')}</Flex>

    Flex
    >
    </
    import Popover
    Popover
    .
    const Content: React.ForwardRefExoticComponent<Omit<PopoverContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    arrow?: boolean;
    container?: React.RefObject<HTMLElement | null>;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled panel at level='popup', padded by the size's gap, with an arrow unless arrow={false}.

    Content
    >
    </
    import Popover
    Popover
    .
    function Root({ lazyMount, unmountOnExit, positioning, ...props }: Popover.RootProps): React.JSX.Element
    export Root
    Root
    >
    );
    const
    const ROLE_HELP: Record<string, string>
    ROLE_HELP
    :
    type Record<K extends keyof any, T> = { [P in K]: T; }

    Construct a type with a set of properties K of type T

    Record
    <string, string> = {
    viewer: string
    viewer
    : 'Can read the contact book',
    editor: string
    editor
    : 'Can change contacts',
    admin: string
    admin
    : 'Can change contacts and who has access',
    };
    /** The role, with what it allows in a tooltip. */
    export const
    const Role: ({ role }: {
    role: string;
    }) => React.JSX.Element

    The role, with what it allows in a tooltip.

    Role
    = ({
    role: string
    role
    }: {
    role: string
    role
    : string }) => (
    <
    import Tooltip
    Tooltip
    .
    function Root({ openDelay, lazyMount, unmountOnExit, positioning, ...props }: Tooltip.RootProps): React.JSX.Element
    export Root
    Root
    >
    <
    import Tooltip
    Tooltip
    .
    const Trigger: React.ForwardRefExoticComponent<Omit<TooltipTriggerProps, "content"> & {
    content?: React.ReactNode;
    side?: Tooltip.Side;
    } & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to describe a Button. Opens on hover after the Root's delay and on keyboard focus only; the delay runs here because zag skips it while any tooltip is marked open, so a click would flash one (DESIGN.md follow-up 33). With content it needs no Root or Content around it.

    Trigger
    asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    {/* Focusable, so a keyboard user can open the tooltip too. */}
    <
    React.JSX.IntrinsicElements.span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>
    span
    React.HTMLAttributes<HTMLSpanElement>.tabIndex?: number | undefined
    tabIndex
    ={0}>
    <
    import Typography
    Typography
    .
    const Text: React.ForwardRefExoticComponent<Omit<Typography.TextProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLParagraphElement>>
    export Text

    Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.

    Text
    tone?: Typography.TextTone | undefined

    Emphasis below the default (DESIGN.md "Text emphasis"): description for secondary content, subdued for interface text.

    tone
    ='muted'>Role: {
    role: string
    role
    }</
    import Typography
    Typography
    .
    const Text: React.ForwardRefExoticComponent<Omit<Typography.TextProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLParagraphElement>>
    export Text

    Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.

    Text
    >
    </
    React.JSX.IntrinsicElements.span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>
    span
    >
    </
    import Tooltip
    Tooltip
    .
    const Trigger: React.ForwardRefExoticComponent<Omit<TooltipTriggerProps, "content"> & {
    content?: React.ReactNode;
    side?: Tooltip.Side;
    } & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to describe a Button. Opens on hover after the Root's delay and on keyboard focus only; the delay runs here because zag skips it while any tooltip is marked open, so a click would flash one (DESIGN.md follow-up 33). With content it needs no Root or Content around it.

    Trigger
    >
    <
    import Tooltip
    Tooltip
    .
    const Content: React.ForwardRefExoticComponent<Omit<TooltipContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    arrow?: boolean;
    container?: React.RefObject<HTMLElement | null>;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled text on the inverted surface (as the current Tooltip; no data-surface, whose popup fill it would fight), capped at 20rem wide, with an arrow unless arrow={false}.

    Content
    >{
    const ROLE_HELP: Record<string, string>
    ROLE_HELP
    [
    role: string
    role
    ]}</
    import Tooltip
    Tooltip
    .
    const Content: React.ForwardRefExoticComponent<Omit<TooltipContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    arrow?: boolean;
    container?: React.RefObject<HTMLElement | null>;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled text on the inverted surface (as the current Tooltip; no data-surface, whose popup fill it would fight), capped at 20rem wide, with an arrow unless arrow={false}.

    Content
    >
    </
    import Tooltip
    Tooltip
    .
    function Root({ openDelay, lazyMount, unmountOnExit, positioning, ...props }: Tooltip.RootProps): React.JSX.Element
    export Root
    Root
    >
    );

    ROLE_HELP keeps its strings in the component for now. The next page moves them into a translation resource.

  4. Put them on the screen. Edit and Delete go in the toolbar, after the gap that pushes them to the end. Toast.Provider wraps the screen, and Toast.Toaster is where toasts appear. The toast is open while saved holds a name.

    Add the screen to the same file, and render it from src/main.tsx:

    import
    (alias) namespace React
    import React
    React
    , {
    function useState<S>(initialState: S | (() => S)): [S, React.Dispatch<React.SetStateAction<S>>] (+1 overload)

    Returns a stateful value, and a function to update it.

    @version ― 16.8.0

    @see ― https://react.dev/reference/react/useState

    useState
    } from 'react';
    3 collapsed lines
    import * as
    import Button
    Button
    from '@dxos/react-ui/Button';
    import * as
    import Dialog
    Dialog
    from '@dxos/react-ui/Dialog';
    import * as
    import Layout
    Layout
    from '@dxos/react-ui/Layout';
    import * as
    import Panel
    Panel
    from '@dxos/react-ui/Panel';
    1 collapsed line
    import * as
    import Popover
    Popover
    from '@dxos/react-ui/Popover';
    import * as
    import Toast
    Toast
    from '@dxos/react-ui/Toast';
    import * as
    import Toolbar
    Toolbar
    from '@dxos/react-ui/Toolbar';
    1 collapsed line
    import * as
    import Tooltip
    Tooltip
    from '@dxos/react-ui/Tooltip';
    import * as
    import Typography
    Typography
    from '@dxos/react-ui/Typography';
    import { type
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ,
    const CONTACTS: Contact[]
    CONTACTS
    } from '../contacts.ts';
    1 collapsed line
    import {
    const ContactEditor: ({ contact, onSave }: ContactEditorProps) => React.JSX.Element

    Edits a copy of contact; nothing changes until Save.

    ContactEditor
    } from '../inputs/ContactEditor.tsx';
    import {
    const ContactList: ({ contacts, selected, onSelect }: ContactListProps) => React.JSX.Element

    One row per contact; the list scrolls inside its own viewport.

    ContactList
    } from '../layout/ContactsScreen.tsx';
    80 collapsed lines
    type
    type EditDialogProps = {
    label: string;
    contact: Contact;
    onSave: (contact: Contact) => void;
    }
    EditDialogProps
    = {
    label: string
    label
    : string;
    contact: Contact
    contact
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ;
    onSave: (contact: Contact) => void
    onSave
    : (
    contact: Contact
    contact
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ) => void;
    };
    /** The editor from the last page, in a dialog that closes on Save. */
    export const
    const EditDialog: ({ label, contact, onSave }: EditDialogProps) => React.JSX.Element

    The editor from the last page, in a dialog that closes on Save.

    EditDialog
    = ({
    label: string
    label
    ,
    contact: Contact
    contact
    ,
    onSave: (contact: Contact) => void
    onSave
    }:
    type EditDialogProps = {
    label: string;
    contact: Contact;
    onSave: (contact: Contact) => void;
    }
    EditDialogProps
    ) => {
    const [
    const open: boolean
    open
    ,
    const setOpen: React.Dispatch<React.SetStateAction<boolean>>
    setOpen
    ] =
    useState<boolean>(initialState: boolean | (() => boolean)): [boolean, React.Dispatch<React.SetStateAction<boolean>>] (+1 overload)

    Returns a stateful value, and a function to update it.

    @version ― 16.8.0

    @see ― https://react.dev/reference/react/useState

    useState
    (false);
    return (
    <
    import Dialog
    Dialog
    .
    function Root({ lazyMount, unmountOnExit, closeOnInteractOutside, placement, ...props }: Dialog.RootProps): React.JSX.Element
    export Root
    Root
    open?: boolean | undefined

    The controlled open state of the dialog

    open
    ={
    const open: boolean
    open
    }
    onOpenChange?: ((details: OpenChangeDetails) => void) | undefined

    Function to call when the dialog's open state changes

    onOpenChange
    ={({
    open: boolean
    open
    }) =>
    const setOpen: (value: React.SetStateAction<boolean>) => void
    setOpen
    (
    open: boolean
    open
    )}>
    <
    import Dialog
    Dialog
    .
    const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the dialog from a Button.

    Trigger
    PolymorphicProps.asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    icon?: string | undefined

    Leading icon.

    icon
    ='ph--pencil-simple--regular'
    label?: string | undefined

    Visible text; children take precedence.

    Required: names the button (aria-label) and shows in a Tooltip.

    label
    ={
    label: string
    label
    }
    iconOnly?: boolean | undefined

    A control-sized square inset in a block-sized cell (follow-up 19), showing only the icon.

    iconOnly
    />
    </
    import Dialog
    Dialog
    .
    const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the dialog from a Button.

    Trigger
    >
    <
    import Dialog
    Dialog
    .
    const Content: React.ForwardRefExoticComponent<Omit<DialogContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    container?: React.RefObject<HTMLElement | null>;
    placement?: Dialog.Placement;
    scrim?: boolean;
    closeOnInteractOutside?: boolean;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled surface at level='raised' over a scrim, centred in the viewport: a column of Header, Body and Footer.

    Content
    >
    <
    import Dialog
    Dialog
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Dialog
    Dialog
    .
    const Title: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    srOnly?: boolean;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >{
    contact: Contact
    contact
    .
    name: string
    name
    }</
    import Dialog
    Dialog
    .
    const Title: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    srOnly?: boolean;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >
    <
    import Dialog
    Dialog
    .
    const CloseTrigger: React.ForwardRefExoticComponent<Omit<DialogCloseTriggerProps, "children"> & {
    children?: React.ReactNode;
    icon?: string;
    label?: string;
    } & React.RefAttributes<HTMLButtonElement>>
    export CloseTrigger
    CloseTrigger
    />
    </
    import Dialog
    Dialog
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Dialog
    Dialog
    .
    const Body: React.ForwardRefExoticComponent<Omit<Pick<ScrollAreaRootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<Layout.ContainerProps, "gap"> & {
    align?: "start" | "center";
    children?: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Body

    Composed scroll (decision 5): a gutter='md' Container as the viewport, so the thumb sits in the end gutter; gap spaces its rows, since they are the Container's own items. The element carries ScrollArea's data-scope, since parts cannot rescope a composed child (finding 10).

    Body
    >
    <
    const ContactEditor: ({ contact, onSave }: ContactEditorProps) => React.JSX.Element

    Edits a copy of contact; nothing changes until Save.

    ContactEditor
    contact: Contact
    contact
    ={
    contact: Contact
    contact
    }
    onSave: (contact: Contact) => void
    onSave
    ={(
    next: Contact
    next
    ) => {
    onSave: (contact: Contact) => void
    onSave
    (
    next: Contact
    next
    );
    const setOpen: (value: React.SetStateAction<boolean>) => void
    setOpen
    (false);
    }}
    />
    </
    import Dialog
    Dialog
    .
    const Body: React.ForwardRefExoticComponent<Omit<Pick<ScrollAreaRootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<Layout.ContainerProps, "gap"> & {
    align?: "start" | "center";
    children?: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Body

    Composed scroll (decision 5): a gutter='md' Container as the viewport, so the thumb sits in the end gutter; gap spaces its rows, since they are the Container's own items. The element carries ScrollArea's data-scope, since parts cannot rescope a composed child (finding 10).

    Body
    >
    </
    import Dialog
    Dialog
    .
    const Content: React.ForwardRefExoticComponent<Omit<DialogContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    container?: React.RefObject<HTMLElement | null>;
    placement?: Dialog.Placement;
    scrim?: boolean;
    closeOnInteractOutside?: boolean;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled surface at level='raised' over a scrim, centred in the viewport: a column of Header, Body and Footer.

    Content
    >
    </
    import Dialog
    Dialog
    .
    function Root({ lazyMount, unmountOnExit, closeOnInteractOutside, placement, ...props }: Dialog.RootProps): React.JSX.Element
    export Root
    Root
    >
    );
    };
    /** Asks before it deletes, in a popover beside the button. */
    type
    type DeletePopoverProps = {
    label: string;
    onDelete: () => void;
    }

    Asks before it deletes, in a popover beside the button.

    DeletePopoverProps
    = {
    label: string
    label
    : string;
    onDelete: () => void
    onDelete
    : () => void;
    };
    export const
    const DeletePopover: ({ label, onDelete }: DeletePopoverProps) => React.JSX.Element
    DeletePopover
    = ({
    label: string
    label
    ,
    onDelete: () => void
    onDelete
    }:
    type DeletePopoverProps = {
    label: string;
    onDelete: () => void;
    }

    Asks before it deletes, in a popover beside the button.

    DeletePopoverProps
    ) => (
    <
    import Popover
    Popover
    .
    function Root({ lazyMount, unmountOnExit, positioning, ...props }: Popover.RootProps): React.JSX.Element
    export Root
    Root
    >
    <
    import Popover
    Popover
    .
    const Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the popover from a Button.

    Trigger
    PolymorphicProps.asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    variant?: Button.Variant | undefined
    variant
    ='destructive'
    icon?: string | undefined

    Leading icon.

    icon
    ='ph--trash--regular'
    label?: string | undefined

    Visible text; children take precedence.

    Required: names the button (aria-label) and shows in a Tooltip.

    label
    ={
    label: string
    label
    }
    iconOnly?: boolean | undefined

    A control-sized square inset in a block-sized cell (follow-up 19), showing only the icon.

    iconOnly
    />
    </
    import Popover
    Popover
    .
    const Trigger: React.ForwardRefExoticComponent<PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to open the popover from a Button.

    Trigger
    >
    <
    import Popover
    Popover
    .
    const Content: React.ForwardRefExoticComponent<Omit<PopoverContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    arrow?: boolean;
    container?: React.RefObject<HTMLElement | null>;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled panel at level='popup', padded by the size's gap, with an arrow unless arrow={false}.

    Content
    >
    <
    import Popover
    Popover
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Popover
    Popover
    .
    const Title: React.ForwardRefExoticComponent<Omit<PopoverTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >Delete this contact?</
    import Popover
    Popover
    .
    const Title: React.ForwardRefExoticComponent<Omit<PopoverTitleProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLHeadingElement>>
    export Title
    Title
    >
    </
    import Popover
    Popover
    .
    const Header: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row holding the Title and an optional trailing CloseTrigger.

    Header
    >
    <
    import Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>

    One-axis layout box: the primitive that replaces hand-written flex … wrapper divs.

    gap is restricted to the named steps of the theme spacing ramp (see

    Gap

    ), which is the point of the prop — an off-ramp gap-2/gap-3 literal in a container is the drift it prevents. Anything the props don't cover (padding, sizing, overflow, colour) goes through classNames; the component deliberately grows no padding or colour props, since components own their own spacing.

    There is no implicit align. Row-centering is the common case, but defaulting it would silently restyle any consumer relying on the CSS stretch initial value.

    Use asChild to project the layout onto a semantic element (<header>, <ul>, <a>).

    @example

    <Flex column gap='sm'>…</Flex>
    <Flex gap='sm' justify='end'>…</Flex>
    <Flex center classNames='h-full text-fg-subtle' role='status'>{t('empty.message')}</Flex>

    Flex
    gap?: Layout.Gap | undefined
    gap
    ='sm'
    justify?: Layout.Justify | undefined
    justify
    ='end'>
    <
    import Popover
    Popover
    .
    const CloseTrigger: React.ForwardRefExoticComponent<Omit<PopoverCloseTriggerProps, "children"> & {
    children?: React.ReactNode;
    icon?: string;
    label?: string;
    } & React.RefAttributes<HTMLButtonElement>>
    export CloseTrigger
    CloseTrigger
    asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    >Keep</
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    >
    </
    import Popover
    Popover
    .
    const CloseTrigger: React.ForwardRefExoticComponent<Omit<PopoverCloseTriggerProps, "children"> & {
    children?: React.ReactNode;
    icon?: string;
    label?: string;
    } & React.RefAttributes<HTMLButtonElement>>
    export CloseTrigger
    CloseTrigger
    >
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    variant?: Button.Variant | undefined
    variant
    ='destructive'
    onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined
    onClick
    ={
    onDelete: () => void
    onDelete
    }>
    Delete
    </
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    >
    </
    import Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>

    One-axis layout box: the primitive that replaces hand-written flex … wrapper divs.

    gap is restricted to the named steps of the theme spacing ramp (see

    Gap

    ), which is the point of the prop — an off-ramp gap-2/gap-3 literal in a container is the drift it prevents. Anything the props don't cover (padding, sizing, overflow, colour) goes through classNames; the component deliberately grows no padding or colour props, since components own their own spacing.

    There is no implicit align. Row-centering is the common case, but defaulting it would silently restyle any consumer relying on the CSS stretch initial value.

    Use asChild to project the layout onto a semantic element (<header>, <ul>, <a>).

    @example

    <Flex column gap='sm'>…</Flex>
    <Flex gap='sm' justify='end'>…</Flex>
    <Flex center classNames='h-full text-fg-subtle' role='status'>{t('empty.message')}</Flex>

    Flex
    >
    </
    import Popover
    Popover
    .
    const Content: React.ForwardRefExoticComponent<Omit<PopoverContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    arrow?: boolean;
    container?: React.RefObject<HTMLElement | null>;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled panel at level='popup', padded by the size's gap, with an arrow unless arrow={false}.

    Content
    >
    </
    import Popover
    Popover
    .
    function Root({ lazyMount, unmountOnExit, positioning, ...props }: Popover.RootProps): React.JSX.Element
    export Root
    Root
    >
    );
    const
    const ROLE_HELP: Record<string, string>
    ROLE_HELP
    :
    type Record<K extends keyof any, T> = { [P in K]: T; }

    Construct a type with a set of properties K of type T

    Record
    <string, string> = {
    viewer: string
    viewer
    : 'Can read the contact book',
    editor: string
    editor
    : 'Can change contacts',
    admin: string
    admin
    : 'Can change contacts and who has access',
    };
    /** The role, with what it allows in a tooltip. */
    export const
    const Role: ({ role }: {
    role: string;
    }) => React.JSX.Element

    The role, with what it allows in a tooltip.

    Role
    = ({
    role: string
    role
    }: {
    role: string
    role
    : string }) => (
    <
    import Tooltip
    Tooltip
    .
    function Root({ openDelay, lazyMount, unmountOnExit, positioning, ...props }: Tooltip.RootProps): React.JSX.Element
    export Root
    Root
    >
    <
    import Tooltip
    Tooltip
    .
    const Trigger: React.ForwardRefExoticComponent<Omit<TooltipTriggerProps, "content"> & {
    content?: React.ReactNode;
    side?: Tooltip.Side;
    } & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to describe a Button. Opens on hover after the Root's delay and on keyboard focus only; the delay runs here because zag skips it while any tooltip is marked open, so a click would flash one (DESIGN.md follow-up 33). With content it needs no Root or Content around it.

    Trigger
    asChild?: boolean | undefined

    Use the provided child element as the default rendered element, combining their props and behavior.

    asChild
    >
    {/* Focusable, so a keyboard user can open the tooltip too. */}
    <
    React.JSX.IntrinsicElements.span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>
    span
    React.HTMLAttributes<HTMLSpanElement>.tabIndex?: number | undefined
    tabIndex
    ={0}>
    <
    import Typography
    Typography
    .
    const Text: React.ForwardRefExoticComponent<Omit<Typography.TextProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLParagraphElement>>
    export Text

    Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.

    Text
    tone?: Typography.TextTone | undefined

    Emphasis below the default (DESIGN.md "Text emphasis"): description for secondary content, subdued for interface text.

    tone
    ='muted'>Role: {
    role: string
    role
    }</
    import Typography
    Typography
    .
    const Text: React.ForwardRefExoticComponent<Omit<Typography.TextProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLParagraphElement>>
    export Text

    Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.

    Text
    >
    </
    React.JSX.IntrinsicElements.span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>
    span
    >
    </
    import Tooltip
    Tooltip
    .
    const Trigger: React.ForwardRefExoticComponent<Omit<TooltipTriggerProps, "content"> & {
    content?: React.ReactNode;
    side?: Tooltip.Side;
    } & React.RefAttributes<HTMLButtonElement>>
    export Trigger

    Use asChild to describe a Button. Opens on hover after the Root's delay and on keyboard focus only; the delay runs here because zag skips it while any tooltip is marked open, so a click would flash one (DESIGN.md follow-up 33). With content it needs no Root or Content around it.

    Trigger
    >
    <
    import Tooltip
    Tooltip
    .
    const Content: React.ForwardRefExoticComponent<Omit<TooltipContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    arrow?: boolean;
    container?: React.RefObject<HTMLElement | null>;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled text on the inverted surface (as the current Tooltip; no data-surface, whose popup fill it would fight), capped at 20rem wide, with an arrow unless arrow={false}.

    Content
    >{
    const ROLE_HELP: Record<string, string>
    ROLE_HELP
    [
    role: string
    role
    ]}</
    import Tooltip
    Tooltip
    .
    const Content: React.ForwardRefExoticComponent<Omit<TooltipContentProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    size?: Size;
    arrow?: boolean;
    container?: React.RefObject<HTMLElement | null>;
    } & React.RefAttributes<HTMLDivElement>>
    export Content

    Portalled text on the inverted surface (as the current Tooltip; no data-surface, whose popup fill it would fight), capped at 20rem wide, with an arrow unless arrow={false}.

    Content
    >
    </
    import Tooltip
    Tooltip
    .
    function Root({ openDelay, lazyMount, unmountOnExit, positioning, ...props }: Tooltip.RootProps): React.JSX.Element
    export Root
    Root
    >
    );
    export const
    const ContactsScreen: () => React.JSX.Element
    ContactsScreen
    = () => {
    const [
    const contacts: Contact[]
    contacts
    ,
    const setContacts: React.Dispatch<React.SetStateAction<Contact[]>>
    setContacts
    ] =
    useState<Contact[]>(initialState: Contact[] | (() => Contact[])): [Contact[], React.Dispatch<React.SetStateAction<Contact[]>>] (+1 overload)

    Returns a stateful value, and a function to update it.

    @version ― 16.8.0

    @see ― https://react.dev/reference/react/useState

    useState
    (
    const CONTACTS: Contact[]
    CONTACTS
    );
    const [
    const selected: string | undefined
    selected
    ,
    const setSelected: React.Dispatch<React.SetStateAction<string | undefined>>
    setSelected
    ] =
    useState<string | undefined>(initialState: string | (() => string | undefined) | undefined): [string | undefined, React.Dispatch<React.SetStateAction<string | undefined>>] (+1 overload)

    Returns a stateful value, and a function to update it.

    @version ― 16.8.0

    @see ― https://react.dev/reference/react/useState

    useState
    <string | undefined>(
    const contacts: Contact[]
    contacts
    [0].
    id: string
    id
    );
    const [
    const saved: string | undefined
    saved
    ,
    const setSaved: React.Dispatch<React.SetStateAction<string | undefined>>
    setSaved
    ] =
    useState<string>(): [string | undefined, React.Dispatch<React.SetStateAction<string | undefined>>] (+1 overload)

    Returns a stateful value, and a function to update it.

    @version ― 16.8.0

    @see ― https://react.dev/reference/react/useState

    useState
    <string>();
    const
    const contact: Contact | undefined
    contact
    =
    const contacts: Contact[]
    contacts
    .
    Array<Contact>.find(predicate: (value: Contact, index: number, obj: Contact[]) => unknown, thisArg?: any): Contact | undefined (+1 overload)

    Returns the value of the first element in the array where predicate is true, and undefined otherwise.

    @param ― predicate find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

    @param ― thisArg If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    find
    (({
    id: string
    id
    }) =>
    id: string
    id
    ===
    const selected: string | undefined
    selected
    );
    const
    const handleSave: (next: Contact) => void
    handleSave
    = (
    next: Contact
    next
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    ) => {
    const setContacts: (value: React.SetStateAction<Contact[]>) => void
    setContacts
    ((
    contacts: Contact[]
    contacts
    ) =>
    contacts: Contact[]
    contacts
    .
    Array<Contact>.map<Contact>(callbackfn: (value: Contact, index: number, array: Contact[]) => Contact, thisArg?: any): Contact[]

    Calls a defined callback function on each element of an array, and returns an array that contains the results.

    @param ― callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

    @param ― thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    map
    ((
    contact: Contact
    contact
    ) => (
    contact: Contact
    contact
    .
    id: string
    id
    ===
    next: Contact
    next
    .
    id: string
    id
    ?
    next: Contact
    next
    :
    contact: Contact
    contact
    )));
    const setSaved: (value: React.SetStateAction<string | undefined>) => void
    setSaved
    (
    next: Contact
    next
    .
    name: string
    name
    );
    };
    const
    const handleDelete: (id: string) => void
    handleDelete
    = (
    id: string
    id
    : string) => {
    const setContacts: (value: React.SetStateAction<Contact[]>) => void
    setContacts
    ((
    contacts: Contact[]
    contacts
    ) =>
    contacts: Contact[]
    contacts
    .
    Array<Contact>.filter(predicate: (value: Contact, index: number, array: Contact[]) => unknown, thisArg?: any): Contact[] (+1 overload)

    Returns the elements of an array that meet the condition specified in a callback function.

    @param ― predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

    @param ― thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

    filter
    ((
    contact: Contact
    contact
    ) =>
    contact: Contact
    contact
    .
    id: string
    id
    !==
    id: string
    id
    ));
    const setSelected: (value: React.SetStateAction<string | undefined>) => void
    setSelected
    (
    var undefined
    undefined
    );
    };
    return (
    <
    import Toast
    Toast
    .
    function Provider({ duration, overlap, children }: Toast.ProviderProps): React.JSX.Element
    export Provider
    Provider
    >
    <
    import Panel
    Panel
    .
    const Root: React.ForwardRefExoticComponent<Omit<Panel.RootProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Root

    The plank host: fills its parent, sets data-size and a level for its subtree, and is the pane's query container, so its header, body and footer collapse at the same pane width.

    Root
    >
    <
    import Panel
    Panel
    .
    const Header: React.ForwardRefExoticComponent<Omit<{
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Header

    The top row on the bar aspect, which steps off whatever level hosts the panel; it sizes to its content, so it takes no space when empty and one block when it holds a Toolbar.Root.

    Header
    >
    <
    import Toolbar
    Toolbar
    .
    const Root: React.ForwardRefExoticComponent<Omit<Toolbar.RootProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Root

    role=toolbar with the roving focus that role promises (decision 9); items that overflow scroll along its axis in a thin ScrollArea whose bar shows on hover, the toolbar itself being the viewport.

    Root
    >
    <
    import Toolbar
    Toolbar
    .
    const Text: React.ForwardRefExoticComponent<Omit<{
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Text

    A run of text that takes the free space and truncates; not an item, so roving focus skips it.

    Text
    >Contacts</
    import Toolbar
    Toolbar
    .
    const Text: React.ForwardRefExoticComponent<Omit<{
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Text

    A run of text that takes the free space and truncates; not an item, so roving focus skips it.

    Text
    >
    <
    import Toolbar
    Toolbar
    .
    const Separator: React.ForwardRefExoticComponent<Omit<Toolbar.SeparatorProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Separator

    A rule across the toolbar's axis (vertical in a horizontal toolbar), or with variant='gap' a growing spacer; not an item, so roving focus skips it.

    Separator
    variant?: "line" | "gap" | undefined

    gap is an empty spacer that grows, pushing the items after it to the toolbar's end.

    variant
    ='gap' />
    {
    const contact: Contact | undefined
    contact
    && <
    const EditDialog: ({ label, contact, onSave }: EditDialogProps) => React.JSX.Element

    The editor from the last page, in a dialog that closes on Save.

    EditDialog
    label: string
    label
    ='Edit'
    contact: Contact
    contact
    ={
    const contact: Contact
    contact
    }
    onSave: (contact: Contact) => void
    onSave
    ={
    const handleSave: (next: Contact) => void
    handleSave
    } />}
    {
    const contact: Contact | undefined
    contact
    && <
    const DeletePopover: ({ label, onDelete }: DeletePopoverProps) => React.JSX.Element
    DeletePopover
    label: string
    label
    ='Delete'
    onDelete: () => void
    onDelete
    ={() =>
    const handleDelete: (id: string) => void
    handleDelete
    (
    const contact: Contact
    contact
    .
    id: string
    id
    )} />}
    </
    import Toolbar
    Toolbar
    .
    const Root: React.ForwardRefExoticComponent<Omit<Toolbar.RootProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Root

    role=toolbar with the roving focus that role promises (decision 9); items that overflow scroll along its axis in a thin ScrollArea whose bar shows on hover, the toolbar itself being the viewport.

    Root
    >
    </
    import Panel
    Panel
    .
    const Header: React.ForwardRefExoticComponent<Omit<{
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Header

    The top row on the bar aspect, which steps off whatever level hosts the panel; it sizes to its content, so it takes no space when empty and one block when it holds a Toolbar.Root.

    Header
    >
    <
    import Panel
    Panel
    .
    const Body: React.ForwardRefExoticComponent<Omit<{
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Body

    The growing middle row, a plain slot: it neither scrolls nor adds a gutter, so content composes its own frame (asChild onto a ScrollArea.Root around a Container, or a canvas that fills the row). The first Container under it takes the panel's gutter unless it names one. Like the header and footer it is no query container, so its content collapses against the panel.

    Body
    asChild?: boolean | undefined
    asChild
    >
    <
    import Layout
    Layout
    .
    const Grid: React.ForwardRefExoticComponent<Omit<Layout.GridProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>

    CSS grid container.

    cols/rows take a count for equal tracks, or a list of tokens for anything asymmetric: cols={['fill', 'min']} is grid-cols-[1fr_min-content], with the flexible track allowed to shrink so long content truncates rather than widening the grid. The tokens are typed, so a misspelt track is a compile error rather than an invalid template.

    subgrid adopts the parent's tracks and spans them (grid-column: 1 / -1), which is the only way it is ever useful; the parent must actually define those tracks. Check Column.Row and Card.Row first — both already are 3-track subgrid rows.

    gap is restricted to the named steps of the theme spacing ramp (see

    Gap

    ). As with Flex, padding, sizing, and colour go through classNames rather than growing props here.

    @example

    <Grid cols={3} gap='sm'>…</Grid>
    <Grid cols={['fill', 'auto']} gap='md' align='center'>…</Grid>
    <Grid cols={['18rem', 'fill']}>…</Grid>
    <Grid cols='subgrid' gap='sm' align='center'>…</Grid>

    Grid
    cols?: Layout.GridTracks | undefined
    cols
    ={['16rem', 'fill']}
    grow?: boolean | undefined

    Fill and clip the parent (dx-expand); off by default, as Flex's is, so a grid sizes to its content.

    grow
    >
    <
    const ContactList: ({ contacts, selected, onSelect }: ContactListProps) => React.JSX.Element

    One row per contact; the list scrolls inside its own viewport.

    ContactList
    contacts: Contact[]
    contacts
    ={
    const contacts: Contact[]
    contacts
    }
    selected?: string | undefined
    selected
    ={
    const selected: string | undefined
    selected
    }
    onSelect: (id: string) => void
    onSelect
    ={
    const setSelected: React.Dispatch<React.SetStateAction<string | undefined>>
    setSelected
    } />
    {
    const contact: Contact | undefined
    contact
    && (
    <
    import Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>

    One-axis layout box: the primitive that replaces hand-written flex … wrapper divs.

    gap is restricted to the named steps of the theme spacing ramp (see

    Gap

    ), which is the point of the prop — an off-ramp gap-2/gap-3 literal in a container is the drift it prevents. Anything the props don't cover (padding, sizing, overflow, colour) goes through classNames; the component deliberately grows no padding or colour props, since components own their own spacing.

    There is no implicit align. Row-centering is the common case, but defaulting it would silently restyle any consumer relying on the CSS stretch initial value.

    Use asChild to project the layout onto a semantic element (<header>, <ul>, <a>).

    @example

    <Flex column gap='sm'>…</Flex>
    <Flex gap='sm' justify='end'>…</Flex>
    <Flex center classNames='h-full text-fg-subtle' role='status'>{t('empty.message')}</Flex>

    Flex
    column?: boolean | undefined

    Stack on the block axis instead of the inline axis.

    column
    gap?: Layout.Gap | undefined
    gap
    ='sm'
    classNames?: ClassNameValue
    classNames
    ='p-4'>
    <
    import Typography
    Typography
    .
    const Text: React.ForwardRefExoticComponent<Omit<Typography.TextProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLParagraphElement>>
    export Text

    Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.

    Text
    asChild?: boolean | undefined
    asChild
    >
    <
    React.JSX.IntrinsicElements.h2: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>
    h2
    >{
    const contact: Contact
    contact
    .
    name: string
    name
    }</
    React.JSX.IntrinsicElements.h2: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>
    h2
    >
    </
    import Typography
    Typography
    .
    const Text: React.ForwardRefExoticComponent<Omit<Typography.TextProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLParagraphElement>>
    export Text

    Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.

    Text
    >
    <
    import Typography
    Typography
    .
    const Text: React.ForwardRefExoticComponent<Omit<Typography.TextProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLParagraphElement>>
    export Text

    Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.

    Text
    tone?: Typography.TextTone | undefined

    Emphasis below the default (DESIGN.md "Text emphasis"): description for secondary content, subdued for interface text.

    tone
    ='muted'>{
    const contact: Contact
    contact
    .
    email: string
    email
    }</
    import Typography
    Typography
    .
    const Text: React.ForwardRefExoticComponent<Omit<Typography.TextProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLParagraphElement>>
    export Text

    Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.

    Text
    >
    <
    const Role: ({ role }: {
    role: string;
    }) => React.JSX.Element

    The role, with what it allows in a tooltip.

    Role
    role: string
    role
    ={
    const contact: Contact
    contact
    .
    role: string
    role
    } />
    </
    import Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>

    One-axis layout box: the primitive that replaces hand-written flex … wrapper divs.

    gap is restricted to the named steps of the theme spacing ramp (see

    Gap

    ), which is the point of the prop — an off-ramp gap-2/gap-3 literal in a container is the drift it prevents. Anything the props don't cover (padding, sizing, overflow, colour) goes through classNames; the component deliberately grows no padding or colour props, since components own their own spacing.

    There is no implicit align. Row-centering is the common case, but defaulting it would silently restyle any consumer relying on the CSS stretch initial value.

    Use asChild to project the layout onto a semantic element (<header>, <ul>, <a>).

    @example

    <Flex column gap='sm'>…</Flex>
    <Flex gap='sm' justify='end'>…</Flex>
    <Flex center classNames='h-full text-fg-subtle' role='status'>{t('empty.message')}</Flex>

    Flex
    >
    )}
    </
    import Layout
    Layout
    .
    const Grid: React.ForwardRefExoticComponent<Omit<Layout.GridProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>

    CSS grid container.

    cols/rows take a count for equal tracks, or a list of tokens for anything asymmetric: cols={['fill', 'min']} is grid-cols-[1fr_min-content], with the flexible track allowed to shrink so long content truncates rather than widening the grid. The tokens are typed, so a misspelt track is a compile error rather than an invalid template.

    subgrid adopts the parent's tracks and spans them (grid-column: 1 / -1), which is the only way it is ever useful; the parent must actually define those tracks. Check Column.Row and Card.Row first — both already are 3-track subgrid rows.

    gap is restricted to the named steps of the theme spacing ramp (see

    Gap

    ). As with Flex, padding, sizing, and colour go through classNames rather than growing props here.

    @example

    <Grid cols={3} gap='sm'>…</Grid>
    <Grid cols={['fill', 'auto']} gap='md' align='center'>…</Grid>
    <Grid cols={['18rem', 'fill']}>…</Grid>
    <Grid cols='subgrid' gap='sm' align='center'>…</Grid>

    Grid
    >
    </
    import Panel
    Panel
    .
    const Body: React.ForwardRefExoticComponent<Omit<{
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Body

    The growing middle row, a plain slot: it neither scrolls nor adds a gutter, so content composes its own frame (asChild onto a ScrollArea.Root around a Container, or a canvas that fills the row). The first Container under it takes the panel's gutter unless it names one. Like the header and footer it is no query container, so its content collapses against the panel.

    Body
    >
    </
    import Panel
    Panel
    .
    const Root: React.ForwardRefExoticComponent<Omit<Panel.RootProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "role" | "style" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Root

    The plank host: fills its parent, sets data-size and a level for its subtree, and is the pane's query container, so its header, body and footer collapse at the same pane width.

    Root
    >
    <
    import Toast
    Toast
    .
    const Root: React.ForwardRefExoticComponent<Omit<Toast.RootProps, "ref"> & React.RefAttributes<HTMLDivElement>>
    export Root

    Declares a toast. Renders nothing where it stands: the content is registered for the toaster, and open is mirrored into the store, which reports a timeout or a close back as onOpenChange.

    Root
    open?: boolean | undefined
    open
    ={
    const saved: string | undefined
    saved
    !==
    var undefined
    undefined
    }
    onOpenChange?: ((open: boolean) => void) | undefined
    onOpenChange
    ={(
    open: boolean
    open
    ) => !
    open: boolean
    open
    &&
    const setSaved: (value: React.SetStateAction<string | undefined>) => void
    setSaved
    (
    var undefined
    undefined
    )}>
    <
    import Toast
    Toast
    .
    const Header: React.ForwardRefExoticComponent<Omit<Toast.HeaderProps, "ref"> & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row: an optional icon, the Title (children) and a close button.

    Header
    icon?: string | undefined
    icon
    ='ph--check-circle--regular'>Contact saved</
    import Toast
    Toast
    .
    const Header: React.ForwardRefExoticComponent<Omit<Toast.HeaderProps, "ref"> & React.RefAttributes<HTMLDivElement>>
    export Header

    A block row: an optional icon, the Title (children) and a close button.

    Header
    >
    <
    import Toast
    Toast
    .
    const Description: React.ForwardRefExoticComponent<Omit<Toast.DescriptionProps, "ref"> & React.RefAttributes<HTMLDivElement>>
    export Description
    Description
    >{
    const saved: string | undefined
    saved
    } was updated.</
    import Toast
    Toast
    .
    const Description: React.ForwardRefExoticComponent<Omit<Toast.DescriptionProps, "ref"> & React.RefAttributes<HTMLDivElement>>
    export Description
    Description
    >
    </
    import Toast
    Toast
    .
    const Root: React.ForwardRefExoticComponent<Omit<Toast.RootProps, "ref"> & React.RefAttributes<HTMLDivElement>>
    export Root

    Declares a toast. Renders nothing where it stands: the content is registered for the toaster, and open is mirrored into the store, which reports a timeout or a close back as onOpenChange.

    Root
    >
    <
    import Toast
    Toast
    .
    const Toaster: React.ForwardRefExoticComponent<Omit<Toast.ToasterProps, "ref"> & React.RefAttributes<HTMLDivElement>>
    export Toaster

    Ark's region host; place one per app, after the content that declares toasts.

    Toaster
    />
    </
    import Toast
    Toast
    .
    function Provider({ duration, overlap, children }: Toast.ProviderProps): React.JSX.Element
    export Provider
    Provider
    >
    );
    };

    Toast.Root passes onOpenChange the boolean itself, where Dialog.Root passes an object that holds it. When the toast times out, the handler clears saved, so the next save opens the toast again.

Choose a contact and press Edit. Save a change, and the toast appears. Hover over the role, or tab to it, to see what the role allows. Press Delete, then Keep or Delete.

You can open dialogs and popovers from buttons, add tooltips to any element, and show toasts. Next, Icons and translations moves the screen’s strings into a resource.