Deft UI
Usage
Set up @openperf/deft in a workspace app and use its shared component conventions.
@openperf/deft ships TypeScript source and Tailwind CSS v4 utilities compiled by the host app (requires React 19).
| Entry point | Contents |
|---|---|
@openperf/deft | Components, composed components, useCopy, palette helpers. |
@openperf/deft/styles.css | Self-contained: Tailwind CSS, Manrope, theme and source scan. |
@openperf/deft/theme.css | Theme only: palettes, tokens, Ioskeley Mono and base layer. |
Setup
Add the dependency
{
"dependencies": {
"@openperf/deft": "workspace:*"
}
}Import styles
Use styles.css if the app has no Tailwind setup of its own:
@import "@openperf/deft/styles.css";Or theme.css if the app owns its Tailwind entry (Ioskeley Mono is bundled; Manrope comes from @fontsource-variable/manrope):
@import "tailwindcss";
@import "@fontsource-variable/manrope";
@import "@openperf/deft/theme.css";
@source "../../../packages/deft/src";Set theme attributes
<html data-accent="cobalt" data-palette="minimal" data-theme="system" lang="en">See Theming for all data-theme, data-palette and data-accent values.
Enable Lingui macros
Components use @lingui/react/macro for built-in labels. Enable the Vite plugin and include Deft's source in your catalog:
import { lingui } from "@lingui/vite-plugin";
lingui({ cwd: import.meta.dirname, macroTransform: true });catalogs: [
{
path: "<rootDir>/src/libs/i18n/locales/{locale}",
include: ["<rootDir>/src", "<rootDir>/../../packages/deft/src"],
},
];Mount root providers
import type { I18n } from "@lingui/core";
import { I18nProvider } from "@lingui/react";
import { Toast, Tooltip } from "@openperf/deft";
import type { ReactNode } from "react";
interface RootProvidersProps {
children: ReactNode;
i18n: I18n;
}
export const RootProviders = ({ children, i18n }: RootProvidersProps) => (
<I18nProvider i18n={i18n}>
<Tooltip.Provider>
<Toast.Provider>
<div className="isolate">{children}</div>
</Toast.Provider>
</Tooltip.Provider>
</I18nProvider>
);I18nProvider— required by components with built-in labels and locale formatting (Chart,Meter).Toast.Provider— required fortoastManager.add()and useCopy.Tooltip.Provider— optional; shares open delay across tooltips.isolate— keeps page stacking contexts below portaled overlays.
Conventions
Compound parts
Components are exported as part namespaces (Button.Root, Dialog.Content, List.Field). The standalone components are <ActionBar>, <DataTable> and <DialogConfirm>.
Composition with render
Interactive parts follow Base UI's render prop to swap the underlying element or compose triggers:
<Button.Root render={<Link to="/settings" />}>Settings</Button.Root>
<Dialog.Trigger render={<Button.Root variant="primary" />}>Invite member</Dialog.Trigger>Class merging
className is merged via cn so conflicting utilities override defaults cleanly. Most Base UI wrappers also accept a state function (state) => string.
Reduced motion
Particles.Root pauses automatically on prefers-reduced-motion: reduce or an ancestor [data-reduce-motion]. To make Tailwind's motion-safe / motion-reduce utilities follow [data-reduce-motion] as well, define both @custom-variant rules in your app stylesheet.