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: modern toggles, 34 x 20 with a flat centred thumb (#14322)

Michael Han37f53745d151
diff --git a/studio/frontend/src/components/ui/switch.tsx b/studio/frontend/src/components/ui/switch.tsx
index 2caf7963cbd..2dfa1939837 100644
--- a/studio/frontend/src/components/ui/switch.tsx
+++ b/studio/frontend/src/components/ui/switch.tsx
@@ -18,14 +18,18 @@ function Switch({
data-slot="switch"
data-size={size}
className={cn(
- "data-checked:bg-control-accent data-unchecked:bg-input focus-visible:border-ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent aria-invalid:ring-[3px] data-[size=default]:h-[calc(18.4px*var(--ui-space-scale,1))] data-[size=default]:w-[calc(32px*var(--ui-space-scale,1))] data-[size=sm]:h-[calc(14px*var(--ui-space-scale,1))] data-[size=sm]:w-[calc(24px*var(--ui-space-scale,1))] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",
+ // Thumb travel below is width - thumb - 2 * inset; keep the inset a whole pixel, or the thumb rounds off-centre.
+ "peer group/switch relative inline-flex shrink-0 items-center rounded-full data-[size=default]:p-[calc(2px*var(--ui-space-scale,1))] data-[size=sm]:p-[calc(2px*var(--ui-space-scale,1))] outline-none transition-[background-color,box-shadow] duration-200 ease-out after:absolute after:-inset-x-3 after:-inset-y-2",
+ "data-[size=default]:h-[calc(20px*var(--ui-space-scale,1))] data-[size=default]:w-[calc(34px*var(--ui-space-scale,1))] data-[size=sm]:h-[calc(16px*var(--ui-space-scale,1))] data-[size=sm]:w-[calc(26px*var(--ui-space-scale,1))]",
+ "data-checked:bg-control-accent data-unchecked:bg-[color-mix(in_oklab,var(--foreground)_13%,transparent)] dark:data-unchecked:bg-[color-mix(in_oklab,var(--foreground)_22%,transparent)] hover:data-unchecked:bg-[color-mix(in_oklab,var(--foreground)_18%,transparent)] dark:hover:data-unchecked:bg-[color-mix(in_oklab,var(--foreground)_28%,transparent)] hover:data-checked:bg-[color-mix(in_oklab,var(--control-accent),black_6%)]",
+ "focus-visible:ring-[3px] focus-visible:ring-ring/40 aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 data-disabled:cursor-not-allowed data-disabled:opacity-50",
className,
)}
{...props}
>
<SwitchPrimitive.Thumb
data-slot="switch-thumb"
- className="bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-control-accent-foreground rounded-full group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform"
+ className="pointer-events-none block rounded-full bg-white transition-transform duration-200 ease-out group-data-[size=default]/switch:size-[calc(16px*var(--ui-space-scale,1))] group-data-[size=sm]/switch:size-[calc(12px*var(--ui-space-scale,1))] data-unchecked:translate-x-0 group-data-[size=default]/switch:data-checked:translate-x-[calc(14px*var(--ui-space-scale,1))] group-data-[size=sm]/switch:data-checked:translate-x-[calc(10px*var(--ui-space-scale,1))] data-checked:bg-control-accent-foreground motion-reduce:transition-none"
/>
</SwitchPrimitive.Root>
);