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

Lay out a screen

By the end of this page the app shows a toolbar over two columns: the contacts on the left, and the selected contact’s details on the right.

Built by hand, this screen is nested flex and grid boxes, each with its own padding and gap. TILE lays out a screen with a few components that own their spacing, so we rarely write padding or flex classes:

  • Panel is a frame with a header, a body that takes the remaining height, and an optional footer. Use it as the outer shell of a screen. Step 4 puts the screen in one.
  • Toolbar is a row of controls and text. Use it in a panel’s header.
  • Layout.Grid places its children in tracks, and Layout.Flex places them in a row or a stack. Both take their gaps from the theme’s scale. Use Layout.Grid when one track has a fixed size, as the list’s column does in step 4.
  • ScrollArea scrolls its content with the theme’s scrollbar. Use it around content that can grow taller than its column, as the detail does in step 3.

Layout explains how a panel passes its height down to the part that scrolls.

  1. Add the data. We keep the contacts in React state until the last page. Put their type and the starting list in src/contacts.ts:

    import type * as
    import Select
    Select
    from '@dxos/react-ui/Select';
    export type
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    = {
    id: string
    id
    : string;
    name: string
    name
    : string;
    email: string
    email
    : string;
    role: string
    role
    : string;
    };
    export const
    const ROLES: Select.Option[]
    ROLES
    :
    import Select
    Select
    .
    type Option = {
    value: string;
    label: string;
    disabled?: boolean;
    icon?: string;
    iconHue?: IconHue;
    }
    export Option
    Option
    [] = [
    {
    value: string
    value
    : 'viewer',
    label: string
    label
    : 'Viewer' },
    {
    value: string
    value
    : 'editor',
    label: string
    label
    : 'Editor' },
    {
    value: string
    value
    : 'admin',
    label: string
    label
    : 'Admin' },
    ];
    export const
    const CONTACTS: Contact[]
    CONTACTS
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    [] = [
    {
    id: string
    id
    : 'ada',
    name: string
    name
    : 'Ada Lovelace',
    email: string
    email
    : 'ada@example.com',
    role: string
    role
    : 'admin' },
    {
    id: string
    id
    : 'grace',
    name: string
    name
    : 'Grace Hopper',
    email: string
    email
    : 'grace@example.com',
    role: string
    role
    : 'editor' },
    {
    id: string
    id
    : 'alan',
    name: string
    name
    : 'Alan Turing',
    email: string
    email
    : 'alan@example.com',
    role: string
    role
    : 'viewer' },
    {
    id: string
    id
    : 'katherine',
    name: string
    name
    : 'Katherine Johnson',
    email: string
    email
    : 'katherine@example.com',
    role: string
    role
    : 'editor' },
    ];

    ROLES has the shape a Select takes for its options. The next page uses it.

  2. List the contacts. Listbox draws one row per item, with the label and a second line from description. It handles selection, arrow keys and typeahead. Listbox.Viewport makes the list scroll inside its column. Add src/layout/ContactsScreen.tsx:

    import * as
    import Listbox
    Listbox
    from '@dxos/react-ui/Listbox';
    6 collapsed lines
    import * as
    import Panel
    Panel
    from '@dxos/react-ui/Panel';
    import * as
    import ScrollArea
    ScrollArea
    from '@dxos/react-ui/ScrollArea';
    import * as
    import Status
    Status
    from '@dxos/react-ui/Status';
    import * as
    import Toolbar
    Toolbar
    from '@dxos/react-ui/Toolbar';
    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';
    type
    type ContactListProps = {
    contacts: Contact[];
    selected?: string;
    onSelect: (id: string) => void;
    }
    ContactListProps
    = {
    contacts: Contact[]
    contacts
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    [];
    selected?: string | undefined
    selected
    ?: string;
    onSelect: (id: string) => void
    onSelect
    : (
    id: string
    id
    : string) => void;
    };
    /** One row per contact; the list scrolls inside its own viewport. */
    export const
    const ContactList: ({ contacts, selected, onSelect }: ContactListProps) => React.JSX.Element

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

    ContactList
    = ({
    contacts: Contact[]
    contacts
    ,
    selected: string | undefined
    selected
    ,
    onSelect: (id: string) => void
    onSelect
    }:
    type ContactListProps = {
    contacts: Contact[];
    selected?: string;
    onSelect: (id: string) => void;
    }
    ContactListProps
    ) => {
    const
    const items: {
    value: string;
    label: string;
    description: string;
    }[]
    items
    =
    contacts: Contact[]
    contacts
    .
    Array<Contact>.map<{
    value: string;
    label: string;
    description: string;
    }>(callbackfn: (value: Contact, index: number, array: Contact[]) => {
    value: string;
    label: string;
    description: string;
    }, thisArg?: any): {
    value: string;
    label: string;
    description: string;
    }[]

    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
    ) => ({
    value: string
    value
    :
    contact: Contact
    contact
    .
    id: string
    id
    ,
    label: string
    label
    :
    contact: Contact
    contact
    .
    name: string
    name
    ,
    description: string
    description
    :
    contact: Contact
    contact
    .
    email: string
    email
    ,
    }));
    return (
    <
    import Listbox
    Listbox
    .
    const Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect" | "defaultValue">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    items: readonly Listbox.Option[];
    selectionMode?: Listbox.SelectionMode;
    value?: string[];
    defaultValue?: string[];
    onValueChange?: (value: string[]) => void;
    highlightedValue?: string | null;
    onHighlightChange?: (value: string | null) => void;
    ... 8 more ...;
    size?: Size;
    } & React.RefAttributes<...>>
    export Root

    Ark listbox: single, multiple or no selection, with keyboard navigation, typeahead and aria-selected from zag. A flex column that caps itself at its parent's height, so a long list scrolls in its Content.

    Root
    items: readonly Listbox.Option[]
    items
    ={
    const items: {
    value: string;
    label: string;
    description: string;
    }[]
    items
    }
    value?: string[] | undefined
    value
    ={
    selected: string | undefined
    selected
    ? [
    selected: string
    selected
    ] : []}
    onValueChange?: ((value: string[]) => void) | undefined
    onValueChange
    ={([
    id: string
    id
    ]) =>
    id: string
    id
    &&
    onSelect: (id: string) => void
    onSelect
    (
    id: string
    id
    )}>
    <
    import Listbox
    Listbox
    .
    const Viewport: React.ForwardRefExoticComponent<Omit<Pick<ScrollArea.RootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    children: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Viewport

    A thin overlay ScrollArea (decision 5) that grows to fill the Root, for a list that owns its scrolling (a picker, a fixed-height panel). Its Content is the scrolling element, so the thumb sits in the Content's end gutter. Omit it inside a host that already scrolls, which would otherwise trap wheel and trackpad gestures in a nested scroller.

    Viewport
    >
    <
    import Listbox
    Listbox
    .
    const Content: React.ForwardRefExoticComponent<Omit<Layout.ContainerProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Content

    The listbox element: zag's content props with the grid keyboard in front of them, a Container's attributes so a Viewport's slot merges onto it, and the Root's virtual windowing over its direct children (the rows). Under a Viewport it is the scrolling element (inset gutter by default); otherwise its host scrolls and the rows inherit the host's rails (inherit). A windowed (virtual) list measures its scroller, so it needs a Viewport.

    Content
    "aria-label"?: string | undefined

    Defines a string value that labels the current element.

    @see ― aria-labelledby.

    aria-label
    ='Contacts'>
    {
    const items: {
    value: string;
    label: string;
    description: string;
    }[]
    items
    .
    Array<{ value: string; label: string; description: string; }>.map<React.JSX.Element>(callbackfn: (value: {
    value: string;
    label: string;
    description: string;
    }, index: number, array: {
    value: string;
    label: string;
    description: string;
    }[]) => React.JSX.Element, thisArg?: any): React.JSX.Element[]

    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
    ((
    item: {
    value: string;
    label: string;
    description: string;
    }
    item
    ) => (
    <
    import Listbox
    Listbox
    .
    const Item: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    item: Listbox.Option;
    current?: boolean;
    highlightOnHover?: boolean;
    children?: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Item

    A row (option) at least one block tall: without children, the option's icon, label and description; with them, the caller's parts, which the theme places by part (leading cells, text over description, then trailing cells) or, under Root columns, in order across the shared tracks. Pointer presses on a row control stay with the control: they neither select the row nor take focus from the control.

    Item
    React.Attributes.key?: React.Key | null | undefined
    key
    ={
    item: {
    value: string;
    label: string;
    description: string;
    }
    item
    .
    value: string
    value
    }
    item: Listbox.Option
    item
    ={
    item: {
    value: string;
    label: string;
    description: string;
    }
    item
    } />
    ))}
    </
    import Listbox
    Listbox
    .
    const Content: React.ForwardRefExoticComponent<Omit<Layout.ContainerProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Content

    The listbox element: zag's content props with the grid keyboard in front of them, a Container's attributes so a Viewport's slot merges onto it, and the Root's virtual windowing over its direct children (the rows). Under a Viewport it is the scrolling element (inset gutter by default); otherwise its host scrolls and the rows inherit the host's rails (inherit). A windowed (virtual) list measures its scroller, so it needs a Viewport.

    Content
    >
    </
    import Listbox
    Listbox
    .
    const Viewport: React.ForwardRefExoticComponent<Omit<Pick<ScrollArea.RootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    children: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Viewport

    A thin overlay ScrollArea (decision 5) that grows to fill the Root, for a list that owns its scrolling (a picker, a fixed-height panel). Its Content is the scrolling element, so the thumb sits in the Content's end gutter. Omit it inside a host that already scrolls, which would otherwise trap wheel and trackpad gestures in a nested scroller.

    Viewport
    >
    </
    import Listbox
    Listbox
    .
    const Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect" | "defaultValue">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    items: readonly Listbox.Option[];
    selectionMode?: Listbox.SelectionMode;
    value?: string[];
    defaultValue?: string[];
    onValueChange?: (value: string[]) => void;
    highlightedValue?: string | null;
    onHighlightChange?: (value: string | null) => void;
    ... 8 more ...;
    size?: Size;
    } & React.RefAttributes<...>>
    export Root

    Ark listbox: single, multiple or no selection, with keyboard navigation, typeahead and aria-selected from zag. A flex column that caps itself at its parent's height, so a long list scrolls in its Content.

    Root
    >
    );
    };

    value is a list, because a listbox can allow several selections, so onValueChange takes the first id.

  3. Show the selected contact. Typography.Text with tone='muted' reads as secondary text. When no contact is selected, Status.Empty shows an icon and a hint in the middle of the column:

    import * as
    import Layout
    Layout
    from '@dxos/react-ui/Layout';
    2 collapsed lines
    import * as
    import Listbox
    Listbox
    from '@dxos/react-ui/Listbox';
    import * as
    import Panel
    Panel
    from '@dxos/react-ui/Panel';
    import * as
    import ScrollArea
    ScrollArea
    from '@dxos/react-ui/ScrollArea';
    import * as
    import Status
    Status
    from '@dxos/react-ui/Status';
    1 collapsed line
    import * as
    import Toolbar
    Toolbar
    from '@dxos/react-ui/Toolbar';
    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';
    27 collapsed lines
    type
    type ContactListProps = {
    contacts: Contact[];
    selected?: string;
    onSelect: (id: string) => void;
    }
    ContactListProps
    = {
    contacts: Contact[]
    contacts
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    [];
    selected?: string | undefined
    selected
    ?: string;
    onSelect: (id: string) => void
    onSelect
    : (
    id: string
    id
    : string) => void;
    };
    /** One row per contact; the list scrolls inside its own viewport. */
    export const
    const ContactList: ({ contacts, selected, onSelect }: ContactListProps) => React.JSX.Element

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

    ContactList
    = ({
    contacts: Contact[]
    contacts
    ,
    selected: string | undefined
    selected
    ,
    onSelect: (id: string) => void
    onSelect
    }:
    type ContactListProps = {
    contacts: Contact[];
    selected?: string;
    onSelect: (id: string) => void;
    }
    ContactListProps
    ) => {
    const
    const items: {
    value: string;
    label: string;
    description: string;
    }[]
    items
    =
    contacts: Contact[]
    contacts
    .
    Array<Contact>.map<{
    value: string;
    label: string;
    description: string;
    }>(callbackfn: (value: Contact, index: number, array: Contact[]) => {
    value: string;
    label: string;
    description: string;
    }, thisArg?: any): {
    value: string;
    label: string;
    description: string;
    }[]

    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
    ) => ({
    value: string
    value
    :
    contact: Contact
    contact
    .
    id: string
    id
    ,
    label: string
    label
    :
    contact: Contact
    contact
    .
    name: string
    name
    ,
    description: string
    description
    :
    contact: Contact
    contact
    .
    email: string
    email
    ,
    }));
    return (
    <
    import Listbox
    Listbox
    .
    const Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect" | "defaultValue">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    items: readonly Listbox.Option[];
    selectionMode?: Listbox.SelectionMode;
    value?: string[];
    defaultValue?: string[];
    onValueChange?: (value: string[]) => void;
    highlightedValue?: string | null;
    onHighlightChange?: (value: string | null) => void;
    ... 8 more ...;
    size?: Size;
    } & React.RefAttributes<...>>
    export Root

    Ark listbox: single, multiple or no selection, with keyboard navigation, typeahead and aria-selected from zag. A flex column that caps itself at its parent's height, so a long list scrolls in its Content.

    Root
    items: readonly Listbox.Option[]
    items
    ={
    const items: {
    value: string;
    label: string;
    description: string;
    }[]
    items
    }
    value?: string[] | undefined
    value
    ={
    selected: string | undefined
    selected
    ? [
    selected: string
    selected
    ] : []}
    onValueChange?: ((value: string[]) => void) | undefined
    onValueChange
    ={([
    id: string
    id
    ]) =>
    id: string
    id
    &&
    onSelect: (id: string) => void
    onSelect
    (
    id: string
    id
    )}>
    <
    import Listbox
    Listbox
    .
    const Viewport: React.ForwardRefExoticComponent<Omit<Pick<ScrollArea.RootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    children: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Viewport

    A thin overlay ScrollArea (decision 5) that grows to fill the Root, for a list that owns its scrolling (a picker, a fixed-height panel). Its Content is the scrolling element, so the thumb sits in the Content's end gutter. Omit it inside a host that already scrolls, which would otherwise trap wheel and trackpad gestures in a nested scroller.

    Viewport
    >
    <
    import Listbox
    Listbox
    .
    const Content: React.ForwardRefExoticComponent<Omit<Layout.ContainerProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Content

    The listbox element: zag's content props with the grid keyboard in front of them, a Container's attributes so a Viewport's slot merges onto it, and the Root's virtual windowing over its direct children (the rows). Under a Viewport it is the scrolling element (inset gutter by default); otherwise its host scrolls and the rows inherit the host's rails (inherit). A windowed (virtual) list measures its scroller, so it needs a Viewport.

    Content
    "aria-label"?: string | undefined

    Defines a string value that labels the current element.

    @see ― aria-labelledby.

    aria-label
    ='Contacts'>
    {
    const items: {
    value: string;
    label: string;
    description: string;
    }[]
    items
    .
    Array<{ value: string; label: string; description: string; }>.map<React.JSX.Element>(callbackfn: (value: {
    value: string;
    label: string;
    description: string;
    }, index: number, array: {
    value: string;
    label: string;
    description: string;
    }[]) => React.JSX.Element, thisArg?: any): React.JSX.Element[]

    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
    ((
    item: {
    value: string;
    label: string;
    description: string;
    }
    item
    ) => (
    <
    import Listbox
    Listbox
    .
    const Item: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    item: Listbox.Option;
    current?: boolean;
    highlightOnHover?: boolean;
    children?: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Item

    A row (option) at least one block tall: without children, the option's icon, label and description; with them, the caller's parts, which the theme places by part (leading cells, text over description, then trailing cells) or, under Root columns, in order across the shared tracks. Pointer presses on a row control stay with the control: they neither select the row nor take focus from the control.

    Item
    React.Attributes.key?: React.Key | null | undefined
    key
    ={
    item: {
    value: string;
    label: string;
    description: string;
    }
    item
    .
    value: string
    value
    }
    item: Listbox.Option
    item
    ={
    item: {
    value: string;
    label: string;
    description: string;
    }
    item
    } />
    ))}
    </
    import Listbox
    Listbox
    .
    const Content: React.ForwardRefExoticComponent<Omit<Layout.ContainerProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Content

    The listbox element: zag's content props with the grid keyboard in front of them, a Container's attributes so a Viewport's slot merges onto it, and the Root's virtual windowing over its direct children (the rows). Under a Viewport it is the scrolling element (inset gutter by default); otherwise its host scrolls and the rows inherit the host's rails (inherit). A windowed (virtual) list measures its scroller, so it needs a Viewport.

    Content
    >
    </
    import Listbox
    Listbox
    .
    const Viewport: React.ForwardRefExoticComponent<Omit<Pick<ScrollArea.RootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    children: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Viewport

    A thin overlay ScrollArea (decision 5) that grows to fill the Root, for a list that owns its scrolling (a picker, a fixed-height panel). Its Content is the scrolling element, so the thumb sits in the Content's end gutter. Omit it inside a host that already scrolls, which would otherwise trap wheel and trackpad gestures in a nested scroller.

    Viewport
    >
    </
    import Listbox
    Listbox
    .
    const Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect" | "defaultValue">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    items: readonly Listbox.Option[];
    selectionMode?: Listbox.SelectionMode;
    value?: string[];
    defaultValue?: string[];
    onValueChange?: (value: string[]) => void;
    highlightedValue?: string | null;
    onHighlightChange?: (value: string | null) => void;
    ... 8 more ...;
    size?: Size;
    } & React.RefAttributes<...>>
    export Root

    Ark listbox: single, multiple or no selection, with keyboard navigation, typeahead and aria-selected from zag. A flex column that caps itself at its parent's height, so a long list scrolls in its Content.

    Root
    >
    );
    };
    /** The selected contact's fields, or a hint when nothing is selected. */
    export const
    const ContactDetail: ({ contact }: {
    contact?: Contact;
    }) => React.JSX.Element

    The selected contact's fields, or a hint when nothing is selected.

    ContactDetail
    = ({
    contact: Contact | undefined
    contact
    }: {
    contact?: Contact | undefined
    contact
    ?:
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    }) =>
    contact: Contact | undefined
    contact
    ? (
    <
    import ScrollArea
    ScrollArea
    .
    const Root: React.ForwardRefExoticComponent<Omit<ScrollArea.RootProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Root

    Non-scrolling frame: hosts the overlay thumbs and is the query container for its content.

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

    The scrolling element; under asChild it is the child (e.g. a Container) itself.

    Viewport
    asChild?: boolean | undefined
    asChild
    >
    <
    import Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "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>, "style" | "role" | "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
    >{
    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>, "style" | "role" | "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>, "style" | "role" | "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'>{
    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>, "style" | "role" | "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>, "style" | "role" | "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: {
    contact: Contact
    contact
    .
    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>, "style" | "role" | "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 Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "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 ScrollArea
    ScrollArea
    .
    const Viewport: React.ForwardRefExoticComponent<Omit<ScrollArea.ViewportProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Viewport

    The scrolling element; under asChild it is the child (e.g. a Container) itself.

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

    Non-scrolling frame: hosts the overlay thumbs and is the query container for its content.

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

    Stands in for content that is not there (no items, no selection, no result): a centred status message, its text the children or the translated "No items". Composites build their own Empty part on it.

    Empty
    icon?: string | undefined

    A Phosphor icon above the message; decorative, since the message carries the statement.

    icon
    ='ph--address-book--regular'>Choose a contact</
    import Status
    Status
    .
    const Empty: React.ForwardRefExoticComponent<Omit<Status.EmptyProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>

    Stands in for content that is not there (no items, no selection, no result): a centred status message, its text the children or the translated "No items". Composites build their own Empty part on it.

    Empty
    >
    );

    Nothing on this page clears the selection, so we don’t see the hint yet. It first shows in Icons and translations, after a delete.

  4. Put them in a panel. The toolbar goes in Panel.Header. cols={['16rem', 'fill']} gives the list a fixed width and the detail the rest:

    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 Layout
    Layout
    from '@dxos/react-ui/Layout';
    1 collapsed line
    import * as
    import Listbox
    Listbox
    from '@dxos/react-ui/Listbox';
    import * as
    import Panel
    Panel
    from '@dxos/react-ui/Panel';
    2 collapsed lines
    import * as
    import ScrollArea
    ScrollArea
    from '@dxos/react-ui/ScrollArea';
    import * as
    import Status
    Status
    from '@dxos/react-ui/Status';
    import * as
    import Toolbar
    Toolbar
    from '@dxos/react-ui/Toolbar';
    2 collapsed lines
    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';
    45 collapsed lines
    type
    type ContactListProps = {
    contacts: Contact[];
    selected?: string;
    onSelect: (id: string) => void;
    }
    ContactListProps
    = {
    contacts: Contact[]
    contacts
    :
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    [];
    selected?: string | undefined
    selected
    ?: string;
    onSelect: (id: string) => void
    onSelect
    : (
    id: string
    id
    : string) => void;
    };
    /** One row per contact; the list scrolls inside its own viewport. */
    export const
    const ContactList: ({ contacts, selected, onSelect }: ContactListProps) => React.JSX.Element

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

    ContactList
    = ({
    contacts: Contact[]
    contacts
    ,
    selected: string | undefined
    selected
    ,
    onSelect: (id: string) => void
    onSelect
    }:
    type ContactListProps = {
    contacts: Contact[];
    selected?: string;
    onSelect: (id: string) => void;
    }
    ContactListProps
    ) => {
    const
    const items: {
    value: string;
    label: string;
    description: string;
    }[]
    items
    =
    contacts: Contact[]
    contacts
    .
    Array<Contact>.map<{
    value: string;
    label: string;
    description: string;
    }>(callbackfn: (value: Contact, index: number, array: Contact[]) => {
    value: string;
    label: string;
    description: string;
    }, thisArg?: any): {
    value: string;
    label: string;
    description: string;
    }[]

    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
    ) => ({
    value: string
    value
    :
    contact: Contact
    contact
    .
    id: string
    id
    ,
    label: string
    label
    :
    contact: Contact
    contact
    .
    name: string
    name
    ,
    description: string
    description
    :
    contact: Contact
    contact
    .
    email: string
    email
    ,
    }));
    return (
    <
    import Listbox
    Listbox
    .
    const Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect" | "defaultValue">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    items: readonly Listbox.Option[];
    selectionMode?: Listbox.SelectionMode;
    value?: string[];
    defaultValue?: string[];
    onValueChange?: (value: string[]) => void;
    highlightedValue?: string | null;
    onHighlightChange?: (value: string | null) => void;
    ... 8 more ...;
    size?: Size;
    } & React.RefAttributes<...>>
    export Root

    Ark listbox: single, multiple or no selection, with keyboard navigation, typeahead and aria-selected from zag. A flex column that caps itself at its parent's height, so a long list scrolls in its Content.

    Root
    items: readonly Listbox.Option[]
    items
    ={
    const items: {
    value: string;
    label: string;
    description: string;
    }[]
    items
    }
    value?: string[] | undefined
    value
    ={
    selected: string | undefined
    selected
    ? [
    selected: string
    selected
    ] : []}
    onValueChange?: ((value: string[]) => void) | undefined
    onValueChange
    ={([
    id: string
    id
    ]) =>
    id: string
    id
    &&
    onSelect: (id: string) => void
    onSelect
    (
    id: string
    id
    )}>
    <
    import Listbox
    Listbox
    .
    const Viewport: React.ForwardRefExoticComponent<Omit<Pick<ScrollArea.RootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    children: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Viewport

    A thin overlay ScrollArea (decision 5) that grows to fill the Root, for a list that owns its scrolling (a picker, a fixed-height panel). Its Content is the scrolling element, so the thumb sits in the Content's end gutter. Omit it inside a host that already scrolls, which would otherwise trap wheel and trackpad gestures in a nested scroller.

    Viewport
    >
    <
    import Listbox
    Listbox
    .
    const Content: React.ForwardRefExoticComponent<Omit<Layout.ContainerProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Content

    The listbox element: zag's content props with the grid keyboard in front of them, a Container's attributes so a Viewport's slot merges onto it, and the Root's virtual windowing over its direct children (the rows). Under a Viewport it is the scrolling element (inset gutter by default); otherwise its host scrolls and the rows inherit the host's rails (inherit). A windowed (virtual) list measures its scroller, so it needs a Viewport.

    Content
    "aria-label"?: string | undefined

    Defines a string value that labels the current element.

    @see ― aria-labelledby.

    aria-label
    ='Contacts'>
    {
    const items: {
    value: string;
    label: string;
    description: string;
    }[]
    items
    .
    Array<{ value: string; label: string; description: string; }>.map<React.JSX.Element>(callbackfn: (value: {
    value: string;
    label: string;
    description: string;
    }, index: number, array: {
    value: string;
    label: string;
    description: string;
    }[]) => React.JSX.Element, thisArg?: any): React.JSX.Element[]

    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
    ((
    item: {
    value: string;
    label: string;
    description: string;
    }
    item
    ) => (
    <
    import Listbox
    Listbox
    .
    const Item: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    item: Listbox.Option;
    current?: boolean;
    highlightOnHover?: boolean;
    children?: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Item

    A row (option) at least one block tall: without children, the option's icon, label and description; with them, the caller's parts, which the theme places by part (leading cells, text over description, then trailing cells) or, under Root columns, in order across the shared tracks. Pointer presses on a row control stay with the control: they neither select the row nor take focus from the control.

    Item
    React.Attributes.key?: React.Key | null | undefined
    key
    ={
    item: {
    value: string;
    label: string;
    description: string;
    }
    item
    .
    value: string
    value
    }
    item: Listbox.Option
    item
    ={
    item: {
    value: string;
    label: string;
    description: string;
    }
    item
    } />
    ))}
    </
    import Listbox
    Listbox
    .
    const Content: React.ForwardRefExoticComponent<Omit<Layout.ContainerProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Content

    The listbox element: zag's content props with the grid keyboard in front of them, a Container's attributes so a Viewport's slot merges onto it, and the Root's virtual windowing over its direct children (the rows). Under a Viewport it is the scrolling element (inset gutter by default); otherwise its host scrolls and the rows inherit the host's rails (inherit). A windowed (virtual) list measures its scroller, so it needs a Viewport.

    Content
    >
    </
    import Listbox
    Listbox
    .
    const Viewport: React.ForwardRefExoticComponent<Omit<Pick<ScrollArea.RootProps, "mode" | "native" | "width">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    children: React.ReactNode;
    } & React.RefAttributes<HTMLDivElement>>
    export Viewport

    A thin overlay ScrollArea (decision 5) that grows to fill the Root, for a list that owns its scrolling (a picker, a fixed-height panel). Its Content is the scrolling element, so the thumb sits in the Content's end gutter. Omit it inside a host that already scrolls, which would otherwise trap wheel and trackpad gestures in a nested scroller.

    Viewport
    >
    </
    import Listbox
    Listbox
    .
    const Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect" | "defaultValue">, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & {
    items: readonly Listbox.Option[];
    selectionMode?: Listbox.SelectionMode;
    value?: string[];
    defaultValue?: string[];
    onValueChange?: (value: string[]) => void;
    highlightedValue?: string | null;
    onHighlightChange?: (value: string | null) => void;
    ... 8 more ...;
    size?: Size;
    } & React.RefAttributes<...>>
    export Root

    Ark listbox: single, multiple or no selection, with keyboard navigation, typeahead and aria-selected from zag. A flex column that caps itself at its parent's height, so a long list scrolls in its Content.

    Root
    >
    );
    };
    /** The selected contact's fields, or a hint when nothing is selected. */
    export const
    const ContactDetail: ({ contact }: {
    contact?: Contact;
    }) => React.JSX.Element

    The selected contact's fields, or a hint when nothing is selected.

    ContactDetail
    = ({
    contact: Contact | undefined
    contact
    }: {
    contact?: Contact | undefined
    contact
    ?:
    type Contact = {
    id: string;
    name: string;
    email: string;
    role: string;
    }
    Contact
    }) =>
    contact: Contact | undefined
    contact
    ? (
    <
    import ScrollArea
    ScrollArea
    .
    const Root: React.ForwardRefExoticComponent<Omit<ScrollArea.RootProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Root

    Non-scrolling frame: hosts the overlay thumbs and is the query container for its content.

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

    The scrolling element; under asChild it is the child (e.g. a Container) itself.

    Viewport
    asChild?: boolean | undefined
    asChild
    >
    <
    import Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "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>, "style" | "role" | "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
    >{
    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>, "style" | "role" | "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>, "style" | "role" | "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'>{
    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>, "style" | "role" | "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>, "style" | "role" | "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: {
    contact: Contact
    contact
    .
    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>, "style" | "role" | "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 Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "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 ScrollArea
    ScrollArea
    .
    const Viewport: React.ForwardRefExoticComponent<Omit<ScrollArea.ViewportProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>
    export Viewport

    The scrolling element; under asChild it is the child (e.g. a Container) itself.

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

    Non-scrolling frame: hosts the overlay thumbs and is the query container for its content.

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

    Stands in for content that is not there (no items, no selection, no result): a centred status message, its text the children or the translated "No items". Composites build their own Empty part on it.

    Empty
    icon?: string | undefined

    A Phosphor icon above the message; decorative, since the message carries the statement.

    icon
    ='ph--address-book--regular'>Choose a contact</
    import Status
    Status
    .
    const Empty: React.ForwardRefExoticComponent<Omit<Status.EmptyProps, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLDivElement>>

    Stands in for content that is not there (no items, no selection, no result): a centred status message, its text the children or the translated "No items". Composites build their own Empty part on it.

    Empty
    >
    );
    export const
    const ContactsScreen: () => React.JSX.Element
    ContactsScreen
    = () => {
    const [
    const contacts: Contact[]
    contacts
    ] =
    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
    selected
    ,
    const setSelected: React.Dispatch<React.SetStateAction<string>>
    setSelected
    ] =
    useState<string>(initialState: string | (() => string)): [string, React.Dispatch<React.SetStateAction<string>>] (+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 contacts: Contact[]
    contacts
    [0].
    id: string
    id
    );
    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
    selected
    );
    return (
    <
    import Panel
    Panel
    .
    const Root: React.ForwardRefExoticComponent<Omit<Panel.RootProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "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>, "style" | "role" | "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>, "style" | "role" | "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>, "style" | "role" | "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>, "style" | "role" | "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>, "style" | "role" | "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' />
    <
    import Toolbar
    Toolbar
    .
    const Text: React.ForwardRefExoticComponent<Omit<{
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "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
    >{
    const contacts: Contact[]
    contacts
    .
    Array<Contact>.length: number

    Gets or sets the length of the array. This is a number one higher than the highest index in the array.

    length
    } contacts</
    import Toolbar
    Toolbar
    .
    const Text: React.ForwardRefExoticComponent<Omit<{
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "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 Root: React.ForwardRefExoticComponent<Omit<Toolbar.RootProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "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>, "style" | "role" | "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>, "style" | "role" | "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>, "style" | "role" | "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
    selected
    }
    onSelect: (id: string) => void
    onSelect
    ={
    const setSelected: React.Dispatch<React.SetStateAction<string>>
    setSelected
    } />
    <
    const ContactDetail: ({ contact }: {
    contact?: Contact;
    }) => React.JSX.Element

    The selected contact's fields, or a hint when nothing is selected.

    ContactDetail
    contact?: Contact | undefined
    contact
    ={
    const contact: Contact | undefined
    contact
    } />
    </
    import Layout
    Layout
    .
    const Grid: React.ForwardRefExoticComponent<Omit<Layout.GridProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "style" | "role" | "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>, "style" | "role" | "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>, "style" | "role" | "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
    >
    );
    };

    Panel.Body asChild makes the grid itself the body, so the grid fills the height under the toolbar and no extra element sits between them.

  5. Render the screen. In src/main.tsx, render <ContactsScreen /> in place of <App />, imported from ./layout/ContactsScreen.tsx. Give it the window’s height in index.html, so the panel fills it:

    index.html
    <div id="root" style="height: 100vh"></div>

Click a contact, or move through the list with the arrow keys.

You can lay out a screen with a toolbar, a scrolling list and a detail column. Next, Inputs and actions makes the detail editable.