Skip to content

The Open Standard for Generative UI

chore: import React UI CSS once, through styles/index.css (#1252)

Visharad Kashyap754fe7c4070e
diff --git a/docs/components/overview-components/overview-page.tsx b/docs/components/overview-components/overview-page.tsx
index 1908cdb90..9015f2402 100644
--- a/docs/components/overview-components/overview-page.tsx
+++ b/docs/components/overview-components/overview-page.tsx
@@ -246,7 +246,7 @@ export function AssistantMessage({ content, isStreaming }) {
<div className="mb-6">
<CodeBlock
title="Quick example"
- code={`import "@openuidev/react-ui/components.css";
+ code={`import "@openuidev/react-ui/styles/index.css";
import {
AgentInterface,
openAIAdapter,
diff --git a/docs/content/docs/api-reference/react-ui.mdx b/docs/content/docs/api-reference/react-ui.mdx
index 4add5cee5..ab0ca6d31 100644
--- a/docs/content/docs/api-reference/react-ui.mdx
+++ b/docs/content/docs/api-reference/react-ui.mdx
@@ -21,7 +21,9 @@ Import one complete React UI stylesheet exactly once, normally from your applica
| `@openuidev/react-ui/styles/index.css` | Default, unlayered styles. Override them with normal CSS specificity. |
| `@openuidev/react-ui/layered/styles/index.css` | The same component styles wrapped in `@layer openui` for cascade-layered applications. |
-Choose one variant. Do not import `@openuidev/react-ui/components.css` or the default `styles/index.css` alongside the layered stylesheet. The unlayered rules would take precedence over every named layer and defeat the intended ordering. Importing `components.css` with the default full stylesheet also duplicates the component rules in current releases.
+`@openuidev/react-ui/components.css` and `@openuidev/react-ui/index.css` are aliases of `styles/index.css`: all three contain the same stylesheet, so import only one of them.
+
+Use either the default stylesheet or the layered one, not both. Unlayered CSS always outranks layered CSS, so if the default stylesheet is also loaded, its OpenUI rules override Tailwind utilities and any other styles you keep in layers, cancelling out the layered variant.
For a single component, use `@openuidev/react-ui/styles/<Component>.css` or its layered counterpart at `@openuidev/react-ui/layered/styles/<Component>.css` instead of a full stylesheet.
diff --git a/examples/agent-frameworks/google-adk/src/app/globals.css b/examples/agent-frameworks/google-adk/src/app/globals.css
index e0fbb6f19..7107c10c0 100644
--- a/examples/agent-frameworks/google-adk/src/app/globals.css
+++ b/examples/agent-frameworks/google-adk/src/app/globals.css
@@ -1,4 +1,3 @@
-@import "@openuidev/react-ui/components.css";
@import "@openuidev/react-ui/styles/index.css";
html,
diff --git a/examples/agent-frameworks/langgraph-platform/src/app/globals.css b/examples/agent-frameworks/langgraph-platform/src/app/globals.css
index e0fbb6f19..7107c10c0 100644
--- a/examples/agent-frameworks/langgraph-platform/src/app/globals.css
+++ b/examples/agent-frameworks/langgraph-platform/src/app/globals.css
@@ -1,4 +1,3 @@
-@import "@openuidev/react-ui/components.css";
@import "@openuidev/react-ui/styles/index.css";
html,
diff --git a/examples/agent-frameworks/mastra/src/app/globals.css b/examples/agent-frameworks/mastra/src/app/globals.css
index e0fbb6f19..7107c10c0 100644
--- a/examples/agent-frameworks/mastra/src/app/globals.css
+++ b/examples/agent-frameworks/mastra/src/app/globals.css
@@ -1,4 +1,3 @@
-@import "@openuidev/react-ui/components.css";
@import "@openuidev/react-ui/styles/index.css";
html,
diff --git a/examples/agent-frameworks/vercel-ai-sdk/src/app/globals.css b/examples/agent-frameworks/vercel-ai-sdk/src/app/globals.css
index e0fbb6f19..7107c10c0 100644
--- a/examples/agent-frameworks/vercel-ai-sdk/src/app/globals.css
+++ b/examples/agent-frameworks/vercel-ai-sdk/src/app/globals.css
@@ -1,4 +1,3 @@
-@import "@openuidev/react-ui/components.css";
@import "@openuidev/react-ui/styles/index.css";
html,
diff --git a/examples/agent-frameworks/vercel-eve/src/app/globals.css b/examples/agent-frameworks/vercel-eve/src/app/globals.css
index e0fbb6f19..7107c10c0 100644
--- a/examples/agent-frameworks/vercel-eve/src/app/globals.css
+++ b/examples/agent-frameworks/vercel-eve/src/app/globals.css
@@ -1,4 +1,3 @@
-@import "@openuidev/react-ui/components.css";
@import "@openuidev/react-ui/styles/index.css";
html,
diff --git a/examples/agent-frameworks/vercel-eve/src/app/page.tsx b/examples/agent-frameworks/vercel-eve/src/app/page.tsx
index 8ce78d374..544f06b81 100644
--- a/examples/agent-frameworks/vercel-eve/src/app/page.tsx
+++ b/examples/agent-frameworks/vercel-eve/src/app/page.tsx
@@ -1,7 +1,5 @@
"use client";
-import "@openuidev/react-ui/components.css";
-
import { AgentInterface, useSystemThemeMode } from "@openuidev/react-ui";
import { openuiLibrary } from "@openuidev/react-ui/genui-lib";
import { useMemo } from "react";
diff --git a/examples/app-frameworks/fastapi/frontend/src/App.jsx b/examples/app-frameworks/fastapi/frontend/src/App.jsx
index 9d4c3eaf5..7ccfc5b0a 100644
--- a/examples/app-frameworks/fastapi/frontend/src/App.jsx
+++ b/examples/app-frameworks/fastapi/frontend/src/App.jsx
@@ -1,4 +1,3 @@
-import "@openuidev/react-ui/components.css";
import "@openuidev/react-ui/styles/index.css";
import {
diff --git a/examples/harnesses/grok-build/src/app/layout.tsx b/examples/harnesses/grok-build/src/app/layout.tsx
index c2b1142d1..7455e9588 100644
--- a/examples/harnesses/grok-build/src/app/layout.tsx
+++ b/examples/harnesses/grok-build/src/app/layout.tsx
@@ -1,5 +1,4 @@
import type { Metadata } from "next";
-import "@openuidev/react-ui/components.css";
import "@openuidev/react-ui/styles/index.css";
import "./globals.css";
diff --git a/examples/harnesses/pi/src/app/page.tsx b/examples/harnesses/pi/src/app/page.tsx
index e9ae62f19..e2a357364 100644
--- a/examples/harnesses/pi/src/app/page.tsx
+++ b/examples/harnesses/pi/src/app/page.tsx
@@ -1,6 +1,5 @@
"use client";
-import "@openuidev/react-ui/components.css";
import "@openuidev/react-ui/styles/index.css";
import {
diff --git a/examples/miscellaneous/autofix/src/app/globals.css b/examples/miscellaneous/autofix/src/app/globals.css
index a5812a8a2..89f0efe94 100644
--- a/examples/miscellaneous/autofix/src/app/globals.css
+++ b/examples/miscellaneous/autofix/src/app/globals.css
@@ -1,4 +1,3 @@
-@import "@openuidev/react-ui/components.css";
@import "@openuidev/react-ui/styles/index.css";
html,
diff --git a/examples/miscellaneous/supabase/src/app/globals.css b/examples/miscellaneous/supabase/src/app/globals.css
index 5ced25f47..3c1b5c75b 100644
--- a/examples/miscellaneous/supabase/src/app/globals.css
+++ b/examples/miscellaneous/supabase/src/app/globals.css
@@ -1,3 +1,2 @@
@import "tailwindcss";
-@import "@openuidev/react-ui/components.css";
@import "@openuidev/react-ui/styles/index.css";
diff --git a/packages/browser-bundle/scripts/concat-css.mjs b/packages/browser-bundle/scripts/concat-css.mjs
index e4d7ef366..b45100bd3 100644
--- a/packages/browser-bundle/scripts/concat-css.mjs
+++ b/packages/browser-bundle/scripts/concat-css.mjs
@@ -9,7 +9,7 @@ const require = createRequire(import.meta.url);
// fallback mis-resolves the request.
const inputs = [
require.resolve("@openuidev/react-ui/defaults.css"),
- require.resolve("@openuidev/react-ui/components.css"),
+ require.resolve("@openuidev/react-ui/styles/index.css"),
];
const combined = inputs.map((p) => readFileSync(p, "utf8")).join("\n");
diff --git a/packages/react-ui/README.md b/packages/react-ui/README.md
index f9db81d6c..719740d54 100644
--- a/packages/react-ui/README.md
+++ b/packages/react-ui/README.md
@@ -143,6 +143,8 @@ OpenUI ships its component styles in two variants:
| `@openuidev/react-ui/styles/index.css` (default) | Unlayered — override via normal CSS specificity, as in 0.11.x and earlier |
| `@openuidev/react-ui/layered/styles/index.css` (opt-in) | Wrapped in `@layer openui` — any unlayered consumer CSS wins |
+`@openuidev/react-ui/components.css` and `@openuidev/react-ui/index.css` are aliases of `styles/index.css`: all three contain the same stylesheet, so import only one of them.
+
Need a single component's CSS? Import it per component: `./styles/<Component>.css` (unlayered) or `./layered/styles/<Component>.css` (layered).
With the layered variant, plain CSS overrides OpenUI without `!important` or specificity matching:
@@ -208,6 +210,8 @@ import { Charts } from "@openuidev/react-ui/Charts";
| :--------------------------------------------- | :--------------------------------------------------- |
| `@openuidev/react-ui` | All components and libraries |
| `@openuidev/react-ui/styles/index.css` | Full compiled stylesheet, unlayered (default import) |
+| `@openuidev/react-ui/components.css` | Alias of `styles/index.css` |
+| `@openuidev/react-ui/index.css` | Alias of `styles/index.css` |
| `@openuidev/react-ui/layered/styles/index.css` | Full stylesheet wrapped in `@layer openui` (opt-in) |
| `@openuidev/react-ui/defaults.css` | Theme tokens, always unlayered |
| `@openuidev/react-ui/genui-lib` | OpenUI Lang libraries and prompt options |
diff --git a/templates/openui-cloud/src/app/page.tsx b/templates/openui-cloud/src/app/page.tsx
index b98b41d1a..1586cb5a3 100644
--- a/templates/openui-cloud/src/app/page.tsx
+++ b/templates/openui-cloud/src/app/page.tsx
@@ -1,4 +1,4 @@
-import "@openuidev/react-ui/components.css";
+import "@openuidev/react-ui/styles/index.css";
import CloudChat from "@/components/cloud-chat";
diff --git a/templates/openui-self-hosted/overlays/langgraph/src/app/page.tsx b/templates/openui-self-hosted/overlays/langgraph/src/app/page.tsx
index 0d613580d..8a9eb1358 100644
--- a/templates/openui-self-hosted/overlays/langgraph/src/app/page.tsx
+++ b/templates/openui-self-hosted/overlays/langgraph/src/app/page.tsx
@@ -1,5 +1,4 @@
"use client";
-import "@openuidev/react-ui/components.css";
import "@openuidev/react-ui/styles/index.css";
import {
diff --git a/templates/openui-self-hosted/overlays/vercel-ai-sdk/src/app/page.tsx b/templates/openui-self-hosted/overlays/vercel-ai-sdk/src/app/page.tsx
index bb6b2ac8f..b037021d9 100644
--- a/templates/openui-self-hosted/overlays/vercel-ai-sdk/src/app/page.tsx
+++ b/templates/openui-self-hosted/overlays/vercel-ai-sdk/src/app/page.tsx
@@ -1,5 +1,4 @@
"use client";
-import "@openuidev/react-ui/components.css";
import "@openuidev/react-ui/styles/index.css";
import {
diff --git a/templates/openui-self-hosted/overlays/vercel-eve/src/app/page.tsx b/templates/openui-self-hosted/overlays/vercel-eve/src/app/page.tsx
index a2c646cb1..92abe7821 100644
--- a/templates/openui-self-hosted/overlays/vercel-eve/src/app/page.tsx
+++ b/templates/openui-self-hosted/overlays/vercel-eve/src/app/page.tsx
@@ -1,5 +1,4 @@
"use client";
-import "@openuidev/react-ui/components.css";
import "@openuidev/react-ui/styles/index.css";
import { AgentInterface, useSystemThemeMode } from "@openuidev/react-ui";
diff --git a/templates/openui-self-hosted/src/app/page.tsx b/templates/openui-self-hosted/src/app/page.tsx
index e3f57fca9..22e75119c 100644
--- a/templates/openui-self-hosted/src/app/page.tsx
+++ b/templates/openui-self-hosted/src/app/page.tsx
@@ -1,5 +1,4 @@
"use client";
-import "@openuidev/react-ui/components.css";
import "@openuidev/react-ui/styles/index.css";
import {