Skip to content

The Open Standard for Generative UI

docs: restore Docs / API Reference tabs and restyle the docs (#1236)

abhithesysb723f8f9628b
diff --git a/docs/README.md b/docs/README.md
index 610a6bed4..634acb38e 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -157,15 +157,17 @@ Active component-preview specific modules are located under `app/components/` an
### Navigation
-The docs use two sidebar modes. The global sidebar introduces the documentation through Overview,
-Build, Production, and Reference groups. Links with chevrons enter a nested section sidebar for
-OpenUI Lang, Build Agents (including Agent Interface), Reliability Monitoring, Gateway, or API Reference.
-Production overview and Autofix are direct pages in the global sidebar. Nested page lists continue to come from
-each section's `meta.json`; “All docs” restores the global sidebar without changing the current
-page. Direct links into a section start in nested mode.
-
-`components/docs-navbar.tsx` provides the shared docs header, search, theme control, and mobile
-sidebar trigger.
+`components/docs-navbar.tsx` provides the shared docs header, search, theme control, mobile
+sidebar trigger, and two top-level tabs: **Docs** (`/docs`) and **API Reference**
+(`/docs/api-reference`). The API Reference tab is active for any page under
+`/docs/api-reference` and its sidebar lists that folder's pages directly.
+
+Within the Docs tab there are two sidebar modes. The global sidebar introduces the documentation
+through Overview, Build, and Production groups. Links with chevrons enter a nested section sidebar
+for OpenUI Lang, Build Agents (including Agent Interface), Reliability Monitoring, or Gateway.
+Production overview and Autofix are direct pages in the global sidebar. Nested page lists continue
+to come from each section's `meta.json`; “All docs” restores the global sidebar without changing
+the current page. Direct links into a section start in nested mode.
## Path aliases
diff --git a/docs/app/docs-theme.css b/docs/app/docs-theme.css
new file mode 100644
index 000000000..64a4bbef0
--- /dev/null
+++ b/docs/app/docs-theme.css
@@ -0,0 +1,264 @@
+/*
+ * Docs-only theme: neutral grey scale, lighter headings, compact sidebar, and a tracked TOC.
+ * Everything is scoped to the docs layout so the marketing site and shared design tokens are untouched.
+ */
+
+#nd-docs-layout,
+#nd-sidebar-mobile {
+ --docs-text-heading: #18191e;
+ --docs-text-body: #404046;
+ --docs-text-secondary: #515257;
+ --docs-text-muted: #717277;
+ --docs-border: #eff0f5;
+ --docs-track: rgba(0, 0, 0, 0.05);
+ --docs-hover-bg: rgba(0, 0, 0, 0.04);
+ --docs-active-bg: rgba(0, 0, 0, 0.05);
+ --docs-link-underline: #c8c9cf;
+ --docs-code-bg: rgba(0, 0, 0, 0.05);
+ --docs-card-border: #e3e4e9;
+ --docs-card-border-hover: #c8c9cf;
+
+ --color-fd-foreground: var(--docs-text-heading);
+ --color-fd-muted-foreground: var(--docs-text-secondary);
+ --color-fd-border: var(--docs-border);
+ --color-fd-accent: var(--docs-hover-bg);
+ --color-fd-accent-foreground: var(--docs-text-heading);
+ --color-fd-primary: var(--docs-text-heading);
+}
+
+:root[data-theme="dark"] #nd-docs-layout,
+:root[data-theme="dark"] #nd-sidebar-mobile {
+ --docs-text-heading: #e0e0e6;
+ --docs-text-body: #a0a0a6;
+ --docs-text-secondary: #8b8b91;
+ --docs-text-muted: #6e6e74;
+ --docs-border: rgba(255, 255, 255, 0.1);
+ --docs-track: rgba(255, 255, 255, 0.08);
+ --docs-hover-bg: rgba(255, 255, 255, 0.05);
+ --docs-active-bg: rgba(255, 255, 255, 0.08);
+ --docs-link-underline: rgba(255, 255, 255, 0.25);
+ --docs-code-bg: rgba(255, 255, 255, 0.08);
+ --docs-card-border: rgba(255, 255, 255, 0.12);
+ --docs-card-border-hover: rgba(255, 255, 255, 0.25);
+}
+
+/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
+
+#nd-sidebar {
+ border-inline-end: 1px solid var(--docs-border) !important;
+}
+
+#nd-sidebar [data-radix-scroll-area-viewport] a,
+#nd-sidebar-mobile [data-radix-scroll-area-viewport] a {
+ padding-block: 6px;
+ border-radius: 6px;
+ color: var(--docs-text-body) !important;
+ font-size: 14px;
+ line-height: 20px;
+}
+
+#nd-sidebar [data-radix-scroll-area-viewport] a:hover,
+#nd-sidebar-mobile [data-radix-scroll-area-viewport] a:hover {
+ background-color: var(--docs-hover-bg);
+ color: var(--docs-text-heading) !important;
+}
+
+#nd-sidebar [data-radix-scroll-area-viewport] a[data-active="true"],
+#nd-sidebar-mobile [data-radix-scroll-area-viewport] a[data-active="true"] {
+ background-color: var(--docs-active-bg);
+ color: var(--docs-text-heading) !important;
+ font-weight: 500;
+}
+
+/* Folder rows (e.g. "Agent Interface" in Build Agents) */
+#nd-sidebar [data-radix-scroll-area-viewport] button.w-full,
+#nd-sidebar-mobile [data-radix-scroll-area-viewport] button.w-full {
+ padding-block: 6px;
+ border-radius: 6px;
+ color: var(--docs-text-heading);
+}
+
+/* Separators: group labels ("Overview", "Build", …) */
+#nd-sidebar [data-radix-scroll-area-viewport] p.inline-flex,
+#nd-sidebar-mobile [data-radix-scroll-area-viewport] p.inline-flex {
+ font-size: 12px;
+ font-weight: 600;
+ line-height: 16px;
+ color: var(--docs-text-heading) !important;
+}
+
+/* Top-level groups get a divider above them; separators nested in folders stay quieter. */
+#nd-sidebar [data-radix-scroll-area-viewport] > div > p.inline-flex:not(:first-child),
+#nd-sidebar-mobile [data-radix-scroll-area-viewport] > div > p.inline-flex:not(:first-child) {
+ margin-top: 16px;
+ padding-top: 16px;
+ border-top: 1px solid var(--docs-border);
+}
+
+#nd-sidebar [data-radix-scroll-area-viewport] [data-state] p.inline-flex,
+#nd-sidebar-mobile [data-radix-scroll-area-viewport] [data-state] p.inline-flex {
+ margin-top: 16px;
+ color: var(--docs-text-secondary) !important;
+}
+
+/* ─── Page header ─────────────────────────────────────────────────────────── */
+
+#nd-page > h1 {
+ font-size: 34px !important;
+ line-height: 1.15 !important;
+ font-weight: 400 !important;
+ letter-spacing: -0.02em;
+ color: var(--docs-text-heading);
+}
+
+#nd-page > h1 + p {
+ color: var(--docs-text-body);
+}
+
+/* ─── Prose ───────────────────────────────────────────────────────────────── */
+
+#nd-page .prose {
+ --tw-prose-body: var(--docs-text-body);
+ --tw-prose-headings: var(--docs-text-heading);
+ --tw-prose-lead: var(--docs-text-body);
+ --tw-prose-links: var(--docs-text-heading);
+ --tw-prose-bold: var(--docs-text-heading);
+ --tw-prose-code: var(--docs-text-heading);
+ --tw-prose-quotes: var(--docs-text-body);
+ --tw-prose-bullets: var(--docs-text-muted);
+ --tw-prose-counters: var(--docs-text-muted);
+ --tw-prose-hr: var(--docs-border);
+ --tw-prose-quote-borders: var(--docs-border);
+ --tw-prose-th-borders: var(--docs-border);
+ --tw-prose-td-borders: var(--docs-border);
+ font-weight: 350;
+}
+
+#nd-page .prose h2:not(.not-prose *) {
+ margin: 40px 0 16px;
+ font-size: 24px;
+ font-weight: 400;
+ line-height: 32px;
+ letter-spacing: -0.01em;
+}
+
+#nd-page .prose h3:not(.not-prose, .not-prose *) {
+ font-size: 20px;
+ font-weight: 400;
+ line-height: 28px;
+ letter-spacing: -0.01em;
+}
+
+#nd-page .prose a:not([data-card]):not(.not-prose *) {
+ font-weight: 500;
+ color: var(--docs-text-heading);
+ text-decoration-line: underline;
+ text-decoration-color: var(--docs-link-underline);
+ text-decoration-thickness: 1px;
+ text-underline-offset: 4px;
+ transition: text-decoration-color 150ms;
+}
+
+#nd-page .prose a:not([data-card]):not(.not-prose *):hover {
+ text-decoration-color: var(--docs-text-heading);
+}
+
+#nd-page .prose :not(pre) > code:not(.not-prose *) {
+ padding: 2px 4px;
+ border: none;
+ border-radius: 4px;
+ background: var(--docs-code-bg);
+ font-size: 0.875em;
+ font-weight: 500;
+}
+
+#nd-page .prose figure {
+ border-color: var(--docs-border);
+}
+
+/* ─── Cards ───────────────────────────────────────────────────────────────── */
+
+#nd-page [data-card].rounded-xl {
+ padding: 16px 20px;
+ border-color: var(--docs-card-border);
+ border-radius: 12px;
+ transition:
+ border-color 150ms,
+ box-shadow 150ms;
+}
+
+#nd-page [data-card].rounded-xl h3 {
+ margin-bottom: 6px;
+ font-size: 16px;
+ font-weight: 500;
+ line-height: 24px;
+ color: var(--docs-text-heading);
+}
+
+#nd-page [data-card].rounded-xl h3 + div {
+ font-size: 14px;
+ line-height: 22px;
+ color: var(--docs-text-secondary);
+}
+
+#nd-page .docs-card:hover {
+ background-color: transparent;
+ border-color: var(--docs-card-border-hover);
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
+}
+
+.docs-card-title {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+}
+
+.docs-card-arrow {
+ flex-shrink: 0;
+ color: var(--docs-text-muted);
+ transition:
+ color 150ms,
+ transform 150ms;
+}
+
+.docs-card:hover .docs-card-arrow {
+ color: var(--docs-text-heading);
+ transform: translateX(2px);
+}
+
+/* ─── Table of contents ───────────────────────────────────────────────────── */
+
+#toc-title {
+ font-size: 14px;
+ font-weight: 500;
+ line-height: 24px;
+ color: var(--docs-text-body);
+}
+
+#nd-toc .border-s {
+ border-color: var(--docs-track);
+}
+
+#nd-toc a {
+ padding-block: 4px;
+ line-height: 24px;
+ color: var(--docs-text-secondary);
+}
+
+#nd-toc a.ps-3 {
+ padding-inline-start: 16px;
+}
+
+#nd-toc a.ps-6 {
+ padding-inline-start: 28px;
+}
+
+#nd-toc a.ps-8 {
+ padding-inline-start: 40px;
+}
+
+#nd-toc a:hover,
+#nd-toc a[data-active="true"] {
+ color: var(--docs-text-heading);
+}
diff --git a/docs/app/global.css b/docs/app/global.css
index 0666fe2ea..c7ebddb82 100644
--- a/docs/app/global.css
+++ b/docs/app/global.css
@@ -5,6 +5,7 @@
@import "../shared/design-system/styles/variables/index.css";
@import "@openuidev/react-ui/styles/index.css";
@import "@openuidev/thesys/styles.css";
+@import "./docs-theme.css";
body {
--color-fd-background: var(--openui-background);
@@ -32,11 +33,12 @@ body {
#nd-docs-layout {
--color-fd-background: var(--openui-foreground);
--color-doc-surface: var(--openui-foreground);
- --fd-banner-height: 4rem !important;
+ /* 4rem top bar + 0.5rem gap above tabs + ~2.5rem tabs row — keep in sync with `.tabsBar` padding */
+ --fd-banner-height: calc(4rem + 0.5rem + 2.5rem) !important;
--fd-layout-width: 1560px !important;
width: 100%;
- min-height: calc(100dvh - 4rem) !important;
- padding-top: 4rem !important;
+ min-height: calc(100dvh - (4rem + 0.5rem + 2.5rem)) !important;
+ padding-top: calc(4rem + 0.5rem + 2.5rem) !important;
background: var(--openui-foreground);
}
@@ -45,15 +47,6 @@ body {
max-width: 800px !important;
}
-#nd-page > h1,
-#nd-page .docs-page-title,
-.docs-page-title {
- font-size: 36px !important;
- line-height: 1.1 !important;
- font-weight: 600 !important;
- letter-spacing: -0.03em;
-}
-
#nd-page[data-full="true"],
#nd-page[data-full=""] {
max-width: 1168px !important;
@@ -94,9 +87,6 @@ body {
#nd-sidebar {
background-color: transparent !important;
- border-right: none !important;
- border-inline-end: none !important;
- border-inline-end-width: 0 !important;
}
#nd-sidebar > .flex.flex-col.gap-3.p-4.pb-2,
@@ -104,10 +94,10 @@ body {
padding: 2rem 0 0.5rem 1rem !important;
}
-/* Sidebar page-tree scroll viewport */
+/* Sidebar page-tree scroll viewport; the right gutter keeps active rows and dividers off the edge */
#nd-sidebar [data-radix-scroll-area-viewport].p-4,
#nd-sidebar-mobile [data-radix-scroll-area-viewport].p-4 {
- padding: 1rem 0 1rem 1rem !important;
+ padding: 1rem 12px 1rem 1rem !important;
}
@media (min-width: 1560px) {
@@ -122,30 +112,16 @@ body {
}
}
-/* Page tree: primary text on links; tertiary on section titles (folders w/o link row, separators) */
-#nd-sidebar [data-radix-scroll-area-viewport] a,
-#nd-sidebar-mobile [data-radix-scroll-area-viewport] a {
- color: var(--openui-text-neutral-primary) !important;
-}
-
-#nd-sidebar [data-radix-scroll-area-viewport] a:hover,
-#nd-sidebar [data-radix-scroll-area-viewport] a[data-active="true"],
-#nd-sidebar-mobile [data-radix-scroll-area-viewport] a:hover,
-#nd-sidebar-mobile [data-radix-scroll-area-viewport] a[data-active="true"] {
- color: var(--openui-text-neutral-primary) !important;
-}
-
-#nd-sidebar [data-radix-scroll-area-viewport] button.w-full,
-#nd-sidebar [data-radix-scroll-area-viewport] div.w-full.rounded-lg.text-start,
-#nd-sidebar [data-radix-scroll-area-viewport] p.inline-flex.items-center.gap-2,
-#nd-sidebar-mobile [data-radix-scroll-area-viewport] button.w-full,
-#nd-sidebar-mobile [data-radix-scroll-area-viewport] div.w-full.rounded-lg.text-start,
-#nd-sidebar-mobile [data-radix-scroll-area-viewport] p.inline-flex.items-center.gap-2 {
- color: var(--openui-text-neutral-tertiary) !important;
-}
-
/* External sidebar links: icon after the label (Fumadocs puts it first). */
#nd-sidebar [data-radix-scroll-area-viewport] a[target="_blank"] > svg:first-child,
#nd-sidebar-mobile [data-radix-scroll-area-viewport] a[target="_blank"] > svg:first-child {
order: 1;
}
+
+@media (max-width: 767px) {
+ #nd-docs-layout {
+ --fd-banner-height: calc(4rem + 2.5rem) !important;
+ min-height: calc(100dvh - (4rem + 2.5rem)) !important;
+ padding-top: calc(4rem + 2.5rem) !important;
+ }
+}
diff --git a/docs/components/docs-card.tsx b/docs/components/docs-card.tsx
new file mode 100644
index 000000000..f5274e863
--- /dev/null
+++ b/docs/components/docs-card.tsx
@@ -0,0 +1,21 @@
+import { Card } from "fumadocs-ui/components/card";
+import { ChevronRight } from "lucide-react";
+import type { ComponentProps } from "react";
+
+/** Fumadocs `Card` with a trailing chevron on linked cards, styled in `app/docs-theme.css`. */
+export function DocsCard({ title, className, ...props }: ComponentProps<typeof Card>) {
+ if (!props.href) return <Card title={title} className={className} {...props} />;
+
+ return (
+ <Card
+ {...props}
+ className={className ? `docs-card ${className}` : "docs-card"}
+ title={
+ <span className="docs-card-title">
+ {title}
+ <ChevronRight aria-hidden className="docs-card-arrow" size={16} />
+ </span>
+ }
+ />
+ );
+}
diff --git a/docs/components/docs-navbar.module.css b/docs/components/docs-navbar.module.css
index 9f4313773..ae4360d10 100644
--- a/docs/components/docs-navbar.module.css
+++ b/docs/components/docs-navbar.module.css
@@ -10,6 +10,22 @@
width: 100%;
}
+.tabsBar {
+ width: 100%;
+ padding-top: 0.5rem;
+ background-color: color-mix(in srgb, var(--color-fd-background) 80%, transparent);
+ backdrop-filter: blur(24px);
+}
+
+.tabsInner {
+ width: 100%;
+ max-width: calc(1560px + 2rem);
+ min-height: 2.5rem;
+ margin-inline: auto;
+ padding-inline: 1rem;
+ box-sizing: border-box;
+}
+
.sidebarToggle {
display: none;
align-items: center;
@@ -58,7 +74,7 @@
height: 2.25rem;
padding-left: 0.875rem;
padding-right: 0.625rem;
- border: 1px solid var(--openui-border-default);
+ border: 1px solid var(--docs-border);
border-radius: 0.5rem;
background: var(--color-fd-background);
color: var(--openui-text-neutral-secondary);
@@ -95,7 +111,7 @@
align-items: center;
gap: 0.125rem;
padding: 0.125rem 0.375rem;
- border: 1px solid var(--openui-border-default);
+ border: 1px solid var(--docs-border);
border-radius: 0.25rem;
color: var(--openui-text-neutral-secondary);
font-size: 11px;
@@ -122,6 +138,63 @@
background: var(--openui-highlight);
}
+.tabsNav {
+ width: 100%;
+ min-height: 2.5rem;
+ display: flex;
+ align-items: stretch;
+ gap: 1.125rem;
+ border-bottom: 1px solid var(--docs-border);
+ overflow-x: auto;
+ scrollbar-width: none;
+}
+
+.tabsNav::-webkit-scrollbar {
+ display: none;
+}
+
+.tabLink {
+ position: relative;
+ display: inline-flex;
+ align-items: center;
+ flex-shrink: 0;
+ min-height: 2.5rem;
+ padding: 0.5rem 0;
+ color: var(--docs-text-muted);
+ text-decoration: none;
+ white-space: nowrap;
+ font-size: 0.875rem;
+ font-weight: 500;
+ line-height: 1.25rem;
+}
+
+.tabLink:hover {
+ color: var(--docs-text-heading);
+}
+
+.tabLink::after {
+ content: "";
+ position: absolute;
+ right: 0;
+ bottom: -1px;
+ left: 0;
+ height: 1.5px;
+ background: transparent;
+}
+
+.tabLinkActive {
+ color: var(--docs-text-heading);
+}
+
+.tabLinkActive::after {
+ background: var(--docs-text-heading);
+}
+
+.tabLink:focus-visible {
+ outline: 2px solid var(--openui-border-accent-emphasis);
+ outline-offset: 2px;
+}
+
@media (min-width: 640px) {
.searchShortcut {
display: inline-flex;
@@ -139,4 +212,32 @@
.sidebarToggle {
display: flex;
}
+
+ .tabsBar {
+ padding-top: 0;
+ border-top: 1px solid var(--docs-border);
+ }
+
+ .tabsInner {
+ min-height: 2.5rem;
+ padding-inline: 0;
+ }
+
+ .tabsNav {
+ box-sizing: border-box;
+ min-height: 2.5rem;
+ gap: 0.625rem;
+ padding-inline: 0.5rem;
+ border-bottom: 1px solid var(--docs-border);
+ overflow-x: auto;
+ overscroll-behavior-x: contain;
+ -webkit-overflow-scrolling: touch;
+ }
+
+ .tabLink {
+ min-height: 2.5rem;
+ padding: 0.5rem 0;
+ font-size: 0.8125rem;
+ line-height: 1.5rem;
+ }
}
diff --git a/docs/components/docs-navbar.tsx b/docs/components/docs-navbar.tsx
index 1cb493b22..17ceae97b 100644
--- a/docs/components/docs-navbar.tsx
+++ b/docs/components/docs-navbar.tsx
@@ -1,16 +1,23 @@
"use client";
+import { API_REFERENCE_URL, isPathWithin } from "@/lib/docs-navigation";
import { siteConfig } from "@/lib/layout.shared";
import { SidebarTrigger } from "fumadocs-ui/components/sidebar/base";
import { useSearchContext } from "fumadocs-ui/contexts/search";
import { useTheme } from "next-themes";
import Link from "next/link";
+import { usePathname } from "next/navigation";
import { useEffect, useState } from "react";
import { GitHubStarButton } from "./brand-logo";
import styles from "./docs-navbar.module.css";
import { SiteHeaderFrame } from "./site-header";
import { ThemeToggle } from "./theme-toggle";
+const tabs = [
+ { title: "Docs", url: "/docs" },
+ { title: "API Reference", url: API_REFERENCE_URL },
+];
+
function SearchBar() {
const { setOpenSearch } = useSearchContext();
const [isMac, setIsMac] = useState(false);
@@ -65,6 +72,8 @@ function SearchBar() {
}
export function DocsNavbar() {
+ const pathname = usePathname();
+ const activeTabUrl = isPathWithin(pathname, API_REFERENCE_URL) ? API_REFERENCE_URL : "/docs";
const { resolvedTheme } = useTheme();
// resolvedTheme is undefined during SSR and the first client render, so gate the
// theme-derived variant behind a mount flag (matching SiteMarketingHeader) to
@@ -86,8 +95,8 @@ export function DocsNavbar() {
<div className={styles.topBar}>
<SiteHeaderFrame
variant="docs"
- borderColor="var(--openui-border-default)"
- dividerColor="var(--openui-border-default)"
+ borderColor="var(--docs-border)"
+ dividerColor="var(--docs-border)"
brandVariant={logoVariant}
center={
<div className={styles.searchCenter}>
@@ -133,6 +142,26 @@ export function DocsNavbar() {
}
/>
</div>
+ <div className={styles.tabsBar}>
+ <div className={styles.tabsInner}>
+ <nav className={styles.tabsNav} aria-label="Documentation sections">
+ {tabs.map((tab) => {
+ const isActive = tab.url === activeTabUrl;
+
+ return (
+ <Link
+ key={tab.url}
+ href={tab.url}
+ className={`${styles.tabLink} ${isActive ? styles.tabLinkActive : ""}`.trim()}
+ aria-current={isActive ? "page" : undefined}
+ >
+ {tab.title}
+ </Link>
+ );
+ })}
+ </nav>
+ </div>
+ </div>
</header>
);
}
diff --git a/docs/components/docs-route-layout.tsx b/docs/components/docs-route-layout.tsx
index fab2691dc..6398054ec 100644
--- a/docs/components/docs-route-layout.tsx
+++ b/docs/components/docs-route-layout.tsx
@@ -4,6 +4,7 @@ import { DocsNavbar } from "@/components/docs-navbar";
import {
GLOBAL_DOCS_TREE,
NESTED_DOCS_SECTIONS,
+ getApiReferenceTree,
getGlobalActiveItemUrl,
getNestedDocsTree,
getNestedRootForEntryUrl,
@@ -99,10 +100,11 @@ export function DocsRouteLayout({ tree, children }: DocsRouteLayoutProps) {
const navigationContext = useMemo(() => ({ enterNested, showGlobal }), [enterNested, showGlobal]);
const nestedRoot = sidebarMode.kind === "nested" ? sidebarMode.root : undefined;
- const activeTree = useMemo(
- () => (nestedRoot ? getNestedDocsTree(tree, nestedRoot) : GLOBAL_DOCS_TREE),
- [nestedRoot, tree],
- );
+ const isApiReference = sidebarMode.kind === "api-reference";
+ const activeTree = useMemo(() => {
+ if (isApiReference) return getApiReferenceTree(tree);
+ return nestedRoot ? getNestedDocsTree(tree, nestedRoot) : GLOBAL_DOCS_TREE;
+ }, [isApiReference, nestedRoot, tree]);
return (
<DocsNavigationContext.Provider value={navigationContext}>
diff --git a/docs/content/docs/index.mdx b/docs/content/docs/index.mdx
index d593dadea..f67ed336b 100644
--- a/docs/content/docs/index.mdx
+++ b/docs/content/docs/index.mdx
@@ -14,20 +14,16 @@ OpenUI provides the building blocks for creating generated interfaces and runnin
<Cards>
<Card title="OpenUI Lang" href="/docs/openui-lang">
- A compact, line-based language for AI models to generate interfaces from your components. It is
- predictable, stream-friendly, and uses up to [**67% fewer
- tokens**](/docs/openui-lang/benchmarks) than JSON.
+ Generate UI from your components in up to 67% fewer tokens than JSON.
</Card>
<Card title="Gateway" href="/docs/gateway">
- OpenRouter for Generative UI. Access models across providers with automatic fallbacks and
- correction of invalid OpenUI Lang during streaming.
+ OpenRouter for Generative UI, with provider fallbacks and Autofix built in.
</Card>
<Card title="Autofix" href="/docs/autofix">
- Reliability for your own inference. Correct model output that would break your interface,
- without changing your model provider or inference setup.
+ Fix model output that would break your UI, using your existing provider.
</Card>
<Card title="Reliability Monitoring" href="/docs/reliability">
- Track generation failures, investigate affected interfaces, and identify recurring errors.
+ Track failed generations, inspect affected interfaces, and spot recurring errors.
</Card>
</Cards>
diff --git a/docs/lib/docs-navigation.ts b/docs/lib/docs-navigation.ts
index 1ca5f9416..552f5fdff 100644
--- a/docs/lib/docs-navigation.ts
+++ b/docs/lib/docs-navigation.ts
@@ -1,9 +1,10 @@
import type * as PageTree from "fumadocs-core/page-tree";
-export type NestedDocsRoot = "openui-lang" | "build-agents" | "gateway" | "reliability" | "api-reference";
+export type NestedDocsRoot = "openui-lang" | "build-agents" | "gateway" | "reliability";
export type SidebarMode =
| { kind: "global" }
+ | { kind: "api-reference" }
| {
kind: "nested";
root: NestedDocsRoot;
@@ -46,14 +47,10 @@ export const NESTED_DOCS_SECTIONS: Record<NestedDocsRoot, NestedSection> = {
pathPrefix: "/docs/reliability",
treeFolder: "reliability",
},
- "api-reference": {
- title: "API Reference",
- entryUrl: "/docs/api-reference",
- pathPrefix: "/docs/api-reference",
- treeFolder: "api-reference",
- },
};
+export const API_REFERENCE_URL = "/docs/api-reference";
+
const promotedGlobalUrls = new Set([
"/docs",
"/docs/getting-started",
@@ -70,7 +67,7 @@ export const GLOBAL_DOCS_TREE: PageTree.Root = {
$id: "docs:global",
name: "OpenUI",
children: [
- { type: "separator", name: "Overview" },
+ { type: "separator", name: "Start" },
{ type: "page", name: "Introduction", url: "/docs" },
{ type: "page", name: "Getting Started", url: "/docs/getting-started" },
{
@@ -109,16 +106,10 @@ export const GLOBAL_DOCS_TREE: PageTree.Root = {
url: NESTED_DOCS_SECTIONS.reliability.entryUrl,
},
{ type: "page", name: "Deploy your app", url: "/docs/deploy" },
- { type: "separator", name: "Reference" },
- {
- type: "page",
- name: NESTED_DOCS_SECTIONS["api-reference"].title,
- url: NESTED_DOCS_SECTIONS["api-reference"].entryUrl,
- },
],
};
-function isPathWithin(pathname: string, prefix: string): boolean {
+export function isPathWithin(pathname: string, prefix: string): boolean {
return pathname === prefix || pathname.startsWith(`${prefix}/`);
}
@@ -137,6 +128,8 @@ export function getNestedRootForPathname(pathname: string): NestedDocsRoot | und
}
export function getDefaultSidebarMode(pathname: string): SidebarMode {
+ if (isPathWithin(pathname, API_REFERENCE_URL)) return { kind: "api-reference" };
+
if (pathname === "/docs/overview" || promotedGlobalUrls.has(pathname)) {
return { kind: "global" };
}
@@ -171,6 +164,18 @@ function findNestedFolder(nodes: PageTree.Node[], treeFolder: string): PageTree.
return undefined;
}
+export function getApiReferenceTree(tree: PageTree.Root): PageTree.Root {
+ const folder = findNestedFolder(tree.children, "api-reference");
+ if (!folder) throw new Error('Docs folder "api-reference" was not found in the page tree.');
+
+ return {
+ type: "root",
+ $id: "docs:api-reference",
+ name: folder.name,
+ children: folder.children,
+ };
+}
+
export function getNestedDocsTree(tree: PageTree.Root, root: NestedDocsRoot): PageTree.Root {
const folder = findNestedFolder(tree.children, NESTED_DOCS_SECTIONS[root].treeFolder);
if (!folder) throw new Error(`Nested docs root "${root}" was not found in the page tree.`);
diff --git a/docs/mdx-components.tsx b/docs/mdx-components.tsx
index 446efc678..54a8e8ec1 100644
--- a/docs/mdx-components.tsx
+++ b/docs/mdx-components.tsx
@@ -13,6 +13,7 @@ import {
DgScoreboard,
DgSpeedArc,
} from "@/components/charts/diffusion-charts";
+import { DocsCard } from "@/components/docs-card";
import { FakeVisual } from "@/components/fake-visual";
import { Mermaid } from "@/components/mermaid";
import { ModelReleaseCards } from "@/components/model-release-cards";
@@ -25,6 +26,7 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
return {
...defaultMdxComponents,
...TabsComponents,
+ Card: DocsCard,
TweetEmbed,
FakeVisual,
CompletionByModel,