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: stop the Images Train settings columns overlapping (#7895)

Daniel Han72a46386989e
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 2b358e1730a..62a80a50bf9 100644
--- a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx
+++ b/studio/frontend/src/features/images/train/diffusion-train-panel.tsx
@@ -140,7 +140,10 @@ const DATASET_FILE_ACCEPT = ".png,.jpg,.jpeg,.webp,.bmp,.txt,.caption,.jsonl";
const selectClass =
"h-8 w-full min-w-0 text-xs *:data-[slot=select-value]:min-w-0 *:data-[slot=select-value]:truncate";
// Every settings cell is a grid item, so it needs min-w-0 to be allowed to shrink.
-const fieldClass = "grid min-w-0 gap-2";
+// grid-cols-1 is what carries that shrink to the contents: a bare `grid` leaves the
+// implicit column auto-sized, so the track froze at its widest child's min-content
+// (150px for the run-length pair) and the cell painted over the next column.
+const fieldClass = "grid grid-cols-1 min-w-0 gap-2";
/** A field's label with its guidance behind an "i" tooltip, keeping the grid scannable.
* Only facts a user must act on stay on the page as text. */
@@ -153,7 +156,9 @@ function FieldLabel({
}) {
return (
<div className="flex min-w-0 items-center gap-1">
- <Label className="min-w-0 truncate text-xs">{children}</Label>
+ {/* block, not Label's default flex: text-overflow does nothing on a flex
+ container, so truncate cut the text mid-glyph instead of ellipsing it. */}
+ <Label className="block min-w-0 truncate text-xs">{children}</Label>
{hint ? <InfoHint>{hint}</InfoHint> : null}
</div>
);
@@ -941,9 +946,14 @@ export function DiffusionTrainPanel({
};
// The training settings, shown as the run area's MAIN content before a run starts; the run view replaces them afterwards.
+ // Columns key off this pane's OWN width, not the window's: the pane is whatever is
+ // left beside the 416px form column, so a viewport breakpoint put three columns in a
+ // ~280px pane and every cell spilled into its neighbour. A cell needs 150px (the run
+ // length pair's floor: 66px number field + 6px gap + 78px unit select), hence 324px
+ // for two columns and 498px for three.
const trainingSettings = (
- <div className="flex flex-col gap-6">
- <div className="grid grid-cols-2 gap-x-6 gap-y-5 lg:grid-cols-3">
+ <div className="@container flex flex-col gap-6">
+ <div className="grid grid-cols-1 gap-x-6 gap-y-5 @min-[324px]:grid-cols-2 @min-[498px]:grid-cols-3">
{durationField}
{numberField("LoRA rank", rank, setRank, 1, {
hint: "How much the adapter can learn. Higher captures more detail and makes a bigger file; 16 suits most styles, 32+ for complex subjects.",
@@ -965,7 +975,7 @@ export function DiffusionTrainPanel({
})}
</div>
- <div className="grid grid-cols-2 items-start gap-x-6 gap-y-5 lg:grid-cols-3">
+ <div className="grid grid-cols-1 items-start gap-x-6 gap-y-5 @min-[324px]:grid-cols-2 @min-[498px]:grid-cols-3">
{numberField("Learning rate", learningRate, setLearningRate, 0.0001, {
min: 0,
step: 0.00001,
@@ -997,7 +1007,7 @@ export function DiffusionTrainPanel({
})}
</div>
- <div className="grid grid-cols-2 items-start gap-x-6 gap-y-5 lg:grid-cols-3">
+ <div className="grid grid-cols-1 items-start gap-x-6 gap-y-5 @min-[324px]:grid-cols-2 @min-[498px]:grid-cols-3">
<div className={fieldClass}>
<FieldLabel hint="Recomputes activations instead of holding them in memory: less VRAM, slightly slower steps.">
Gradient checkpointing
diff --git a/tests/studio/test_diffusion_train_settings_layout_contract.py b/tests/studio/test_diffusion_train_settings_layout_contract.py
new file mode 100644
index 00000000000..ed51fac22dc
--- /dev/null
+++ b/tests/studio/test_diffusion_train_settings_layout_contract.py
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+"""Layout contract for the Images -> Train "Training settings" grid.
+
+The panel is a fraction of the window, so a viewport breakpoint put three columns
+in a ~280px pane; and each cell was a bare `grid`, whose implicit column is
+auto-sized and froze at its widest child's min-content, so the cell painted over
+its neighbour instead of shrinking. Both fixes have to stay: the container query
+keeps cells wide enough, grid-cols-1 keeps a cell inside its column if it ever
+is not.
+"""
+
+from pathlib import Path
+
+
+REPO = Path(__file__).resolve().parents[2]
+PANEL_TSX = REPO / "studio/frontend/src/features/images/train/diffusion-train-panel.tsx"
+
+
+def _source() -> str:
+ return PANEL_TSX.read_text(encoding = "utf-8")
+
+
+def test_settings_cell_cannot_outgrow_its_grid_column():
+ assert 'const fieldClass = "grid grid-cols-1 min-w-0 gap-2";' in _source()
+
+
+def test_settings_columns_key_off_the_pane_width_not_the_viewport():
+ source = _source()
+
+ # The run area declares itself the query container...
+ assert '<div className="@container flex flex-col gap-6">' in source
+ # ...and all three settings grids step up on ITS width. 324px fits two 150px
+ # cells plus the 24px gutter, 498px fits three.
+ assert source.count("@min-[324px]:grid-cols-2 @min-[498px]:grid-cols-3") == 3
+ # No viewport breakpoint left behind: that is what put 3 columns in a 280px pane.
+ assert "lg:grid-cols-3" not in source
+
+
+def test_field_label_ellipses_instead_of_cutting_mid_glyph():
+ # Label's own display is flex and text-overflow does nothing on a flex
+ # container, so truncate only ellipses when paired with block.
+ assert '<Label className="block min-w-0 truncate text-xs">{children}</Label>' in _source()