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

Composite components

A composite component is a TILE component with more than one element, written as a namespace of parts. A dialog, for example, is Dialog.Root, Dialog.Trigger, Dialog.Content, Dialog.Title and so on. You compose the parts in JSX, in the shape you want.

If you have used Radix or Ark UI, you already know the shape. Those libraries split a component into parts that you arrange yourself, where others give you one Dialog and a prop for each thing it can show. TILE does the same.

One entry point, one namespace. Each component is its own entry point of @dxos/react-ui. You import it as a namespace, the object that holds its parts:

import * as Dialog from '@dxos/react-ui/Dialog';
import * as Input from '@dxos/react-ui/Input';

A few namespaces group related components. Button holds Root, Group, Menu and Toggle. Input holds Root, Checkbox, Switch, Textarea and the other controls. Layout and Status each hold several small components, which Layout and Status list.

Parts. A part is one element of the component. Root holds the state, and renders either no element or the outer one. The other parts each render one element and read the state from Root through React context.

A part you leave out renders nothing, so you decide what a component shows by the parts you write.

Example (Composing a dialog from its parts)

import * as
import Button
Button
from '@dxos/react-ui/Button';
import * as
import Dialog
Dialog
from '@dxos/react-ui/Dialog';
import * as
import Field
Field
from '@dxos/react-ui/Field';
import * as
import Input
Input
from '@dxos/react-ui/Input';
export const
const EditDialog: () => React.JSX.Element
EditDialog
= () => (
<
import Dialog
Dialog
.
function Root({ lazyMount, unmountOnExit, closeOnInteractOutside, placement, ...props }: Dialog.RootProps): React.JSX.Element
export Root
Root
>
<
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>, "style" | "role" | "children"> & React.RefAttributes<HTMLButtonElement>>
export Root
Root
>Edit contact</
import Button
Button
.
const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
classNames?: ClassNameValue;
} & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLButtonElement>>
export Root
Root
>
</
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
>Edit contact</
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<ScrollArea.RootProps, "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 Description: React.ForwardRefExoticComponent<Omit<DialogDescriptionProps, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
srOnly?: boolean;
} & React.RefAttributes<HTMLParagraphElement>>
export Description
Description
>
Changes are saved when you press Save.
</
import Dialog
Dialog
.
const Description: React.ForwardRefExoticComponent<Omit<DialogDescriptionProps, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
srOnly?: boolean;
} & React.RefAttributes<HTMLParagraphElement>>
export Description
Description
>
<
import Field
Field
.
const Root: React.ForwardRefExoticComponent<Omit<FieldRootProps, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
validationValence?: Field.Valence;
layout?: "stack" | "row" | "inline";
level?: Layout.Level;
span?: Layout.Span;
tone?: "muted";
} & React.RefAttributes<HTMLDivElement>>
export Root

A part, not a container (decision 13): a flex stack in the content track with the label above its control.

Root
>
<
import Field
Field
.
const Label: React.ForwardRefExoticComponent<Omit<FieldLabelProps, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
srOnly?: boolean;
} & React.RefAttributes<HTMLLabelElement>>
export Label

Names the control; while the root is required it ends with the required indicator, unless a RequiredIndicator among its children places the mark itself.

Label
>Name</
import Field
Field
.
const Label: React.ForwardRefExoticComponent<Omit<FieldLabelProps, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
srOnly?: boolean;
} & React.RefAttributes<HTMLLabelElement>>
export Label

Names the control; while the root is required it ends with the required indicator, unless a RequiredIndicator among its children places the mark itself.

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

Text input at control size; inside a Field.Root it takes the field's id, label and description wiring. With start or end it renders a ControlFrame holding the adornments and a bare input; data-testid and classes then go to the frame, the ref to the input.

Root
defaultValue?: string | number | readonly string[] | undefined
defaultValue
='Ada Lovelace' />
</
import Field
Field
.
const Root: React.ForwardRefExoticComponent<Omit<FieldRootProps, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & {
validationValence?: Field.Valence;
layout?: "stack" | "row" | "inline";
level?: Layout.Level;
span?: Layout.Span;
tone?: "muted";
} & React.RefAttributes<HTMLDivElement>>
export Root

A part, not a container (decision 13): a flex stack in the content track with the label above its control.

Root
>
</
import Dialog
Dialog
.
const Body: React.ForwardRefExoticComponent<Omit<Pick<ScrollArea.RootProps, "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 Footer: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & React.RefAttributes<HTMLDivElement>>
export Footer

An end-justified Group of actions; the child div wins the merge, so the part keeps the dialog scope. The actions stay regular-sized in a small dialog, since they are the dialog's primary targets.

Footer
>
<
import Dialog
Dialog
.
const CloseTrigger: React.ForwardRefExoticComponent<Omit<DialogCloseTriggerProps, "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>, "style" | "role" | "children"> & React.RefAttributes<HTMLButtonElement>>
export Root
Root
>Cancel</
import Button
Button
.
const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
classNames?: ClassNameValue;
} & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLButtonElement>>
export Root
Root
>
</
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 CloseTrigger: React.ForwardRefExoticComponent<Omit<DialogCloseTriggerProps, "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>, "style" | "role" | "children"> & React.RefAttributes<HTMLButtonElement>>
export Root
Root
variant?: Button.Variant | undefined
variant
='primary'>Save</
import Button
Button
.
const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
classNames?: ClassNameValue;
} & Pick<React.HTMLAttributes<Element>, "style" | "role" | "children"> & React.RefAttributes<HTMLButtonElement>>
export Root
Root
>
</
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 Footer: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & React.RefAttributes<HTMLDivElement>>
export Footer

An end-justified Group of actions; the child div wins the merge, so the part keeps the dialog scope. The actions stay regular-sized in a small dialog, since they are the dialog's primary targets.

Footer
>
</
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
>
);

Dialog.Root takes no props here, so it holds the open state itself. Dialog.Trigger opens the dialog, and each Dialog.CloseTrigger closes it.

asChild. A part with asChild renders no element of its own. It becomes a slot for its single child, and passes its props, ref and handlers to that child. Use asChild when the child is already the element you want. In the example above, Dialog.Trigger asChild makes the Button.Root the trigger, where the trigger would otherwise wrap it in a second button.

Behavior from state machines. The parts are built on Ark UI, whose components run zag state machines. The machine owns opening, closing, keyboard handling and the ARIA attributes, and each part spreads the props the machine gives it.

  • ARIA roles and state attributes on interactive parts come from the machine, so don’t add them to such a part.
  • An icon-only part still needs an accessible name, such as aria-label or a component’s label.
  • Layout primitives are different. Layout.Grid defaults to role='none', so give it a role such as list when you use it with asChild around a list.
  • A component that can be controlled takes open and onOpenChange, or value and onValueChange. If you leave them out, it works uncontrolled.
  • Every part takes classNames for overrides. Theme and tokens says what to pass in it.
  • asChild needs exactly one child element that forwards its ref and spreads its props. A TILE component does both. A plain function component that drops its props does not. In development, a part such as Panel.Body or Layout.Flex logs a warning for a child like that.
  • A part needs its Root above it. Outside one it has no state to read, and it fails.