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

Installation

By the end of this page the contacts screen is a Vite app with TILE’s theme. It shows its first two buttons, in light or dark mode to match the system. TILE needs neither ECHO, DXOS’s database, nor PLEX, its plugin framework, for this.

You need Node 20 or later. Every page of the path is the same app, so keep the project when you go on to the next one.

A component library usually ships a finished stylesheet. TILE generates its CSS when our app builds, so we install the tools that build it beside the components. Step 1 installs seven packages, and sets the version of React:

  • @dxos/react-ui holds the components. It needs React 19.3, which is why step 1 names a version of react and react-dom.
  • @dxos/ui-theme, its peer, holds the tokens and ThemePlugin, a Vite plugin that turns them into CSS. A token is a named color or size that the components read. We set the plugin up in step 2.
  • effect and @effect/atom-react are peers of @dxos/react-ui too, so we install them beside it.
  • @dxos/vite-plugin-icons holds IconsPlugin, which gathers the icons the app draws into one file.
  • @phosphor-icons/core holds the icons themselves, as SVG files that IconsPlugin reads.
  • tailwindcss is the compiler that ThemePlugin runs.

Until the next npm release, we install the @dxos packages from pkg.pr.new, as the build of main that these pages describe. The releases on npm are older and do not all run outside the DXOS repository. ECHO’s Installation installs its packages from the same build.

  1. Make a Vite app. Create a React and TypeScript project and install the packages:

    Terminal window
    npm create vite@latest contacts -- --template react-ts
    cd contacts
    npm install \
    https://pkg.pr.new/dxos/dxos/@dxos/react-ui@20a14b9 \
    https://pkg.pr.new/dxos/dxos/@dxos/ui-theme@20a14b9 \
    effect@4.0.4 @effect/atom-react@4.0.4 react@~19.3.1 react-dom@~19.3.1
    npm install --save-dev \
    https://pkg.pr.new/dxos/dxos/@dxos/vite-plugin-icons@20a14b9 \
    @phosphor-icons/core tailwindcss

    Install any other @dxos package from the same build, with its name in place of react-ui.

  2. Configure Vite. Replace vite.config.ts. Two plugins do the work:

    • ThemePlugin generates the theme’s CSS with Tailwind. Tailwind emits a token or a class only when a file it scans names it, so content points it at the components’ own stylesheets.
    • IconsPlugin builds /icons.svg, a sprite, which is one file that holds every icon our code and the components name.
    vite.config.ts
    import react from '@vitejs/plugin-react';
    import { join } from 'node:path';
    import { defineConfig } from 'vite';
    import { ThemePlugin } from '@dxos/ui-theme/plugin';
    import { IconsPlugin, iconSymbolPattern } from '@dxos/vite-plugin-icons';
    const phosphor = join(import.meta.dirname, 'node_modules/@phosphor-icons/core/assets');
    export default defineConfig({
    plugins: [
    ThemePlugin({ content: ['node_modules/@dxos/*/src/**/*.css'] }),
    IconsPlugin({
    symbolPattern: iconSymbolPattern({ sets: ['ph'] }),
    assetPath: (_set, name, variant) =>
    join(phosphor, variant, variant === 'regular' ? `${name}.svg` : `${name}-${variant}.svg`),
    spriteFile: 'icons.svg',
    contentPaths: [join(import.meta.dirname, 'src/**/*.{ts,tsx}')],
    // Pre-bundled dependencies skip the plugin's transform, so their icons are found by scanning up front.
    scanPaths: [join(import.meta.dirname, 'node_modules/@dxos/*/dist/**/*.mjs')],
    }),
    react(),
    ],
    });

    ThemePlugin also gives the app dark mode. The dark value of every token applies under a dark class on the root element. The plugin adds a script to the page’s <head> that sets the class from the system’s setting before the first paint, and sets it again when the setting changes.

    To let the user choose the mode instead, see Custom themes and dark mode, which sets the class from a stored choice.

  3. Render the app inside the theme. Replace src/main.tsx. The new file imports two stylesheets before any component:

    • @dxos-theme is the virtual module that ThemePlugin serves.
    • @dxos/react-ui/theme.css holds the components’ own rules.

    Then it renders the app inside Theme.Provider, which gives every component the strings its built-in labels read and the icons it draws:

    import '@dxos-theme';
    import
    (alias) namespace React
    import React
    React
    from 'react';
    import {
    function createRoot(container: Container, options?: RootOptions): Root

    createRoot lets you create a root to display React components inside a browser DOM node.

    @see ― https://react.dev/reference/react-dom/client/createRoot API Reference for createRoot

    createRoot
    } from 'react-dom/client';
    import '@dxos/react-ui/theme.css';
    import * as
    import Theme
    Theme
    from '@dxos/react-ui/Theme';
    import {
    const translations: [{
    readonly 'en-US': {
    readonly "@dxos/react-ui": {
    readonly "empty.label": "No items";
    readonly "error-fallback.title.label": "Runtime Error";
    readonly "error-fallback.stack.label": "Stack";
    readonly "error-fallback.data.label": "Data";
    readonly "steps.step.label": "Step {{index}}";
    readonly "remove.label": "Delete";
    readonly "toolbar-menu.label": "Action menu";
    readonly "toolbar-drag-handle.label": "Drag to rearrange";
    readonly "toolbar-close.label": "Close";
    readonly "toolbar-delete.label": "Delete";
    readonly "floating-panel.minimize.label": "Minimize";
    readonly "floating-panel.maximize.label": "Maximize";
    readonly "floating-panel.restore.label": "Restore";
    readonly "drawer.resize.label": "Resize drawer";
    readonly "system-button.star.label": "Star";
    readonly "system-button.unstar.label": "Unstar";
    readonly "system-button.bookmark.label": "Bookmark";
    readonly "system-button.unbookmark.label": "Remove bookmark";
    readonly "system-button.check.label": "Check";
    readonly "system-button.uncheck.label": "Uncheck";
    readonly "system-button.expand.label": "Expand";
    readonly "system-button.collapse.label": "Collapse";
    readonly "system-button.ai.label": "Run AI";
    readonly "system-button.add.label": "Add";
    readonly "system-button.delete.label": "Delete";
    readonly "system-button.remove.label": "Delete";
    readonly "system-button.edit.label": "Edit";
    readonly "system-button.close.label": "Close";
    readonly "system-button.open.label": "Open";
    readonly "system-button.save.label": "Save";
    readonly "system-button.cancel.label": "Cancel";
    readonly "system-button.upload.label": "Upload";
    readonly "system-button.download.label": "Download";
    readonly "system-button.clipboard.label": "Copy";
    readonly "system-button.copied.label": "Copied";
    readonly "carousel-viewport.label": "Carousel";
    readonly "carousel-prev.label": "Previous slide";
    readonly "carousel-next.label": "Next slide";
    readonly "carousel-indicators.label": "Carousel slides";
    readonly "carousel-go-to.label": "Go to slide {{index}}";
    readonly "date-picker.placeholder.single.label": "Pick a date";
    readonly "date-picker.placeholder.range.label": "Pick a date range";
    readonly "date-picker.placeholder.multiple.label": "Pick dates";
    readonly "date-picker.clear.label": "Clear";
    readonly "calendar.nav.previous.label": "Previous month";
    readonly "calendar.nav.next.label": "Next month";
    readonly "calendar.nav.previous-year.label": "Previous year";
    readonly "calendar.nav.next-year.label": "Next year";
    readonly "calendar.nav.previous-decade.label": "Previous decade";
    readonly "calendar.nav.next-decade.label": "Next decade";
    readonly "calendar.footer.today.label": "Today";
    readonly "trigger-button.label": "Open";
    readonly "number-input.increment.label": "Increment";
    readonly "number-input.decrement.label": "Decrement";
    readonly "number-input.slider.label": "Adjust";
    readonly "password-input.show.label": "Show password";
    readonly "password-input.hide.label": "Hide password";
    readonly "tag.delete.label": "Remove {{label}}";
    readonly "combobox.search.label": "Search";
    readonly "combobox.empty.label": "No results";
    readonly "combobox.loading.label": "Loading\u2026";
    readonly "combobox.create.label": "Create \u201C{{query}}\u201D";
    readonly "drag-handle.label": "Drag to rearrange";
    readonly "drag-handle.role.label": "drag handle";
    readonly "drag-handle.grabbed.message": "Grabbed. Press the arrow keys to move, Space to drop.";
    readonly "drag-handle.moved-up.message": "Moved up.";
    readonly "drag-handle.moved-down.message": "Moved down.";
    readonly "drag-handle.dropped.message": "Dropped.";
    };
    };
    }]
    translations
    } from '@dxos/react-ui/translations';
    import {
    const App: () => React.JSX.Element
    App
    } from './App.tsx';
    function createRoot(container: Container, options?: RootOptions): Root

    createRoot lets you create a root to display React components inside a browser DOM node.

    @see ― https://react.dev/reference/react-dom/client/createRoot API Reference for createRoot

    createRoot
    (
    var document: Document

    window.document returns a reference to the document contained in the window.

    MDN Reference

    document
    .
    Document.getElementById(elementId: string): HTMLElement | null

    The getElementById() method of the Document interface returns an Element object representing the element whose id property matches the specified string. Since element IDs are required to be unique if specified, they're a useful way to get access to a specific element quickly.

    getElementById
    ('root')!).
    Root.render(children: React.ReactNode): void
    render
    (
    <
    import Theme
    Theme
    .
    const Provider: ({ children, fallback, resourceExtensions, appNs, tx, themeMode, platform, }: Theme.ProviderProps) => React.JSX.Element
    export Provider
    Provider
    tx?: ThemeFunction<Record<string, any>> | undefined
    tx
    ={
    import Theme
    Theme
    .
    const defaultTx: ThemeFunction<Record<string, any>>
    defaultTx
    }
    resourceExtensions?: Theme.Resource[] | undefined
    resourceExtensions
    ={
    const translations: [{
    readonly 'en-US': {
    readonly "@dxos/react-ui": {
    readonly "empty.label": "No items";
    readonly "error-fallback.title.label": "Runtime Error";
    readonly "error-fallback.stack.label": "Stack";
    readonly "error-fallback.data.label": "Data";
    readonly "steps.step.label": "Step {{index}}";
    readonly "remove.label": "Delete";
    readonly "toolbar-menu.label": "Action menu";
    readonly "toolbar-drag-handle.label": "Drag to rearrange";
    readonly "toolbar-close.label": "Close";
    readonly "toolbar-delete.label": "Delete";
    readonly "floating-panel.minimize.label": "Minimize";
    readonly "floating-panel.maximize.label": "Maximize";
    readonly "floating-panel.restore.label": "Restore";
    readonly "drawer.resize.label": "Resize drawer";
    readonly "system-button.star.label": "Star";
    readonly "system-button.unstar.label": "Unstar";
    readonly "system-button.bookmark.label": "Bookmark";
    readonly "system-button.unbookmark.label": "Remove bookmark";
    readonly "system-button.check.label": "Check";
    readonly "system-button.uncheck.label": "Uncheck";
    readonly "system-button.expand.label": "Expand";
    readonly "system-button.collapse.label": "Collapse";
    readonly "system-button.ai.label": "Run AI";
    readonly "system-button.add.label": "Add";
    readonly "system-button.delete.label": "Delete";
    readonly "system-button.remove.label": "Delete";
    readonly "system-button.edit.label": "Edit";
    readonly "system-button.close.label": "Close";
    readonly "system-button.open.label": "Open";
    readonly "system-button.save.label": "Save";
    readonly "system-button.cancel.label": "Cancel";
    readonly "system-button.upload.label": "Upload";
    readonly "system-button.download.label": "Download";
    readonly "system-button.clipboard.label": "Copy";
    readonly "system-button.copied.label": "Copied";
    readonly "carousel-viewport.label": "Carousel";
    readonly "carousel-prev.label": "Previous slide";
    readonly "carousel-next.label": "Next slide";
    readonly "carousel-indicators.label": "Carousel slides";
    readonly "carousel-go-to.label": "Go to slide {{index}}";
    readonly "date-picker.placeholder.single.label": "Pick a date";
    readonly "date-picker.placeholder.range.label": "Pick a date range";
    readonly "date-picker.placeholder.multiple.label": "Pick dates";
    readonly "date-picker.clear.label": "Clear";
    readonly "calendar.nav.previous.label": "Previous month";
    readonly "calendar.nav.next.label": "Next month";
    readonly "calendar.nav.previous-year.label": "Previous year";
    readonly "calendar.nav.next-year.label": "Next year";
    readonly "calendar.nav.previous-decade.label": "Previous decade";
    readonly "calendar.nav.next-decade.label": "Next decade";
    readonly "calendar.footer.today.label": "Today";
    readonly "trigger-button.label": "Open";
    readonly "number-input.increment.label": "Increment";
    readonly "number-input.decrement.label": "Decrement";
    readonly "number-input.slider.label": "Adjust";
    readonly "password-input.show.label": "Show password";
    readonly "password-input.hide.label": "Hide password";
    readonly "tag.delete.label": "Remove {{label}}";
    readonly "combobox.search.label": "Search";
    readonly "combobox.empty.label": "No results";
    readonly "combobox.loading.label": "Loading\u2026";
    readonly "combobox.create.label": "Create \u201C{{query}}\u201D";
    readonly "drag-handle.label": "Drag to rearrange";
    readonly "drag-handle.role.label": "drag handle";
    readonly "drag-handle.grabbed.message": "Grabbed. Press the arrow keys to move, Space to drop.";
    readonly "drag-handle.moved-up.message": "Moved up.";
    readonly "drag-handle.moved-down.message": "Moved down.";
    readonly "drag-handle.dropped.message": "Dropped.";
    };
    };
    }]
    translations
    }>
    <
    const App: () => React.JSX.Element
    App
    />
    </
    import Theme
    Theme
    .
    const Provider: ({ children, fallback, resourceExtensions, appNs, tx, themeMode, platform, }: Theme.ProviderProps) => React.JSX.Element
    export Provider
    Provider
    >,
    );

    resourceExtensions={translations} passes react-ui’s own strings, such as the “No items” of an empty list. tx takes a theme function, and Theme.defaultTx is the one TILE exports.

  4. Add the first buttons. Replace src/App.tsx. Layout.Flex lays the buttons out in a row with a gap from the theme’s scale, and variant='primary' marks the main action:

    import
    (alias) namespace React
    import React
    React
    from 'react';
    import * as
    import Button
    Button
    from '@dxos/react-ui/Button';
    import * as
    import Layout
    Layout
    from '@dxos/react-ui/Layout';
    export const
    const App: () => React.JSX.Element
    App
    = () => (
    <
    import Layout
    Layout
    .
    const Flex: React.ForwardRefExoticComponent<Omit<Layout.FlexProps & {
    asChild?: boolean;
    }, "className"> & {
    classNames?: import("@dxos/ui-types").ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "children" | "role" | "style"> & 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'>
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "children" | "role" | "style"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    variant?: Button.Variant | undefined
    variant
    ='primary'
    icon?: string | undefined

    Leading icon.

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

    Visible text; children take precedence.

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

    label
    ='Add contact' />
    <
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "children" | "role" | "style"> & React.RefAttributes<HTMLButtonElement>>
    export Root
    Root
    >Import</
    import Button
    Button
    .
    const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
    classNames?: ClassNameValue;
    } & Pick<React.HTMLAttributes<Element>, "children" | "role" | "style"> & 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>, "children" | "role" | "style"> & 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
    >
    );

    Delete src/App.css and src/index.css, which Vite’s template made. The theme replaces them.

Run npm run dev and open the page. Switch your system between light and dark, and the buttons follow. This preview follows the docs’ own mode picker instead:

You can render TILE components in a themed app that follows light and dark mode. Next, Lay out a screen builds the list and the detail beside it, in a folder of its own, src/layout/.