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: make the Images, Video and Audio settings rail resizable (#11760)

Michael Han298df4f0d94c
diff --git a/studio/frontend/src/components/media-rail-resize-handle.tsx b/studio/frontend/src/components/media-rail-resize-handle.tsx
new file mode 100644
index 00000000000..30327dde09b
--- /dev/null
+++ b/studio/frontend/src/components/media-rail-resize-handle.tsx
@@ -0,0 +1,87 @@
+// 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 { useRef } from "react";
+
+import { PanelResizeHandle } from "@/components/ui/panel-resize-handle";
+import {
+ MEDIA_RAIL_ROOT_ATTR,
+ MEDIA_RAIL_WIDTH_MIN,
+ type MediaRailKind,
+ useMediaRailWidth,
+} from "@/hooks/use-media-rail-width";
+import { cn } from "@/lib/utils";
+
+/** The rail's rendered width, mirroring the pages' `min(rail, 100% - 13rem)`. */
+const RAIL_BOX_WIDTH: Record<MediaRailKind, string> = {
+ images: "min(var(--media-rail-width,calc(408px*var(--ui-space-scale,1))),calc(100% - 13rem))",
+ video: "min(var(--media-rail-width,calc(400px*var(--ui-space-scale,1))),calc(100% - 13rem))",
+ audio: "min(var(--media-rail-width,calc(408px*var(--ui-space-scale,1))),calc(100% - 13rem))",
+};
+
+/**
+ * Drag handle on the right edge of a media page's settings rail. Paints `--media-rail-width` on
+ * the page root so the header and rail move together.
+ *
+ * `placement="rail"` sits inside the (relative) rail. `placement="page"` sits in the (relative)
+ * page root and spans its full height, for pages whose divider also runs through the header.
+ * `className` hides it where the panes stack.
+ */
+export function MediaRailResizeHandle({
+ kind,
+ placement = "rail",
+ className,
+}: {
+ kind: MediaRailKind;
+ placement?: "rail" | "page";
+ className?: string;
+}) {
+ const rail = useMediaRailWidth(kind);
+ const anchorRef = useRef<HTMLSpanElement>(null);
+ const root = () =>
+ anchorRef.current?.closest<HTMLElement>(`[${MEDIA_RAIL_ROOT_ATTR}]`) ?? null;
+ const handle = (
+ <PanelResizeHandle
+ edge="right"
+ open={true}
+ width={rail.width}
+ stored={rail.stored}
+ min={MEDIA_RAIL_WIDTH_MIN}
+ max={rail.max}
+ scale={rail.scale}
+ clamp={rail.clamp}
+ setWidth={rail.setWidth}
+ resetWidth={rail.resetWidth}
+ // The rail does not collapse; click does nothing, drag and arrow keys resize.
+ onToggle={() => {}}
+ target={root}
+ cssVar="--media-rail-width"
+ measure={() => rail.width}
+ label="Resize settings panel"
+ toggleLabel="Resize settings panel"
+ hideTooltip={true}
+ dataSlot="media-rail-resize-handle"
+ className="pointer-events-auto"
+ />
+ );
+ if (placement === "page") {
+ // A rail-wide box under the top inset, so the handle on its right edge covers the whole divider.
+ return (
+ <span
+ ref={anchorRef}
+ className={cn(
+ "pointer-events-none absolute bottom-0 left-0 top-[var(--studio-content-top-inset,0px)] z-50",
+ className,
+ )}
+ style={{ width: RAIL_BOX_WIDTH[kind] }}
+ >
+ {handle}
+ </span>
+ );
+ }
+ return (
+ <span ref={anchorRef} className={className}>
+ {handle}
+ </span>
+ );
+}
diff --git a/studio/frontend/src/features/audio/audio-page.tsx b/studio/frontend/src/features/audio/audio-page.tsx
index 59ab7a131f3..7f29655e121 100644
--- a/studio/frontend/src/features/audio/audio-page.tsx
+++ b/studio/frontend/src/features/audio/audio-page.tsx
@@ -28,6 +28,8 @@ import {
} from "react";
import { AdvancedDisclosure } from "@/components/advanced-disclosure";
+import { MediaRailResizeHandle } from "@/components/media-rail-resize-handle";
+import { MEDIA_RAIL_ROOT_ATTR, useMediaRailWidth } from "@/hooks/use-media-rail-width";
import { GuidedTour, useGuidedTourController } from "@/features/tour";
import { buildAudioTourSteps } from "./tour";
import { Button } from "@/components/ui/button";
@@ -341,6 +343,7 @@ export function AudioPage({
// Clear the floating sidebar toggle on mobile.
const isMobileShell = useIsMobileShell();
const [mode, setMode] = useState<CreateMode>("speak");
+ const { rootStyle: railRootStyle } = useMediaRailWidth("audio");
const tourSteps = useMemo(() => buildAudioTourSteps({ mode }), [mode]);
const tour = useGuidedTourController({
id: "audio",
@@ -2566,12 +2569,18 @@ export function AudioPage({
: "No transcription model selected.";
return (
- <div className="@container flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden pt-[var(--studio-content-top-inset,0px)]">
+ <div
+ {...{ [MEDIA_RAIL_ROOT_ATTR]: "" }}
+ style={railRootStyle}
+ className="@container relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden pt-[var(--studio-content-top-inset,0px)]"
+ >
+ {/* Page-level, so the handle covers the divider through the header too. */}
+ <MediaRailResizeHandle kind="audio" placement="page" className="hidden @[50rem]:block" />
{/* Portals to body, and this page stays mounted off-route, so gate it like the composer. */}
{active && <GuidedTour {...tour.tourProps} />}
- {/* Keep the tabs centered over the preview at every width. The model rail holds at 408px when
- space permits and shrinks only to preserve the controls. */}
- <div className="pointer-events-none relative z-40 grid h-[calc(48px*var(--ui-space-scale,1))] shrink-0 grid-cols-[minmax(0,calc(408px*var(--ui-space-scale,1)))_minmax(13rem,1fr)] @max-[30rem]:grid-cols-[minmax(0,1fr)_auto]">
+ {/* Keep the tabs centered over the preview at every width. The model rail holds at its
+ (draggable) width when space permits and shrinks only to preserve the controls. */}
+ <div className="pointer-events-none relative z-40 grid h-[calc(48px*var(--ui-space-scale,1))] shrink-0 grid-cols-[minmax(0,var(--media-rail-width,calc(408px*var(--ui-space-scale,1))))_minmax(13rem,1fr)] @max-[30rem]:grid-cols-[minmax(0,1fr)_auto]">
<div
className={cn(
"pointer-events-none flex h-full min-w-0 items-start overflow-hidden @[50rem]:border-r @[50rem]:border-border/60",
@@ -2650,11 +2659,11 @@ export function AudioPage({
</div>
</div>
{/* Below 50rem the panes stack and the page scrolls as one column, matching Images and Video:
- side by side, the 408px rail plus a usable preview needs more width. */}
+ side by side, the rail plus a usable preview needs more width. */}
<div className="flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-y-auto overflow-x-hidden @[50rem]:flex-row @[50rem]:overflow-hidden">
<div
data-tour="audio-settings"
- className="flex w-full shrink-0 flex-col border-b border-border/60 @[50rem]:w-[min(calc(408px*var(--ui-space-scale,1)),calc(100%-13rem))] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0"
+ className="flex w-full shrink-0 flex-col border-b border-border/60 @[50rem]:w-[min(var(--media-rail-width,calc(408px*var(--ui-space-scale,1))),calc(100%-13rem))] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0"
>
<div
ref={attachSettingsScroll}
diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsx
index 6ab9536f9c3..d78a03f42c0 100644
--- a/studio/frontend/src/features/images/images-page.tsx
+++ b/studio/frontend/src/features/images/images-page.tsx
@@ -75,6 +75,8 @@ import type {
} from "@/features/model-picker/components/model-selector/types";
import { AdvancedDisclosure } from "@/components/advanced-disclosure";
import { GalleryItemMenu, GalleryPinBadge } from "@/components/gallery-item-menu";
+import { MediaRailResizeHandle } from "@/components/media-rail-resize-handle";
+import { MEDIA_RAIL_ROOT_ATTR, useMediaRailWidth } from "@/hooks/use-media-rail-width";
import { StripDropLine } from "@/components/gallery-strip-reorder";
import { useStripReorder } from "@/hooks/use-strip-reorder";
import { MediaPageLink } from "@/components/media-page-link";
@@ -1234,6 +1236,7 @@ export function ImagesPage({
const hostClass = useHostClass();
const denseQuantSchemes = useDenseQuantSchemes();
const imageModels = useImageModels(hostClass, denseQuantSchemes);
+ const { rootStyle: railRootStyle } = useMediaRailWidth("images");
const [quant, setQuant] = useState<string | null>(galleryCache.quant);
const [prompt, setPrompt] = useState(
"Cinematic wide shot of a whimsical Alice in Wonderland tea party in an overgrown Victorian garden. Exactly three figures at a long white lace-draped table: a tall eccentric gentleman in an oversized emerald velvet top hat pouring tea from a silver pot mid-motion; a young woman in a pale blue Victorian dress seated left, holding a porcelain teacup with both hands, looking up and laughing; an older woman in deep burgundy seated right in profile, reaching for a tiered cake stand. Detailed embroidered fabrics, realistic skin texture, natural expressions. The table holds mismatched porcelain, antique silverware, towering pastel cakes, and wildflowers. Giant red-capped mushrooms rise behind the table, with ancient trees overhead and golden sunlight streaming through leaves. Shot on 85mm, f/2.8, focus on the gentleman, soft background falloff. Photorealistic, saturated storybook color, warm amber and deep green palette.",
@@ -4261,12 +4264,18 @@ export function ImagesPage({
return (
// The chat-style layout gives this page no outer top inset, so clear the custom titlebar here as chat does.
// 34px on win/linux, 0 under macOS's native one.
- <div className="diffusion-surface @container flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden pt-[var(--studio-content-top-inset,0px)]">
+ <div
+ {...{ [MEDIA_RAIL_ROOT_ATTR]: "" }}
+ style={railRootStyle}
+ className="diffusion-surface @container relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden pt-[var(--studio-content-top-inset,0px)]"
+ >
+ {/* Page-level, so the handle covers the divider through the header too (Create and Train). */}
+ <MediaRailResizeHandle kind="images" placement="page" className="hidden @[50rem]:block" />
{/* Portals to body, and this page stays mounted off-route, so gate it like the composer. */}
{active && <GuidedTour {...tour.tourProps} />}
- {/* Keep the tabs centered over the preview at every width: the model rail holds at 408px when
- space permits and shrinks only to preserve the controls. */}
- <div className="pointer-events-none relative z-40 grid h-[calc(48px*var(--ui-space-scale,1))] shrink-0 grid-cols-[minmax(0,calc(408px*var(--ui-space-scale,1)))_minmax(13rem,1fr)] @max-[30rem]:grid-cols-[minmax(0,1fr)_auto]">
+ {/* Keep the tabs centered over the preview at every width: the model rail holds at its
+ (draggable) width when space permits and shrinks only to preserve the controls. */}
+ <div className="pointer-events-none relative z-40 grid h-[calc(48px*var(--ui-space-scale,1))] shrink-0 grid-cols-[minmax(0,var(--media-rail-width,calc(408px*var(--ui-space-scale,1))))_minmax(13rem,1fr)] @max-[30rem]:grid-cols-[minmax(0,1fr)_auto]">
<div
className={cn(
"pointer-events-none flex h-full min-w-0 items-start overflow-hidden @[50rem]:border-r @[50rem]:border-border/60",
@@ -4379,7 +4388,7 @@ export function ImagesPage({
<div className="flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-y-auto overflow-x-hidden @[50rem]:flex-row @[50rem]:overflow-hidden">
<div
data-tour="images-settings"
- className="flex w-full shrink-0 flex-col border-b border-border/60 @[50rem]:w-[min(calc(408px*var(--ui-space-scale,1)),calc(100%-13rem))] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0"
+ className="flex w-full shrink-0 flex-col border-b border-border/60 @[50rem]:w-[min(var(--media-rail-width,calc(408px*var(--ui-space-scale,1))),calc(100%-13rem))] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0"
>
{/* pl-0.5 keeps focus rings off the scroll container's edge. */}
<div
diff --git a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx b/studio/frontend/src/features/images/train/diffusion-train-panel.tsx
index db8044e06b9..214c7a6b736 100644
--- a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx
+++ b/studio/frontend/src/features/images/train/diffusion-train-panel.tsx
@@ -1520,8 +1520,8 @@ export function DiffusionTrainPanel({
// row pan the page sideways on a phone.
return (
<div className="flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pr-5 sm:pr-8 @[50rem]:flex-row @[50rem]:overflow-hidden">
- {/* Left: configure. The 408px rail and container breakpoint match Create and the shared header. */}
- <div className="flex w-full min-w-0 shrink-0 flex-col border-b border-border/60 pl-10 max-sm:pl-5 @[50rem]:w-[calc(408px*var(--ui-space-scale,1))] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0">
+ {/* Left: configure. The rail width and container breakpoint match Create and the shared header. */}
+ <div className="flex w-full min-w-0 shrink-0 flex-col border-b border-border/60 pl-10 max-sm:pl-5 @[50rem]:w-[min(var(--media-rail-width,calc(408px*var(--ui-space-scale,1))),calc(100%-13rem))] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0">
{/* Keep the former row-level top inset inside the pane so the divider reaches the header. */}
<div
ref={attachSettingsScroll}
diff --git a/studio/frontend/src/features/video/video-page.tsx b/studio/frontend/src/features/video/video-page.tsx
index 0da7de31124..55363777c0b 100644
--- a/studio/frontend/src/features/video/video-page.tsx
+++ b/studio/frontend/src/features/video/video-page.tsx
@@ -16,6 +16,8 @@ import { HugeiconsIcon } from "@hugeicons/react";
import { AdvancedDisclosure } from "@/components/advanced-disclosure";
import { GalleryItemMenu, GalleryPinBadge } from "@/components/gallery-item-menu";
+import { MediaRailResizeHandle } from "@/components/media-rail-resize-handle";
+import { MEDIA_RAIL_ROOT_ATTR, useMediaRailWidth } from "@/hooks/use-media-rail-width";
import { StripDropLine } from "@/components/gallery-strip-reorder";
import { useStripReorder } from "@/hooks/use-strip-reorder";
import { ImageDropzone } from "@/components/image-dropzone";
@@ -1023,6 +1025,7 @@ function VideoGenerator({
} = useScrollFades();
// Records come from the backend (durable); playback links and poster object URLs are cached separately.
const [videos, setVideos] = useState<GalleryVideo[]>(() => galleryCache.videos);
+ const { rootStyle: railRootStyle } = useMediaRailWidth("video");
const [hasMore, setHasMore] = useState(() => galleryCache.hasMore);
const [selectedId, setSelectedId] = useState<string | null>(() => galleryCache.selectedId);
const [clearConfirmOpen, setClearConfirmOpen] = useState(false);
@@ -3473,7 +3476,11 @@ function VideoGenerator({
return (
// The chat-style layout gives this page no outer top inset, so clear the custom titlebar here as chat does.
// 34px on win/linux, 0 under macOS's native one.
- <div className="diffusion-surface flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden pt-[var(--studio-content-top-inset,0px)]">
+ <div
+ {...{ [MEDIA_RAIL_ROOT_ATTR]: "" }}
+ style={railRootStyle}
+ className="diffusion-surface flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden pt-[var(--studio-content-top-inset,0px)]"
+ >
{/* Portals to body, and this page stays mounted off-route, so gate it like the composer. */}
{active && <GuidedTour {...tour.tourProps} />}
<AlertDialog
@@ -3631,8 +3638,9 @@ function VideoGenerator({
{/* Widened by the pl-8 so the controls keep their old width. */}
<div
data-tour="video-settings"
- className="flex w-full shrink-0 flex-col border-b border-border/60 pl-8 max-sm:pl-5 lg:w-[min(calc(400px*var(--ui-space-scale,1)),calc(100%-13rem))] lg:overflow-hidden lg:border-r lg:border-b-0"
+ className="relative flex w-full shrink-0 flex-col border-b border-border/60 pl-8 max-sm:pl-5 lg:w-[min(var(--media-rail-width,calc(400px*var(--ui-space-scale,1))),calc(100%-13rem))] lg:overflow-hidden lg:border-r lg:border-b-0"
>
+ <MediaRailResizeHandle kind="video" className="hidden lg:contents" />
{/* pl-0.5 keeps focus rings off the scroll container's edge. */}
<div
ref={attachSettingsScroll}
diff --git a/studio/frontend/src/hooks/use-media-rail-width.ts b/studio/frontend/src/hooks/use-media-rail-width.ts
new file mode 100644
index 00000000000..541e7c09c28
--- /dev/null
+++ b/studio/frontend/src/hooks/use-media-rail-width.ts
@@ -0,0 +1,53 @@
+// 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 type { CSSProperties } from "react";
+import { useUiSpaceScale } from "./use-ui-space-scale";
+import { createPanelWidthStore } from "./use-panel-width.ts";
+
+/** Below this the sliders and their value pills start colliding. */
+export const MEDIA_RAIL_WIDTH_MIN = 320;
+export const MEDIA_RAIL_WIDTH_MAX = 760;
+
+/** Settings rail width per media page, in the same units as the former fixed width. */
+const stores = {
+ images: createPanelWidthStore({
+ key: "images_rail_width",
+ min: MEDIA_RAIL_WIDTH_MIN,
+ max: MEDIA_RAIL_WIDTH_MAX,
+ fallback: 408,
+ maxViewportFraction: 0.6,
+ }),
+ video: createPanelWidthStore({
+ key: "video_rail_width",
+ min: MEDIA_RAIL_WIDTH_MIN,
+ max: MEDIA_RAIL_WIDTH_MAX,
+ fallback: 400,
+ maxViewportFraction: 0.6,
+ }),
+ audio: createPanelWidthStore({
+ key: "audio_rail_width",
+ min: MEDIA_RAIL_WIDTH_MIN,
+ max: MEDIA_RAIL_WIDTH_MAX,
+ fallback: 408,
+ maxViewportFraction: 0.6,
+ }),
+};
+
+export type MediaRailKind = keyof typeof stores;
+
+/** Marks the element that owns `--media-rail-width` for its header and rail. */
+export const MEDIA_RAIL_ROOT_ATTR = "data-media-rail-root";
+
+export function useMediaRailWidth(kind: MediaRailKind) {
+ const store = stores[kind];
+ const rail = store.useWidth();
+ // Includes the interface scale, and matches the rail's former calc(408px * --ui-space-scale).
+ const scale = useUiSpaceScale();
+ return {
+ ...rail,
+ scale,
+ clamp: store.clamp,
+ rootStyle: { "--media-rail-width": `${rail.width * scale}px` } as CSSProperties,
+ };
+}
diff --git a/studio/frontend/src/hooks/use-panel-width.ts b/studio/frontend/src/hooks/use-panel-width.ts
index 568460634a5..eaf040fd148 100644
--- a/studio/frontend/src/hooks/use-panel-width.ts
+++ b/studio/frontend/src/hooks/use-panel-width.ts
@@ -33,11 +33,14 @@ export function createPanelWidthStore({
min,
max,
fallback,
+ maxViewportFraction = MAX_VIEWPORT_FRACTION,
}: {
key: string;
min: number;
max: number;
fallback: number;
+ /** Largest share of the window the panel may take. */
+ maxViewportFraction?: number;
}): PanelWidthStore {
function maxWidth(): number {
if (typeof window === "undefined") return max;
@@ -45,7 +48,7 @@ export function createPanelWidthStore({
// in layout px, so a scaled panel takes the same share of it.
return Math.max(
min,
- Math.min(max, (window.innerWidth / layoutScale()) * MAX_VIEWPORT_FRACTION),
+ Math.min(max, (window.innerWidth / layoutScale()) * maxViewportFraction),
);
}
diff --git a/studio/frontend/tests/ui-font-size-scales-spacing.test.ts b/studio/frontend/tests/ui-font-size-scales-spacing.test.ts
index 7c3d21f25b3..9895d5bf791 100644
--- a/studio/frontend/tests/ui-font-size-scales-spacing.test.ts
+++ b/studio/frontend/tests/ui-font-size-scales-spacing.test.ts
@@ -398,23 +398,21 @@ test("a sidebar row's inset scales on both sides", () => {
test("a scaled media rail leaves the preview its minimum", () => {
// At 200% a shrink-0 rail passed the 50rem split it sits in, clipping the
// preview. The header column shrinks the same way, so the dividers line up.
+ // The width is the draggable --media-rail-width, falling back to the old fixed one.
for (const [file, width, split] of [
["features/images/images-page.tsx", "408px", "@[50rem]"],
["features/audio/audio-page.tsx", "408px", "@[50rem]"],
["features/video/video-page.tsx", "400px", "lg"],
] as const) {
const source = readSrc(file);
+ const rail = `var(--media-rail-width,calc(${width}*var(--ui-space-scale,1)))`;
assert.ok(
- source.includes(
- `${split}:w-[min(calc(${width}*var(--ui-space-scale,1)),calc(100%-13rem))]`,
- ),
+ source.includes(`${split}:w-[min(${rail},calc(100%-13rem))]`),
`${file} rail can outgrow its split`,
);
if (split !== "lg") {
assert.ok(
- source.includes(
- `grid-cols-[minmax(0,calc(${width}*var(--ui-space-scale,1)))_minmax(13rem,1fr)]`,
- ),
+ source.includes(`grid-cols-[minmax(0,${rail})_minmax(13rem,1fr)]`),
`${file} header column drifts from its rail`,
);
}