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: tidy the model picker's On Device columns and list inset (#12746)

Michael Han7093e0c01f20
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
index 97abf6d0b92..a9baaba9d5f 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
@@ -490,7 +490,7 @@ function ListLabel({
type="button"
onClick={onToggle}
aria-label={collapsed ? "Expand section" : "Collapse section"}
- className="shrink-0 rounded p-1 text-muted-foreground/80 transition-colors hover:text-foreground"
+ className="-mr-0.5 shrink-0 rounded p-1 text-muted-foreground/80 transition-colors hover:text-foreground"
>
{collapsed ? (
<ChevronRightIcon className="size-3" />
@@ -984,18 +984,16 @@ function artifactBudget(gpu: {
}
const META_COLUMN = {
- // Fits "UD-Q4_K_XL"; a hard cap, so longer quants clip.
- quant: "min-[560px]:w-[7.2em]",
+ // Hugs its chip, capped at "UD-Q4_K_XL" (longer quants clip). Leftmost, so its slack goes to the name.
+ quant: "min-[560px]:max-w-[7.2em]",
// Each width below is the widest set its scope can draw: anything wider makes min-w-min expand the
// slot and shift every column after it. This slot holds capability glyphs and the vision badge
// (both 26px pills) and the "on disk" mark (14px), gap-1 between them; scope draws no glyph.
badge: "min-w-min min-[560px]:w-[calc(26px*var(--ui-space-scale,1))]",
// One glyph plus the disk mark (26 + 4 + 14).
badgeMid: "min-w-min min-[560px]:w-[calc(44px*var(--ui-space-scale,1))]",
- // On Device draws the vision badge (26px) and, since partials are listed, the partial mark
- // (14px) beside it. 44px is that pair with its gap: reserving only the badge let a row drawing
- // both grow past the slot and carry its quant chip 18px left of every other row.
- badgeDevice: "min-w-min min-[560px]:w-[calc(44px*var(--ui-space-scale,1))]",
+ // On Device: the vision badge only (26px). Its partial mark sits with the name, as Loaded does.
+ badgeDevice: "min-w-min min-[560px]:w-[calc(26px*var(--ui-space-scale,1))]",
// Hub draws the disk mark and no vision badge (26+4+14). A second glyph grows it via min-w-min.
badgeWide: "min-w-min min-[560px]:w-[calc(44px*var(--ui-space-scale,1))]",
// The fit mark (Hub rows), one 18px glyph.
@@ -1012,6 +1010,9 @@ const META_COLUMN = {
format: "min-[560px]:w-[calc(14px*var(--ui-space-scale,1))]",
} as const;
+// On Device spacing between the name, quant, modality and parameter marks: never under 6px.
+const DEVICE_META_GAP = "gap-[max(6px,calc(6px*var(--ui-space-scale,1)))]";
+
const downloadedRowButtonClassName =
"bg-transparent pr-1 hover:bg-transparent focus-visible:bg-transparent dark:bg-transparent dark:hover:bg-transparent dark:focus-visible:bg-transparent";
// Not focus-within: the dots menu returns focus to its trigger on close, so the row stayed lit
@@ -1347,11 +1348,11 @@ function ModelRow({
className,
)}
>
- {/* gap-1: the quant chip ends the name group, so what this separates is that chip from the
- first meta mark, on the rhythm the meta columns keep. */}
+ {/* Separates the name group from the meta cluster. */}
<span
className={cn(
- "flex w-full items-center gap-1",
+ "flex w-full items-center",
+ alignMeta === "device" ? DEVICE_META_GAP : "gap-1",
// Over budget reads as a dimmed row, which scans; hover restores it. The selected row keeps full weight.
exceeds &&
!selected &&
@@ -1391,6 +1392,11 @@ function ModelRow({
</span>
{/* Here it eats name width instead of moving the meta columns. self-center: on the
baseline the empty dot sat the tag low. */}
+ {alignMeta === "device" && partial ? (
+ <span className="ml-[max(6px,calc(6px*var(--ui-space-scale,1)))] flex shrink-0 items-center self-center">
+ <PartialBadge resumable={partialResumable} />
+ </span>
+ ) : null}
{aligned && loaded && (
<DotTag
tone="success"
@@ -1415,7 +1421,7 @@ function ModelRow({
<span
className={cn(
"ml-auto flex shrink-0 items-center",
- aligned ? "gap-1" : "gap-1.5",
+ alignMeta === "device" ? DEVICE_META_GAP : aligned ? "gap-1" : "gap-1.5",
)}
>
{/* The quant chip sits in the meta cluster, not at the end of the name, so one
@@ -1423,17 +1429,15 @@ function ModelRow({
the row's buttons. Inside the name group it was centred against THAT box instead --
a baseline box sized by the name's own line height -- so it only agreed with the rest
of the row for as long as the two boxes happened to share a centre. */}
- {alignMeta === "device" ? (
+ {alignMeta === "device" && quantChip ? (
<span
className={cn(
- // justify-end: the slot is sized for the longest quant, so left-aligning ended a
- // "Q8_0" and a "UD-Q4_K_XL" at different x even once the slot itself stopped
- // moving. Flush right is what makes the chips read as one column.
+ // Ends against the fixed badge column, so chips align whatever their length.
"flex shrink-0 items-center justify-end text-ui-9",
META_COLUMN.quant,
)}
>
- {quantChip ? <QuantChip label={quantChip} /> : null}
+ <QuantChip label={quantChip} />
</span>
) : null}
{/* Capabilities, vision and the Hub lists' "on disk" mark share one
@@ -1441,14 +1445,18 @@ function ModelRow({
{aligned ? (
<span
className={cn(
- // Right, not centre: slack belongs to the name, not split either side of a glyph.
- "flex shrink-0 items-center justify-end gap-1 text-ui-10",
+ // Right, not centre: slack belongs to the name. On Device it leads, so the eye sits
+ // the cluster gap from the quant chip.
+ "flex shrink-0 items-center gap-1 text-ui-10",
+ alignMeta === "device" ? "justify-start" : "justify-end",
badgeColumn,
)}
>
{showCaps && <CapabilityIcons caps={caps} />}
{showVision && <VisionBadge />}
- {partial ? <PartialBadge resumable={partialResumable} /> : null}
+ {partial && alignMeta !== "device" ? (
+ <PartialBadge resumable={partialResumable} />
+ ) : null}
{downloaded && !partial && !loaded ? <DownloadedBadge /> : null}
</span>
) : (
@@ -1482,10 +1490,8 @@ function ModelRow({
{aligned ? (
<span
className={cn(
- // Device leads the chip, Hub trails it. Both columns are fixed, so the choice is only where the
- // slack falls: trailing put it in FRONT of the chip, where it read as part of the gap to the
- // modality mark and grew with the label (6.9px after "217B", 19px after "1B"). Leading leaves that
- // gap as the cluster's own gap-1.
+ // Device leads the chip so every chip starts at one x, the cluster gap after the modality
+ // slot. Hub trails it.
"flex shrink-0 items-center text-ui-10",
alignMeta === "hub"
? cn("justify-end", META_COLUMN.paramWide)
@@ -7030,9 +7036,9 @@ export function HubModelPicker({
// The list sits within the menu padding so gaps match; scroll-py and the side padding keep
// the focus ring off the overflow clip edges during keyboard nav. The panel is padded 16px
// on the left but 8px on the right (16px with external providers), so the scroller can run
- // near the edge for its scrollbar; the right inset makes up the difference, and a row's
- // hover pill sits 18px from both edges.
- "model-list-scroll max-h-[calc(335px*var(--ui-space-scale,1))] overflow-y-auto scroll-py-1.5 pl-0.5 pr-1.5 mr-1 in-data-[external=true]:pr-0.5 in-data-[external=true]:mr-0",
+ // near the edge for its scrollbar; its right inset (index.css) makes up the difference, and
+ // a row's hover pill sits 18px from both edges.
+ "model-list-scroll max-h-[calc(335px*var(--ui-space-scale,1))] overflow-y-auto scroll-py-1.5 pl-0.5",
listScrolled && "is-scrolled",
listMoreBelow && "is-bottom-faded",
)}
@@ -7041,7 +7047,7 @@ export function HubModelPicker({
<div
className={cn(
// Keep row actions clear of overlay scrollbars, overflowing or not.
- "overlay-scrollbar-gutter",
+ "model-list-gutter",
// On Device pulls the heading block tight to the controls; Recommended keeps more top room
// above its first row.
showDownloaded ? "pt-0" : "pt-[calc(4px*var(--ui-space-scale,1))]",
@@ -7362,7 +7368,7 @@ export function HubModelPicker({
}
title={fineTunedCollapsed ? "Expand" : "Collapse"}
onClick={() => setFineTunedCollapsed((v) => !v)}
- className="shrink-0 rounded p-1 text-muted-foreground/80 transition-colors hover:text-foreground"
+ className="-mr-0.5 shrink-0 rounded p-1 text-muted-foreground/80 transition-colors hover:text-foreground"
>
{fineTunedCollapsed ? (
<ChevronRightIcon className="size-3" />
@@ -7459,7 +7465,7 @@ export function HubModelPicker({
}
title={customFoldersCollapsed ? "Expand" : "Collapse"}
onClick={() => setCustomFoldersCollapsed((v) => !v)}
- className="shrink-0 rounded p-1 text-muted-foreground/80 transition-colors hover:text-foreground"
+ className="-mr-0.5 shrink-0 rounded p-1 text-muted-foreground/80 transition-colors hover:text-foreground"
>
{customFoldersCollapsed ? (
<ChevronRightIcon className="size-3" />
@@ -7693,6 +7699,8 @@ export function HubModelPicker({
}
alignMeta="device"
vramStatus={null}
+ // The downloaded rows' inset, so columns line up across sections.
+ className="pr-1"
/>
</div>
<span className={ROW_ACTIONS_CLASS}>
@@ -7834,6 +7842,8 @@ export function HubModelPicker({
}
alignMeta="device"
vramStatus={null}
+ // The downloaded rows' inset, so columns line up across sections.
+ className="pr-1"
/>
</div>
<span className={ROW_ACTIONS_CLASS}>
@@ -7962,6 +7972,8 @@ export function HubModelPicker({
}
alignMeta="device"
vramStatus={null}
+ // The downloaded rows' inset, so columns line up across sections.
+ className="pr-1"
/>
</div>
<span className={ROW_ACTIONS_CLASS}>
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index 68fe60954c1..dabeac226ff 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -136,6 +136,23 @@
transparent
);
}
+ /* Model picker list: reaches into the panel padding for an overlay scrollbar so rows keep their
+ 18px inset; rows give way only for what is left. --list-room is already clear of row actions. */
+ .model-list-scroll {
+ --list-reach: min(var(--overlay-scrollbar-gutter, 0px), var(--spacing));
+ --list-room: calc(var(--spacing) * 2 + var(--list-reach));
+ margin-right: calc(var(--spacing) - var(--list-reach));
+ padding-right: calc(var(--spacing) * 1.5 + var(--list-reach));
+ }
+ [data-external] .model-list-scroll {
+ --list-reach: min(var(--overlay-scrollbar-gutter, 0px), var(--spacing) * 2);
+ --list-room: calc(var(--spacing) + var(--list-reach));
+ margin-right: calc(0px - var(--list-reach));
+ padding-right: calc(var(--spacing) * 0.5 + var(--list-reach));
+ }
+ .model-list-gutter {
+ padding-right: max(0px, var(--overlay-scrollbar-gutter, 0px) - var(--list-room));
+ }
/* RAG chip strip: sidebar-style bottom fade while more chips sit below
the scroll fold (JS-toggled). */
.rag-docs-bottom-fade {
diff --git a/studio/frontend/tests/menu-row-spacing.test.ts b/studio/frontend/tests/menu-row-spacing.test.ts
index bfcd3f633f8..97dc6e17bee 100644
--- a/studio/frontend/tests/menu-row-spacing.test.ts
+++ b/studio/frontend/tests/menu-row-spacing.test.ts
@@ -103,11 +103,15 @@ test("menu surfaces keep whole-pixel padding, margin and width, so the hover pil
assert.match(helper, /new MutationObserver/);
assert.match(helper, /window\.setTimeout\(\(\) => observer\.disconnect\(\), ROW_WAIT_MS\)/);
// The model picker's panel is padded 16px left, 8px right (16px with external providers) so
- // its scroller can run near the edge; the list's own right inset evens the rows out.
+ // its scroller can run near the edge; the list's own right inset evens the rows out, reaching
+ // into the panel padding for an overlay scrollbar.
assert.match(
readSrc("features/model-picker/components/model-selector/pickers.tsx"),
- /model-list-scroll [^"]*pl-0\.5 pr-1\.5 mr-1 in-data-\[external=true\]:pr-0\.5 in-data-\[external=true\]:mr-0/,
+ /"model-list-scroll [^"]*pl-0\.5",/,
);
+ const css = readSrc("index.css");
+ assert.match(css, /\.model-list-scroll \{[^}]*margin-right: calc\(var\(--spacing\) - var\(--list-reach\)\);[^}]*padding-right: calc\(var\(--spacing\) \* 1\.5 \+ var\(--list-reach\)\);/);
+ assert.match(css, /\[data-external\] \.model-list-scroll \{[^}]*margin-right: calc\(0px - var\(--list-reach\)\);[^}]*padding-right: calc\(var\(--spacing\) \* 0\.5 \+ var\(--list-reach\)\);/);
assert.match(readSrc("features/model-picker/components/model-selector.tsx"), /data-external=\{hasExternal \|\| undefined\}/);
assert.match(
readSrc("components/ui/dropdown-menu.tsx"),
diff --git a/studio/frontend/tests/model-picker-partial-downloads.test.ts b/studio/frontend/tests/model-picker-partial-downloads.test.ts
index 0ce9d932309..47749e4a4bc 100644
--- a/studio/frontend/tests/model-picker-partial-downloads.test.ts
+++ b/studio/frontend/tests/model-picker-partial-downloads.test.ts
@@ -126,8 +126,8 @@ test("the mark promises a resume only when the transport can give one", () => {
);
assert.equal(
PICKERS.split("<PartialBadge resumable={partialResumable} />").length - 1,
- 2,
- "aligned and unaligned branches alike",
+ 3,
+ "On Device, the Hub and unaligned rows alike",
);
// On Device reads its own row; Hub rows read the same cached rows partialSet is built from.
assert.equal(
@@ -158,9 +158,12 @@ test("complete and partial are alternatives, never both dots on one row", () =>
PICKERS.split(
"{partial ? <PartialBadge resumable={partialResumable} /> : null}",
).length - 1,
- 2,
- "drawn in the aligned and unaligned branches alike",
+ 1,
+ "drawn in the unaligned branch",
);
+ // The aligned lists draw it too: On Device beside the name, the Hub in its badge slot.
+ assert.ok(PICKERS.includes('{alignMeta === "device" && partial ? ('));
+ assert.ok(PICKERS.includes('{partial && alignMeta !== "device" ? ('));
assert.equal(
PICKERS.split(
"{downloaded && !partial && !loaded ? <DownloadedBadge /> : null}",
diff --git a/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts b/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts
index f45c48f2d4f..04429ea4aa2 100644
--- a/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts
+++ b/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts
@@ -61,22 +61,25 @@ test("the scoped badge column reserves the wider on-device marker", () => {
test("the unscoped badge column is sized per list, not to the union of both", () => {
// Sized to the widest set each list can draw, not to both lists at once. On Device is the vision
- // badge (26px), a gap-1 (4px) and the partial mark (14px): a GGUF repo can show vision and be
- // half-downloaded at once, and at 26px that row alone grew and carried its quant chip 18px left
- // of every other row -- the exact drift the fixed columns exist to stop.
- assert.ok(PICKERS.includes('badgeDevice: "min-w-min min-[560px]:w-[44px]"'));
+ // badge alone (26px), so the quant chip sits beside it.
+ assert.ok(PICKERS.includes('badgeDevice: "min-w-min min-[560px]:w-[26px]"'));
// Hub: one 26px capability pill, a gap-1 and the disk mark.
assert.ok(PICKERS.includes('badgeWide: "min-w-min min-[560px]:w-[44px]"'));
- // Both marks really can land on one On Device row, which is what makes 44 the right number.
+ // Both marks can land on one On Device row, so the partial mark sits with the name, as Loaded
+ // does. In the slot it would widen that row alone and shift its quant chip left.
const gguf = PICKERS.slice(PICKERS.indexOf("const renderDownloadedGgufRow"));
const row = gguf.slice(0, gguf.indexOf("\n };"));
assert.ok(row.includes('alignMeta="device"'));
assert.ok(row.includes("showVision={c.has_vision"));
assert.ok(row.includes("partial={isPartialRepo}"));
- // And they sit in that one slot rather than overlapping.
assert.match(
PICKERS,
- /\{showVision && <VisionBadge \/>\}\n\s*\{partial \? <PartialBadge resumable=\{partialResumable\} \/> : null\}/,
+ /\{alignMeta === "device" && partial \? \(\n\s*<span className="ml-\[max\(6px,6px\)\] flex shrink-0 items-center self-center">\n\s*<PartialBadge resumable=\{partialResumable\} \/>/,
+ );
+ // Hub keeps it in the slot, beside the vision badge.
+ assert.match(
+ PICKERS,
+ /\{showVision && <VisionBadge \/>\}\n\s*\{partial && alignMeta !== "device" \? \(\n\s*<PartialBadge resumable=\{partialResumable\} \/>/,
);
assert.match(
PICKERS,
@@ -123,19 +126,22 @@ test("the parameter column is fixed, so the quant column cannot drift row to row
});
test("the parameter chip leads its column, so the modality gap is the cluster's own", () => {
- // Trailing the chip spends the column's leftover in FRONT of it, where it reads as part of the
- // gap to the modality mark and grows with the label: 6.9px after a "217B", 19px after a "1B".
- // Leading it leaves that gap as gap-1 -- the same 4px the quant chip keeps to the same mark.
+ // Every chip starts at one x, the cluster gap (6px minimum) after the modality slot. Trailing
+ // put the slack in front of the chip, where it grew that gap with the label.
assert.match(
PICKERS,
/alignMeta === "hub"\n\s*\? cn\("justify-end", META_COLUMN\.paramWide\)\n\s*: cn\("justify-start", META_COLUMN\.param\)/,
);
+ // Every On Device section ends its rows at one inset, so chips line up across sections.
+ assert.equal(PICKERS.split('className="pr-1"').length - 1, 3, "the custom folder rows");
});
+
+
test("the quant chip is flush right in its slot, so the chips read as one column", () => {
- // The slot is sized for the longest quant, so left-aligning ended a "Q8_0" and a "UD-Q4_K_XL"
- // at different x even once the slot itself stopped moving.
- assert.ok(PICKERS.includes('quant: "min-[560px]:w-[7.2em]"'));
+ // Leftmost meta column: hugs its chip (capped at "UD-Q4_K_XL") so its slack goes to the name.
+ // Chips still end against the fixed badge column.
+ assert.ok(PICKERS.includes('quant: "min-[560px]:max-w-[7.2em]"'));
assert.match(PICKERS, /"flex shrink-0 items-center justify-end text-ui-9"/);
});
@@ -583,12 +589,16 @@ test("the row tooltip reports the figure the verdict was reached with", () => {
});
test("aligned meta slots spend their slack on the name", () => {
- // Centring a lone glyph splits the slack either side of it, reading as a gap on both sides.
- assert.ok(
- PICKERS.includes(
- '"flex shrink-0 items-center justify-end gap-1 text-ui-10"',
- ),
- );
+ // Centring a lone glyph splits the slack either side of it. On Device the badge leads its slot,
+ // so the eye sits the cluster gap from the quant chip.
+ assert.ok(PICKERS.includes('"flex shrink-0 items-center gap-1 text-ui-10"'));
+ assert.ok(PICKERS.includes('alignMeta === "device" ? "justify-start" : "justify-end"'));
+});
+
+test("On Device keeps at least 6px between the name, quant, modality and parameter marks", () => {
+ assert.ok(PICKERS.includes('const DEVICE_META_GAP = "gap-[max(6px,6px)]";'));
+ assert.ok(PICKERS.includes('alignMeta === "device" ? DEVICE_META_GAP : "gap-1"'));
+ assert.ok(PICKERS.includes('alignMeta === "device" ? DEVICE_META_GAP : aligned ? "gap-1" : "gap-1.5"'));
});
test("every select-model surface shares that one badge", () => {
diff --git a/studio/frontend/tests/overlay-scrollbar-gutter.test.ts b/studio/frontend/tests/overlay-scrollbar-gutter.test.ts
index 54f74acd3b2..ea7290e9d1f 100644
--- a/studio/frontend/tests/overlay-scrollbar-gutter.test.ts
+++ b/studio/frontend/tests/overlay-scrollbar-gutter.test.ts
@@ -261,10 +261,17 @@ test("right-edge action lists reserve the gutter they publish", async () => {
const pickers = await readSrcAsync(
"features/model-picker/components/model-selector/pickers.tsx",
);
- // Every model row must sit inside the gutter wrapper.
+ // Every model row sits inside the list's gutter wrapper, which gives way only for the part of
+ // the gutter the list's reach into the panel padding leaves uncovered.
assert.match(
pickers,
- /"model-list-scroll[^"]*overflow-y-auto[^"]*"[\s\S]{0,800}"overlay-scrollbar-gutter",/,
+ /"model-list-scroll[^"]*overflow-y-auto[^"]*"[\s\S]{0,800}"model-list-gutter",/,
+ );
+ assert.match(
+ css,
+ new RegExp(
+ `\\.model-list-gutter\\s*\\{[^}]*padding-right:\\s*max\\(0px,\\s*var\\(${OVERLAY_SCROLLBAR_GUTTER_VAR},\\s*0px\\)\\s*-\\s*var\\(--list-room\\)\\)`,
+ ),
);
const apiKeysTab = await readSrcAsync(