Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio desktop: let the sidebar shrink to 224px (#12283)

Michael Hand0cbf6b19698
diff --git a/studio/frontend/src/hooks/use-sidebar-width.ts b/studio/frontend/src/hooks/use-sidebar-width.ts
index c670e254a83..73473e07722 100644
--- a/studio/frontend/src/hooks/use-sidebar-width.ts
+++ b/studio/frontend/src/hooks/use-sidebar-width.ts
@@ -1,13 +1,19 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+import { isTauri } from "../lib/api-base.ts";
import { createPanelWidthStore } from "./use-panel-width.ts";
/** The previous fixed 17.5rem, at a 16px root font size. */
export const SIDEBAR_WIDTH_DEFAULT = 280;
-/** Narrowest width that still fits the wordmark. Firefox is the constraint:
- * it renders the heading ~3px wider than Chromium and WebKit. */
-export const SIDEBAR_WIDTH_MIN = 260;
+/** Web: fits the header (wordmark, BETA, search, collapse) without truncating the
+ * wordmark, with room for Firefox's ~3px wider heading. */
+export const SIDEBAR_WIDTH_MIN_WEB = 260;
+/** Desktop: the collapse button lives in the titlebar, so the header needs less. */
+export const SIDEBAR_WIDTH_MIN_DESKTOP = 224;
+export const SIDEBAR_WIDTH_MIN = isTauri
+ ? SIDEBAR_WIDTH_MIN_DESKTOP
+ : SIDEBAR_WIDTH_MIN_WEB;
export const SIDEBAR_WIDTH_MAX = 480;
const store = createPanelWidthStore({
diff --git a/studio/frontend/tests/sidebar-width.test.ts b/studio/frontend/tests/sidebar-width.test.ts
index 3ffa5268d28..f2263a26ffe 100644
--- a/studio/frontend/tests/sidebar-width.test.ts
+++ b/studio/frontend/tests/sidebar-width.test.ts
@@ -12,6 +12,7 @@ const PANEL_WIDTH_KEYS = ["sidebar_width", "chat_settings_width"];
// The store reads window at import time, so stub it before importing.
const stubWindow = {
innerWidth: 1440,
+ location: { protocol: "http:" },
localStorage: {
getItem: () => null,
setItem: () => {},
@@ -26,8 +27,24 @@ const {
SIDEBAR_WIDTH_DEFAULT,
SIDEBAR_WIDTH_MAX,
SIDEBAR_WIDTH_MIN,
+ SIDEBAR_WIDTH_MIN_DESKTOP,
+ SIDEBAR_WIDTH_MIN_WEB,
} = await import("../src/hooks/use-sidebar-width.ts");
+test("the web keeps room for the collapse button beside search; desktop does not need it", async () => {
+ // The stub is a browser window, so this run takes the web floor.
+ assert.equal(SIDEBAR_WIDTH_MIN, SIDEBAR_WIDTH_MIN_WEB);
+ assert.ok(SIDEBAR_WIDTH_MIN_DESKTOP < SIDEBAR_WIDTH_MIN_WEB);
+ const source = await readSrcAsync("hooks/use-sidebar-width.ts");
+ assert.match(
+ source,
+ /SIDEBAR_WIDTH_MIN = isTauri\s*\?\s*SIDEBAR_WIDTH_MIN_DESKTOP\s*:\s*SIDEBAR_WIDTH_MIN_WEB;/,
+ );
+ // The header only draws that button off the desktop titlebar.
+ const sidebar = await readSrcAsync("components/app-sidebar.tsx");
+ assert.match(sidebar, /\{!isMobile && !usesDesktopTitlebar && \(/);
+});
+
test("clamps to the absolute range on a roomy window", () => {
stubWindow.innerWidth = 1440;
assert.equal(clampSidebarWidth(320), 320);