diff --git a/.changeset/37452-studio-menu-front-end-style.md b/.changeset/37452-studio-menu-front-end-style.md
new file mode 100644
index 00000000000..8f26a1f355b
--- /dev/null
+++ b/.changeset/37452-studio-menu-front-end-style.md
@@ -0,0 +1,14 @@
+---
+'@object-ui/app-shell': patch
+'@object-ui/layout': patch
+---
+
+feat(studio): the Studio left menu is drawn as the app's menu, in Studio's own graphite
+
+Clause-②: yes (widening)
+Metadata-protocol: none
+
+- **Groups collapse the way the app menu's do.** Each of the menu's groups is the app menu's collapsible group: its label is a disclosure button with a chevron, open by default; a search opens every group it lists, chevron included, and holds it open; in the phone drawer the label is the app menu's 44 px tap target. A group still carries no count: a number in the Studio menu is an entry's items.
+- **An entry is the app menu's row.** It draws a bare line icon (no tile) before its name, at the app menu's row size; the open page's entry is the app menu's inset pill with a bar on its left edge.
+- **Studio's own accent.** The pill and the bar are graphite, light and dark, whatever the app's theme colour is (`STUDIO_ACCENT` in the Studio tokens); the app's `accentColor` no longer reaches anything under that class either: its hover tint is a faint graphite. Only the app's logo keeps the app's colour.
+- **New exports: `NavigationGroupSection` and its props type `NavigationGroupSectionProps`** (`@object-ui/layout`), the collapsible sidebar group the app menu draws every `group` entry with. The app menu renders exactly as before.
diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx
index ca7a60bb009..5e6f806d431 100644
--- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx
+++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx
@@ -12,8 +12,9 @@
* read on the menu:
*
* 1. The menu's Access group holds the permission-set entry, a real router
- * link, with no "More" trigger anywhere; the group carries the shield glyph,
- * the Data group's is not it.
+ * link, with no "More" trigger anywhere; that entry carries the shield
+ * glyph, the Data group's object entry does not (objectstack#37452: a
+ * group's label draws no glyph, each entry draws its own line icon).
* 2. With the Access pillar's address open (under any package id) — which
* lands on the list of sets since objectstack#36905 — that entry is the
* current page and carries the active state; with Data open it carries
@@ -30,7 +31,7 @@ import * as React from 'react';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { render, screen, cleanup, within } from '@testing-library/react';
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
-import { ShieldCheck } from 'lucide-react';
+import { Shield } from 'lucide-react';
const PKG = 'com.acme.app';
@@ -208,9 +209,9 @@ function renderAt(path: string) {
const menu = () => screen.getByTestId('studio-menu');
const entry = (testId: string) => within(menu()).getByTestId(testId);
-/** The markup of lucide's own `ShieldCheck`, the Access group's glyph. */
+/** The markup of lucide's own `Shield`, the permission-set entry's glyph. */
function shieldMarkup(): string {
- const { container, unmount } = render();
+ const { container, unmount } = render();
const markup = container.querySelector('svg')!.innerHTML;
unmount();
return markup;
@@ -230,8 +231,8 @@ describe('Studio menu: Access is a group of its own, and More is gone (objectui#
expect(screen.queryByTestId('studio-nav-more')).toBeNull();
expect(screen.queryByTestId('studio-pillar-nav')).toBeNull();
const shield = shieldMarkup();
- expect(group.querySelector('svg')!.innerHTML).toBe(shield);
- expect(within(menu()).getByTestId('studio-menu-group-data').querySelector('svg')!.innerHTML).not.toBe(shield);
+ expect(within(group).getByTestId(PERMISSION_ENTRY).querySelector('svg')!.innerHTML).toBe(shield);
+ expect(entry(OBJECT_ENTRY).querySelector('svg')!.innerHTML).not.toBe(shield);
});
it.each(['app.objectstack.hotcrm', PKG])('with Access open in %s, the permission-set entry is the current page', async (pkg) => {
diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx
index 31da8145ae3..e64f38b81d3 100644
--- a/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx
+++ b/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx
@@ -14,8 +14,8 @@
* 5. Focus order: the toggle, then the search, then the entries.
*
* objectstack#37201 — the two tiers (ADR-0084, amended 2026-11-25):
- * 6. Group labels are muted, with no count and no link; an entry's muted
- * number is its items; an empty 常用 type is dimmed, numberless, a link.
+ * 6. Group labels carry no count and no link; an entry's muted number is
+ * its items; an empty 常用 type is dimmed, numberless, a link.
* 7. The 「高级」 fold: closed by default, remembered under
* `studio_menu_advanced`, open by itself on one of its pages without
* writing the cookie, ignored by the search, a button with
@@ -28,11 +28,23 @@
* opens the area's type directory and is current there. CONTROL: a 高级
* type the package holds none of is still not in the fold.
*
+ * objectstack#37452 — drawn as the app's menu:
+ * 11. A group is the app menu's collapsible group: its label is a disclosure
+ * button, open by default; closing it hides its entries; a search opens
+ * every group it lists, chevron included, and holds it open; in the phone
+ * drawer the label is the app menu's 44 px tap target.
+ * 12. An entry draws a bare line icon before its name; the current entry is
+ * the primitive's active row (the pill and left bar).
+ * 13. The selected entry is tinted by Studio's graphite accent whatever the
+ * app's theme colours are: every theme token the app's branding writes
+ * (primary and accent) is rebound over it.
+ *
* The provider, the sidebar primitive and the router are real; only the
* metadata reads are doubled.
*/
import '@testing-library/jest-dom/vitest';
+import type { ReactNode } from 'react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
@@ -63,8 +75,10 @@ vi.mock('../metadata-admin/useMetadata', async (importOriginal) => {
};
});
+import { useAppShellBranding } from '@object-ui/layout';
import { StudioMenu, StudioMenuProvider, StudioMenuTrigger } from './StudioMenu';
import { STUDIO_MENU_ADVANCED_COOKIE, STUDIO_MENU_COOKIE } from './studioMenuModel';
+import { STUDIO_ACCENT, STUDIO_ACCENT_HSL } from './studio-tokens';
const PKG = 'com.acme.app';
@@ -234,13 +248,12 @@ describe('the current entry and the search', () => {
});
describe('the group labels (objectstack#37201)', () => {
- it('are muted headings: no count, no link, not focusable', () => {
+ it('carry no count and no link: the label is the group\'s name', () => {
renderAt(`/studio/${PKG}/data`);
const group = screen.getByTestId('studio-menu-group-data');
const label = group.querySelector('[data-sidebar="group-label"]')!;
expect(label).toHaveTextContent(/^Data$/);
- expect(label).toHaveClass('text-muted-foreground');
- expect(label.querySelector('a, button, [tabindex]')).toBeNull();
+ expect(label.querySelector('a')).toBeNull();
expect(label.closest('a')).toBeNull();
});
@@ -407,7 +420,7 @@ describe('~org and ~all draw no fold (objectstack#37201)', () => {
it.each([
['~org', '/studio/~org/metadata/flow?source=runtime'],
['~all', '/studio/~all/metadata'],
- ])('%s: its entries flat, in the table\'s order, under muted labels', (segment, path) => {
+ ])('%s: its entries flat, in the table\'s order, under their groups\' labels', (segment, path) => {
renderAt(path, segment);
expect(screen.queryByTestId('studio-menu-advanced-toggle')).toBeNull();
expect(screen.queryByTestId('studio-menu-advanced')).toBeNull();
@@ -418,7 +431,7 @@ describe('~org and ~all draw no fold (objectstack#37201)', () => {
'studio-menu-entry-environment',
]);
for (const a of within(security).getAllByRole('link')) expect(a).toBeVisible();
- expect(security.querySelector('[data-sidebar="group-label"]')).toHaveClass('text-muted-foreground');
+ expect(security.querySelector('[data-sidebar="group-label"]')).toHaveTextContent(/^Access$/);
expect(screen.getByTestId('studio-menu-entry-orgFlows')).toBeVisible();
// objectstack#37211 — no count above Organization flows (it read "0 types" over the group's one entry).
const automation = screen.getByTestId('studio-menu-group-automation');
@@ -486,3 +499,169 @@ describe('全部类型 All types (objectstack#37360, ADR-0084 amended 2026-11-25
expect(screen.queryByTestId('studio-menu-all-types')).toBeNull();
});
});
+
+describe('drawn as the app\'s menu (objectstack#37452)', () => {
+ const groupLabel = (testId: string) =>
+ screen.getByTestId(testId).querySelector('[data-sidebar="group-label"]')!;
+
+ it('a group\'s label is the app menu\'s disclosure button: open by default, closing it hides its entries', () => {
+ renderAt(`/studio/${PKG}/data`);
+ const label = groupLabel('studio-menu-group-data');
+ expect(label.tagName).toBe('BUTTON');
+ expect(label).toHaveAccessibleName('Data');
+ expect(label).toHaveAttribute('aria-expanded', 'true');
+ // The group's list is named by its label.
+ expect(entry('type:object').closest('ul')).toHaveAttribute('aria-labelledby', label.id);
+ expect(entry('type:object')).toBeVisible();
+
+ fireEvent.click(label);
+ expect(label).toHaveAttribute('aria-expanded', 'false');
+ expect(screen.queryByTestId('studio-menu-entry-type:object')).toBeNull();
+ // CONTROL: the other groups stay open.
+ expect(entry('type:flow')).toBeVisible();
+ // No count is drawn on a closed group: a number in this menu is an entry's items.
+ expect(label).toHaveTextContent(/^Data$/);
+
+ fireEvent.click(label);
+ expect(entry('type:object')).toBeVisible();
+ });
+
+ // On ~all the groups are drawn flat with and without a search, so the
+ // group the author closed is the same group the search lists into.
+ it('a search lists its matches in a group the author closed', () => {
+ renderAt('/studio/~all/metadata', '~all');
+ const label = groupLabel('studio-menu-group-security');
+ fireEvent.click(label);
+ expect(label).toHaveAttribute('aria-expanded', 'false');
+ expect(screen.queryByTestId('studio-menu-entry-type:position')).toBeNull();
+ fireEvent.change(screen.getByTestId('studio-menu-search'), { target: { value: 'position' } });
+ expect(entry('type:position')).toBeVisible();
+ expect(groupLabel('studio-menu-group-security')).toHaveAttribute('aria-expanded', 'true');
+ // Drawn open, chevron included: the chevron is turned down as on any open group.
+ const chevron = () => groupLabel('studio-menu-group-security').querySelector('svg')!;
+ expect(chevron()).toHaveClass('rotate-90');
+ // A click while the search holds it open changes nothing.
+ fireEvent.click(groupLabel('studio-menu-group-security'));
+ expect(groupLabel('studio-menu-group-security')).toHaveAttribute('aria-expanded', 'true');
+ expect(chevron()).toHaveClass('rotate-90');
+ expect(entry('type:position')).toBeVisible();
+ // The author's choice is kept: clearing the search closes it again.
+ fireEvent.change(screen.getByTestId('studio-menu-search'), { target: { value: '' } });
+ expect(screen.queryByTestId('studio-menu-entry-type:position')).toBeNull();
+ expect(chevron()).not.toHaveClass('rotate-90');
+ });
+
+ it('a click on an open group\'s label during a search is not taken: the group is still open once the search is cleared', () => {
+ renderAt('/studio/~all/metadata', '~all');
+ fireEvent.change(screen.getByTestId('studio-menu-search'), { target: { value: 'position' } });
+ fireEvent.click(groupLabel('studio-menu-group-security'));
+ expect(groupLabel('studio-menu-group-security')).toHaveAttribute('aria-expanded', 'true');
+ fireEvent.change(screen.getByTestId('studio-menu-search'), { target: { value: '' } });
+ expect(groupLabel('studio-menu-group-security')).toHaveAttribute('aria-expanded', 'true');
+ expect(entry('type:position')).toBeVisible();
+ });
+
+ it('in the phone drawer a group\'s label is the app menu\'s 44 px tap target; CONTROL: docked it is not', async () => {
+ setWidth(390);
+ renderAt(`/studio/${PKG}/data`);
+ fireEvent.click(toggle());
+ const drawer = await screen.findByRole('dialog');
+ const label = within(drawer).getByTestId('studio-menu-group-data').querySelector('[data-sidebar="group-label"]')!;
+ expect(label).toHaveClass('min-h-[44px]');
+ cleanup();
+ setWidth(1280);
+ renderAt(`/studio/${PKG}/data`);
+ expect(groupLabel('studio-menu-group-data')).not.toHaveClass('min-h-[44px]');
+ });
+
+ it('an entry draws a bare line icon before its name, on the app menu\'s row', () => {
+ renderAt(`/studio/${PKG}/data`);
+ for (const key of ['type:object', 'type:flow', 'type:permission']) {
+ const icon = screen.getByTestId(`studio-menu-icon-${key}`);
+ expect(icon.tagName.toLowerCase()).toBe('svg');
+ expect(icon).toHaveAttribute('aria-hidden', 'true');
+ // No tile: the icon is the row's own child, the first one.
+ expect(icon.parentElement).toBe(entry(key));
+ expect(entry(key).firstElementChild).toBe(icon);
+ expect(entry(key)).toHaveAttribute('data-sidebar', 'menu-button');
+ }
+ // A type and an entry that is not one each draw an icon, the fold's too.
+ fireEvent.click(fold());
+ expect(screen.getByTestId('studio-menu-icon-type:hook').tagName.toLowerCase()).toBe('svg');
+ expect(screen.getByTestId('studio-menu-icon-owd').tagName.toLowerCase()).toBe('svg');
+ });
+
+ it('the current entry is the primitive\'s active row (the pill and its left bar), and only it', () => {
+ renderAt(`/studio/${PKG}/metadata/flow?package=${PKG}`);
+ expect(entry('type:flow')).toHaveAttribute('data-active', 'true');
+ expect(entry('type:object')).toHaveAttribute('data-active', 'false');
+ // Its count is not muted: it reads with the selected name.
+ expect(screen.getByTestId('studio-menu-count-type:flow')).not.toHaveClass('text-muted-foreground');
+ });
+
+ describe('the selected entry is tinted by Studio\'s graphite whatever the app\'s theme colour is', () => {
+ const ROOT_TOKENS = ['--primary', '--primary-foreground', '--ring', '--sidebar-primary', '--sidebar-ring', '--accent', '--accent-foreground'];
+
+ function Branded({ children }: { children: ReactNode }) {
+ // A non-default app theme: a rose primary and an amber accent, written on the page root by the app shell's own hook.
+ useAppShellBranding({ primaryColor: '#e11d48', accentColor: '#f59e0b' });
+ return <>{children}>;
+ }
+
+ afterEach(() => {
+ for (const token of ROOT_TOKENS) document.documentElement.style.removeProperty(token);
+ for (const token of ['--brand-primary', '--brand-primary-hsl', '--brand-accent', '--brand-accent-hsl']) document.documentElement.style.removeProperty(token);
+ });
+
+ /** The declarations a class string makes: `[--x:a_b]` and `dark:[--x:a_b]`, underscores read as spaces. */
+ function declarations(classes: string, dark: boolean): Map {
+ const out = new Map();
+ for (const cls of classes.split(/\s+/)) {
+ const m = /^(dark:)?\[(--[\w-]+):(.+)\]$/.exec(cls);
+ if (m && !!m[1] === dark) out.set(m[2], m[3].replace(/_/g, ' '));
+ }
+ return out;
+ }
+
+ it('every theme token the app\'s branding writes on the page root is rebound to graphite over the selected entry, light and dark', () => {
+ render(
+
+
+
+ } />
+
+
+ ,
+ );
+ // CONTROL: the app's theme is not the default — its colour is on the page root.
+ const root = document.documentElement.style;
+ const written = [...Array.from({ length: root.length }, (_, i) => root.item(i))].filter(
+ // `--brand-*` are the hook's hex aliases; no sidebar or menu class reads them.
+ (token) => token.startsWith('--') && !token.startsWith('--brand-'),
+ );
+ expect(written).toContain('--primary');
+ expect(written).toContain('--accent');
+ expect(root.getPropertyValue('--primary').trim()).not.toBe(STUDIO_ACCENT_HSL.light);
+
+ // The selected entry is the active row, and it sits inside Studio's accent scope.
+ const selected = entry('type:flow');
+ expect(selected).toHaveAttribute('data-active', 'true');
+ const scope = selected.closest('[data-studio-accent]');
+ expect(scope).not.toBeNull();
+ for (const cls of STUDIO_ACCENT.split(/\s+/)) expect(scope).toHaveClass(cls);
+ // Nothing between the scope and the entry writes a theme token back.
+ for (let el: HTMLElement | null = selected; el && el !== scope; el = el.parentElement) {
+ for (const token of written) expect(el.style.getPropertyValue(token), `${token} on ${el.tagName}`).toBe('');
+ }
+
+ const light = declarations(STUDIO_ACCENT, false);
+ const dark = declarations(STUDIO_ACCENT, true);
+ for (const token of written) {
+ expect(light.has(token), `${token} rebound in the light theme`).toBe(true);
+ expect(dark.has(token), `${token} rebound in the dark theme`).toBe(true);
+ }
+ expect(light.get('--primary')).toBe(STUDIO_ACCENT_HSL.light);
+ expect(dark.get('--primary')).toBe(STUDIO_ACCENT_HSL.dark);
+ });
+ });
+});
diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx
index bc5cf651a78..e16b7cc4e34 100644
--- a/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx
+++ b/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx
@@ -17,12 +17,21 @@
* the shell's leave guard (`useRegisterUnsavedEdits`), whose capture-phase
* link guard asks before any of them leaves.
*
+ * ## Drawn as the app's menu (objectstack#37452)
+ *
+ * A group is the app menu's collapsible group (`NavigationGroupSection` from
+ * `@object-ui/layout`): its label is a disclosure button with a chevron, open
+ * by default and while a search lists matches, and it carries no count. An
+ * entry is the app menu's row: a line icon with no tile, its name, and its
+ * muted item count; the open page's entry is the app menu's inset pill with a
+ * bar on its left edge. Studio's own accent, graphite ({@link STUDIO_ACCENT}),
+ * tints the pill and the bar, never the app's theme colour.
+ *
* ## Two tiers on a package (ADR-0084, amended 2026-11-25; objectstack#37201)
*
- * A group's label is a small muted heading: no count, not a link, not
- * focusable. Only entries look clickable, and an entry's muted number means
- * one thing, its items. The 常用 Common groups come first; below a divider,
- * one 「高级」 button folds every 高级 Advanced entry under the same labels.
+ * An entry's muted number means one thing, its items. The 常用 Common groups
+ * come first; below a divider, one 「高级」 button folds every 高级 Advanced
+ * entry under the same labels.
* - The fold is closed by default and remembered per browser under its own
* cookie, {@link STUDIO_MENU_ADVANCED_COOKIE}; only a click writes it.
* - It opens itself while the open page is one of its entries (a bookmark to
@@ -39,13 +48,52 @@
import * as React from 'react';
import { Link, useLocation } from 'react-router-dom';
-import { ChevronRight, PanelLeft } from 'lucide-react';
+import {
+ Activity,
+ AppWindow,
+ BarChart3,
+ BookOpen,
+ Bot,
+ Boxes,
+ Brain,
+ Building2,
+ CalendarClock,
+ ChevronRight,
+ Database,
+ File,
+ FileText,
+ Gauge,
+ Globe,
+ Inbox,
+ KeyRound,
+ Languages,
+ LayoutGrid,
+ ListChecks,
+ ListTree,
+ Mail,
+ MousePointerClick,
+ PanelLeft,
+ Puzzle,
+ Rows3,
+ Share2,
+ Shield,
+ Sparkles,
+ Sprout,
+ Table2,
+ Unplug,
+ UserCog,
+ Users,
+ Webhook,
+ Workflow,
+ Wrench,
+ ArrowLeftRight,
+ ShieldCheck,
+ type LucideIcon,
+} from 'lucide-react';
import {
cn,
Sidebar,
SidebarContent,
- SidebarGroup,
- SidebarGroupLabel,
SidebarHeader,
SidebarInput,
SidebarMenu,
@@ -54,6 +102,7 @@ import {
SidebarProvider,
useSidebar,
} from '@object-ui/components';
+import { NavigationGroupSection } from '@object-ui/layout';
import {
STUDIO_MENU_ENTRY_LABEL_KEYS,
STUDIO_MENU_GROUP_ICONS,
@@ -64,7 +113,7 @@ import {
} from './studioMenuData.js';
import { t, tFormat, translateMetadataType } from '../metadata-admin/i18n.js';
import { studioMenuGroupLabel } from './studioMenuGroupLabel.js';
-import { STUDIO_HEADER_ICON_BUTTON } from './studio-tokens.js';
+import { STUDIO_ACCENT, STUDIO_HEADER_ICON_BUTTON } from './studio-tokens.js';
import {
STUDIO_MENU_ADVANCED_COOKIE,
STUDIO_MENU_COOKIE,
@@ -76,6 +125,7 @@ import {
studioMenuScope,
studioMenuTiers,
type StudioMenuEntry,
+ type StudioMenuGroup,
type StudioMenuGroupModel,
type StudioMenuTier,
} from './studioMenuModel.js';
@@ -91,16 +141,97 @@ function writeAdvancedCookie(open: boolean): void {
document.cookie = `${STUDIO_MENU_ADVANCED_COOKIE}=${open}; path=/; max-age=${ADVANCED_COOKIE_MAX_AGE}`;
}
+/**
+ * Each listed type's line icon, drawn bare (no tile) before its name, as the
+ * app menu draws an entry's. A type with no row here draws its group's icon.
+ */
+const STUDIO_MENU_TYPE_ICONS: Readonly> = {
+ object: Table2,
+ app: LayoutGrid,
+ page: File,
+ dashboard: Gauge,
+ report: BarChart3,
+ flow: Workflow,
+ permission: Shield,
+ agent: Bot,
+ tool: Wrench,
+ skill: Sparkles,
+ picklist: ListChecks,
+ hook: Webhook,
+ mapping: ArrowLeftRight,
+ object_extension: Puzzle,
+ seed: Sprout,
+ view: Rows3,
+ action: MousePointerClick,
+ dataset: Boxes,
+ job: CalendarClock,
+ doc: FileText,
+ book: BookOpen,
+ email_template: Mail,
+ translation: Languages,
+ api: Globe,
+ datasource: Database,
+ external_catalog: Unplug,
+ position: Users,
+ assignment_rule: UserCog,
+ sharing_rule: Share2,
+ queue: Inbox,
+ capability: ListTree,
+ ai_context: Brain,
+};
+
+/** The icon of each entry that is not a type: the page it opens. */
+const STUDIO_MENU_KIND_ICONS: Readonly, LucideIcon>> = {
+ orgFlows: Building2,
+ owd: ShieldCheck,
+ diagnostics: Activity,
+ environment: KeyRound,
+ allTypes: AppWindow,
+};
+
+function studioMenuEntryIcon(entry: StudioMenuEntry, group: StudioMenuGroup | null): LucideIcon {
+ if (entry.kind !== 'type') return STUDIO_MENU_KIND_ICONS[entry.kind];
+ return STUDIO_MENU_TYPE_ICONS[entry.type ?? ''] ?? (group ? STUDIO_MENU_GROUP_ICONS[group] : LayoutGrid);
+}
/**
- * objectui#12795 — every `SidebarGroupLabel` call site hides its label from
- * focus and the accessibility tree in the icon sidebar (the primitive's own
- * `opacity-0` leaves it reachable). This menu is `offcanvas`, never `icon`, so
- * the classes never apply here; it carries them as every call site does.
+ * One group of the menu: the app menu's collapsible group, open until the
+ * author closes it. While a search lists matches the group is drawn open,
+ * chevron included, and a click on its label changes nothing: the author's
+ * own choice comes back when the search is cleared. In the phone drawer its
+ * label is the app menu's 44 px tap target.
*/
-const HIDDEN_ICON_LABEL_NOT_FOCUSABLE =
- 'group-data-[state=collapsed]:group-data-[collapsible=icon]:invisible ' +
- 'group-data-[state=collapsed]:group-data-[collapsible=icon]:transition-[margin,opacity,visibility]';
+function ignoreOpenChange(): void {}
+
+function StudioMenuGroupSection({
+ label,
+ labelId,
+ searching,
+ isMobile,
+ testId,
+ children,
+}: {
+ label: string;
+ labelId: string;
+ searching: boolean;
+ isMobile: boolean;
+ testId: string;
+ children: React.ReactNode;
+}): React.ReactElement {
+ const [open, setOpen] = React.useState(true);
+ return (
+
+ {children}
+
+ );
+}
/**
@@ -230,12 +361,13 @@ function StudioMenuBody({
writeAdvancedCookie(next);
};
- const renderEntry = (entry: StudioMenuEntry) => {
+ const renderEntry = (entry: StudioMenuEntry, group: StudioMenuGroup | null) => {
const label = labelOf(entry);
const isCurrent = entry.key === current;
+ const Icon = studioMenuEntryIcon(entry, group);
return (
-
+
+ {label}
{entry.count !== undefined && !entry.empty && (
@@ -270,31 +403,23 @@ function StudioMenuBody({
};
const renderGroups = (groups: readonly StudioMenuGroupModel[], tier: StudioMenuTier | 'flat') =>
- groups.map(({ group, entries }) => {
- const Icon = STUDIO_MENU_GROUP_ICONS[group];
- const labelId = `${searchId}-${tier}-${group}`;
- return (
-
-
-
- {studioMenuGroupLabel(group, locale)}
-
- {entries.map(renderEntry)}
-
- );
- });
+ groups.map(({ group, entries }) => (
+
+ {entries.map((entry) => renderEntry(entry, group))}
+
+ ));
// The fold's last row, under no group: no label above it, no group around it.
const renderAllTypes = (entry: StudioMenuEntry) => (
);
@@ -305,56 +430,60 @@ function StudioMenuBody({
// fixed to the window's full height as the app sidebar is.
className="!absolute !h-full"
>
-
-
- setQuery(e.target.value)}
- />
-
-
-
-
+ {/* Studio's accent over everything the menu draws, docked or in the
+ phone drawer (the primitive puts its own class on the docked frame only). */}
+
+
+
+ setQuery(e.target.value)}
+ />
+
+
+
+
+
);
}
diff --git a/ui/packages/app-shell/src/views/studio-design/studio-tokens.test.ts b/ui/packages/app-shell/src/views/studio-design/studio-tokens.test.ts
new file mode 100644
index 00000000000..8af802507e1
--- /dev/null
+++ b/ui/packages/app-shell/src/views/studio-design/studio-tokens.test.ts
@@ -0,0 +1,74 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * objectstack#37452 — Studio's accent class spells its values literally (so
+ * Tailwind's source scan finds the classes); this holds every value it spells
+ * equal to the constants the rest of the code reads, in the light and the
+ * dark theme.
+ */
+
+import { describe, expect, it } from 'vitest';
+import {
+ STUDIO_ACCENT,
+ STUDIO_ACCENT_FOREGROUND_HSL,
+ STUDIO_ACCENT_HSL,
+ STUDIO_ACCENT_TINT_FOREGROUND_HSL,
+ STUDIO_ACCENT_TINT_HSL,
+} from './studio-tokens';
+
+/** The declarations the class string makes in one theme: `[--x:a_b]` / `dark:[--x:a_b]`, underscores read as spaces. */
+function declarations(dark: boolean): Map {
+ const out = new Map();
+ for (const cls of STUDIO_ACCENT.split(/\s+/)) {
+ const m = /^(dark:)?\[(--[\w-]+):(.+)\]$/.exec(cls);
+ if (m && !!m[1] === dark) out.set(m[2], m[3].replace(/_/g, ' '));
+ }
+ return out;
+}
+
+describe('STUDIO_ACCENT (objectstack#37452)', () => {
+ it.each([
+ ['light', false],
+ ['dark', true],
+ ] as const)('%s: the accent tokens are graphite, and the foreground is the accent\'s foreground', (theme, dark) => {
+ const decl = declarations(dark);
+ for (const token of ['--primary', '--ring', '--sidebar-primary', '--sidebar-ring']) {
+ expect(decl.get(token), token).toBe(STUDIO_ACCENT_HSL[theme]);
+ }
+ expect(decl.get('--primary-foreground')).toBe(STUDIO_ACCENT_FOREGROUND_HSL[theme]);
+ // The hover tint: a faint graphite, never graphite itself.
+ expect(decl.get('--accent')).toBe(STUDIO_ACCENT_TINT_HSL[theme]);
+ expect(decl.get('--accent-foreground')).toBe(STUDIO_ACCENT_TINT_FOREGROUND_HSL[theme]);
+ });
+
+ it('the hover tint is a faint neutral: near white in the light theme, near black in the dark one', () => {
+ const lightness = (hsl: string) => Number.parseFloat(hsl.split(' ')[2]);
+ expect(lightness(STUDIO_ACCENT_TINT_HSL.light)).toBeGreaterThan(90);
+ expect(lightness(STUDIO_ACCENT_TINT_HSL.dark)).toBeLessThan(25);
+ });
+
+ it('graphite is a neutral: low saturation in both themes, dark in the light theme and light in the dark one', () => {
+ const parse = (hsl: string) => hsl.split(' ').map((part) => Number.parseFloat(part));
+ const [, sLight, lLight] = parse(STUDIO_ACCENT_HSL.light);
+ const [, sDark, lDark] = parse(STUDIO_ACCENT_HSL.dark);
+ expect(sLight).toBeLessThanOrEqual(12);
+ expect(sDark).toBeLessThanOrEqual(12);
+ expect(lLight).toBeLessThan(40);
+ expect(lDark).toBeGreaterThan(70);
+ });
+
+ it('re-derives Tailwind\'s colour tokens on the same element, so utilities read the rebound values', () => {
+ const decl = declarations(false);
+ for (const [color, token] of [
+ ['--color-primary', '--primary'],
+ ['--color-primary-foreground', '--primary-foreground'],
+ ['--color-ring', '--ring'],
+ ['--color-sidebar-primary', '--sidebar-primary'],
+ ['--color-sidebar-ring', '--sidebar-ring'],
+ ['--color-accent', '--accent'],
+ ['--color-accent-foreground', '--accent-foreground'],
+ ]) {
+ expect(decl.get(color), color).toBe(`hsl(var(${token}))`);
+ }
+ });
+});
diff --git a/ui/packages/app-shell/src/views/studio-design/studio-tokens.ts b/ui/packages/app-shell/src/views/studio-design/studio-tokens.ts
index 2171bf6addd..9f6b6439fa9 100644
--- a/ui/packages/app-shell/src/views/studio-design/studio-tokens.ts
+++ b/ui/packages/app-shell/src/views/studio-design/studio-tokens.ts
@@ -12,6 +12,58 @@
* reference artboards under `docs/design/studio-redesign/` stay the contract.
*/
+/**
+ * Studio's accent: graphite, a neutral of Studio's own (objectstack#37452).
+ * Studio is the development surface of an app, not the app, so it never takes
+ * the app's theme colour; only the app's logo keeps that colour. The values
+ * are HSL triples, the format the theme's `--primary` holds, for the light
+ * and the dark theme; the dark one is a light graphite, so it reads on the
+ * dark sidebar.
+ */
+export const STUDIO_ACCENT_HSL = { light: '220 9% 23%', dark: '220 9% 83%' } as const;
+/** Text drawn on the accent, light and dark. */
+export const STUDIO_ACCENT_FOREGROUND_HSL = { light: '0 0% 100%', dark: '220 13% 9%' } as const;
+/**
+ * The theme's `--accent` is its hover and highlight tint (a ghost button's or
+ * a menu item's hover), not a strong colour, so Studio rebinds it to a faint
+ * graphite tint, not to graphite itself; the app's branding writes it from
+ * the app's `accentColor`.
+ */
+export const STUDIO_ACCENT_TINT_HSL = { light: '220 9% 94%', dark: '220 9% 18%' } as const;
+/** Text drawn on the tint, light and dark. */
+export const STUDIO_ACCENT_TINT_FOREGROUND_HSL = { light: '220 13% 9%', dark: '220 9% 96%' } as const;
+
+/**
+ * The class that makes Studio's accent the theme's primary inside an
+ * element: everything under it that the app's theme colour would tint (the
+ * selected menu entry's pill and left bar, focus rings, `bg-primary` /
+ * `text-primary`) draws graphite instead, whatever colour the app's branding
+ * wrote on the page root. It rebinds every theme token that branding
+ * writes: `--primary`, `--ring`, `--sidebar-primary`, `--sidebar-ring` and
+ * the foreground to {@link STUDIO_ACCENT_HSL} and
+ * {@link STUDIO_ACCENT_FOREGROUND_HSL}, and `--accent` with its foreground to
+ * {@link STUDIO_ACCENT_TINT_HSL} and {@link STUDIO_ACCENT_TINT_FOREGROUND_HSL},
+ * light and dark. It re-derives Tailwind's `--color-*` from them on the same
+ * element, because those are computed once on the page root and inherited
+ * with the app's colour already in them.
+ *
+ * The selected entry's hover deepens the same graphite pill; any other
+ * entry's hover is the sidebar primitive's neutral `--sidebar-accent`, which
+ * branding never writes.
+ *
+ * A literal class string: Tailwind finds a class by scanning source, so the
+ * values are spelled here again; `studio-tokens.test.ts` holds them equal to
+ * the four constants above.
+ */
+export const STUDIO_ACCENT =
+ '[--primary:220_9%_23%] [--primary-foreground:0_0%_100%] [--ring:220_9%_23%] [--sidebar-primary:220_9%_23%] [--sidebar-ring:220_9%_23%] ' +
+ '[--accent:220_9%_94%] [--accent-foreground:220_13%_9%] ' +
+ 'dark:[--primary:220_9%_83%] dark:[--primary-foreground:220_13%_9%] dark:[--ring:220_9%_83%] dark:[--sidebar-primary:220_9%_83%] dark:[--sidebar-ring:220_9%_83%] ' +
+ 'dark:[--accent:220_9%_18%] dark:[--accent-foreground:220_9%_96%] ' +
+ '[--color-primary:hsl(var(--primary))] [--color-primary-foreground:hsl(var(--primary-foreground))] [--color-ring:hsl(var(--ring))] ' +
+ '[--color-sidebar-primary:hsl(var(--sidebar-primary))] [--color-sidebar-ring:hsl(var(--sidebar-ring))] ' +
+ '[--color-accent:hsl(var(--accent))] [--color-accent-foreground:hsl(var(--accent-foreground))]';
+
/**
* Shell header (objectui#12509). One 48 px row at every width, two columns:
* the left menu's control and the way back to the app at the left, the
diff --git a/ui/packages/layout/README.md b/ui/packages/layout/README.md
index 92d2cecddb6..b13c00650bb 100644
--- a/ui/packages/layout/README.md
+++ b/ui/packages/layout/README.md
@@ -46,7 +46,10 @@ The `responsive-grid` and `navigation-renderer` keys are retired too (objectui#1
A breakpoint grid is the `grid` node with a breakpoint `columns` object
(`{ "type": "grid", "columns": { "xs": 1, "md": 2 }, "gap": 4 }`), and navigation is
application metadata: the app's `navigation` items, drawn by the shell.
-`ResponsiveGrid` and `NavigationRenderer` stay exports for JSX composition.
+`ResponsiveGrid` and `NavigationRenderer` stay exports for JSX composition, and so does
+`NavigationGroupSection` (props `NavigationGroupSectionProps`): the collapsible sidebar group
+`NavigationRenderer` draws every `group` entry with, for a host that draws its own menu and wants
+the same group header (Studio's left menu is one).
## Components
diff --git a/ui/packages/layout/src/NavigationRenderer.tsx b/ui/packages/layout/src/NavigationRenderer.tsx
index 9d8dad2a49d..3d509e1a81d 100644
--- a/ui/packages/layout/src/NavigationRenderer.tsx
+++ b/ui/packages/layout/src/NavigationRenderer.tsx
@@ -1775,6 +1775,90 @@ function DropIndicator({ at }: { at: 'before' | 'after' }) {
);
}
+// ---------------------------------------------------------------------------
+// NavigationGroupSection — the collapsible group, shared with Studio's menu
+// ---------------------------------------------------------------------------
+
+export interface NavigationGroupSectionProps {
+ /** The group's name: the text of its disclosure button. */
+ label: React.ReactNode;
+ /** Whether the group lists its rows. */
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ /** Drawn open whatever `open` says: the icon rail lists every group's rows. */
+ forceOpen?: boolean;
+ /** The number the header shows while the group is closed; nothing is drawn without one. */
+ closedCount?: number;
+ /** The phone drawer's sizing: a 44 px tap target, larger text and chevron. */
+ isMobile?: boolean;
+ /** The disclosure button's id; the group's list is named by it when given. */
+ labelId?: string;
+ /** On the `SidebarGroup`. */
+ className?: string;
+ 'data-testid'?: string;
+ /** The group's rows: `SidebarMenuItem`s, or `
`s that hold one. */
+ children: React.ReactNode;
+}
+
+/**
+ * A collapsible sidebar group: its label is the disclosure button, with a
+ * chevron that turns down while the group is open, and its rows are listed
+ * under it while it is open. The app's menu draws every `group` entry with it,
+ * and Studio's left menu draws its groups with it, so the two menus' group
+ * headers cannot drift apart (objectstack#37452).
+ */
+export function NavigationGroupSection({
+ label,
+ open,
+ onOpenChange,
+ forceOpen = false,
+ closedCount,
+ isMobile = false,
+ labelId,
+ className,
+ 'data-testid': testId,
+ children,
+}: NavigationGroupSectionProps) {
+ return (
+
+
+
+
+ {label}
+ {/* objectstack#25876 — a collapsed group says how much it holds.
+ Open, its entries are in view and the count is noise; a group
+ holding the current route is forced open, so it never shows
+ one. `aria-hidden`: the disclosure's name stays the label, and
+ it already announces collapsed. In icon mode it hides under
+ the very classes the label does. */}
+ {!open && closedCount !== undefined && (
+
+ {closedCount}
+
+ )}
+
+
+
+
+
+ {children}
+
+
+
+
+ );
+}
+
// ---------------------------------------------------------------------------
// NavigationItemRenderer (recursive)
// ---------------------------------------------------------------------------
@@ -1906,50 +1990,22 @@ function NavigationItemRenderer({
};
const group = (
-
-
-
-
- {groupLabel}
- {/* objectstack#25876 — a collapsed group says how much it holds.
- Open, its entries are in view and the count is noise; a group
- holding the current route is forced open, so it never shows
- one. `aria-hidden`: the disclosure's name stays the label, and
- it already announces collapsed. In icon mode it hides under
- the very classes the label does. */}
- {!isOpen && (
-
- {countVisibleNavigationItems(children, guardOptions)}
-
- )}
-
-
-
-
-
-
- {children.map((child) => (
-
- ))}
-
-
-
-
-
+
+ {children.map((child) => (
+
+ ))}
+
);
// A plain `
`, not a `SidebarMenuItem`: that one is a `group/menu-item`,
// and every row inside the nested group would show its hover-only pin