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: scale padding, icons and widths with the UI font size, and make interface scale work in the browser (#11648)

Michael Han6eb1b2eec680
diff --git a/studio/frontend/public/reload-snapshot.js b/studio/frontend/public/reload-snapshot.js
index f3738891538..6bc6f7aa986 100644
--- a/studio/frontend/public/reload-snapshot.js
+++ b/studio/frontend/public/reload-snapshot.js
@@ -65,7 +65,8 @@
"--foreground",
"--primary",
"--primary-foreground",
- "--ui-font-scale",
+ "--ui-font-size-scale",
+ "--ui-interface-scale",
];
function clearStoredSnapshot() {
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsx
index 6fd7b9a25fe..7a19af62f16 100644
--- a/studio/frontend/src/components/app-sidebar.tsx
+++ b/studio/frontend/src/components/app-sidebar.tsx
@@ -2169,8 +2169,8 @@ export function AppSidebar() {
// the list scroller add the rail width it does not lose, so both end on the same edge whether or
// not the scrollbar takes space. Logical sides, since the rail moves under rtl.
const rowPadding = usesDesktopTitlebar
- ? "ps-[5px] pe-[calc(var(--sidebar-rail,0px)+5px)]"
- : "ps-1.5 pe-[calc(var(--sidebar-rail,0px)+6px)]";
+ ? "ps-[calc(5px*var(--ui-space-scale,1))] pe-[calc(var(--sidebar-rail,0px)+5px*var(--ui-space-scale,1))]"
+ : "ps-1.5 pe-[calc(var(--sidebar-rail,0px)+6px*var(--ui-space-scale,1))]";
// Inside the scroller the rail already occupies that space. The profile footer also uses this
// padding deliberately: its width is independent of whether the recent-chat list has a scrollbar.
@@ -4842,7 +4842,7 @@ export function AppSidebar() {
<HugeiconsIcon
icon={BadgeInfoIcon}
strokeWidth={1.75}
- className="size-[21px] text-nav-fg"
+ className="size-[calc(21px*var(--ui-space-scale,1))] text-nav-fg"
/>
</span>
<div className="flex min-w-0 flex-col gap-px leading-tight group-data-[collapsible=icon]:hidden">
@@ -4860,7 +4860,7 @@ export function AppSidebar() {
className="ml-auto flex size-[calc(32px*var(--ui-space-scale,1))] shrink-0 items-center justify-center text-muted-foreground group-data-[collapsible=icon]:hidden"
>
<ArrowRightIcon
- className="size-[17px]"
+ className="size-[calc(17px*var(--ui-space-scale,1))]"
strokeWidth={1.75}
/>
</span>
@@ -4884,7 +4884,7 @@ export function AppSidebar() {
side="top"
align="center"
sideOffset={8}
- className="app-user-menu menu-soft-surface-up ring-0 w-[16rem] rounded-[20px] border border-transparent px-2.5 py-2.5 font-heading dark:border-[rgb(255_255_255_/_calc(0.05*var(--contrast-edge-gain,1)))]"
+ className="app-user-menu menu-soft-surface-up ring-0 w-[calc(16rem*var(--ui-space-scale,1))] rounded-[20px] border border-transparent px-2.5 py-2.5 font-heading dark:border-[rgb(255_255_255_/_calc(0.05*var(--contrast-edge-gain,1)))]"
trigger={(triggerRef) => (
<SidebarMenuButton
ref={triggerRef}
@@ -4932,7 +4932,7 @@ export function AppSidebar() {
key={item.id}
onSelect={() => useSettingsDialogStore.getState().openDialog("api-keys")}
>
- <HugeiconsIcon icon={Globe02Icon} strokeWidth={1.75} className="size-[18px]" />
+ <HugeiconsIcon icon={Globe02Icon} strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))]" />
<span>{t("shell.navigation.api")}</span>
</DropdownMenuItem>
);
@@ -5027,7 +5027,7 @@ export function AppSidebar() {
<HugeiconsIcon
icon={Settings02Icon}
strokeWidth={1.5}
- className="!size-[18px]"
+ className="!size-[calc(18px*var(--ui-space-scale,1))]"
/>
</button>
</SidebarMenuItem>
diff --git a/studio/frontend/src/components/assistant-ui/attachment.tsx b/studio/frontend/src/components/assistant-ui/attachment.tsx
index 17ab50b2299..c3a4afad5d8 100644
--- a/studio/frontend/src/components/assistant-ui/attachment.tsx
+++ b/studio/frontend/src/components/assistant-ui/attachment.tsx
@@ -222,7 +222,7 @@ const PastedTextAttachmentUI: FC<{
<button
className={cn(
// Borderless, and in dark mode a shade under the composer surface.
- "aui-pasted-text-chip group flex h-14 max-w-[15rem] min-w-0 cursor-pointer items-center gap-2.5 rounded-[14px] bg-muted px-3 text-left transition-colors hover:bg-muted-foreground/15 dark:bg-background dark:hover:bg-muted",
+ "aui-pasted-text-chip group flex h-14 max-w-[calc(15rem*var(--ui-space-scale,1))] min-w-0 cursor-pointer items-center gap-2.5 rounded-[14px] bg-muted px-3 text-left transition-colors hover:bg-muted-foreground/15 dark:bg-background dark:hover:bg-muted",
// Keep the label clear of the remove button in the corner.
isComposer && "aui-pasted-text-chip-composer pr-6",
)}
diff --git a/studio/frontend/src/components/assistant-ui/chat-dictation-bar.tsx b/studio/frontend/src/components/assistant-ui/chat-dictation-bar.tsx
index 750d91d394b..20866fd60ac 100644
--- a/studio/frontend/src/components/assistant-ui/chat-dictation-bar.tsx
+++ b/studio/frontend/src/components/assistant-ui/chat-dictation-bar.tsx
@@ -276,9 +276,9 @@ export const ChatDictationBar: FC<{
className="aui-composer-send size-9 rounded-full"
>
{transcribing === "send" ? (
- <Spinner className="size-[18px]" />
+ <Spinner className="size-[calc(18px*var(--ui-space-scale,1))]" />
) : (
- <ArrowUpIcon className="unsloth-send-icon aui-composer-send-icon size-[21px] stroke-2" />
+ <ArrowUpIcon className="unsloth-send-icon aui-composer-send-icon size-[calc(21px*var(--ui-space-scale,1))] stroke-2" />
)}
</TooltipIconButton>
</div>
diff --git a/studio/frontend/src/components/assistant-ui/message-response-details-sheet.tsx b/studio/frontend/src/components/assistant-ui/message-response-details-sheet.tsx
index e8490d71407..f31d71e542c 100644
--- a/studio/frontend/src/components/assistant-ui/message-response-details-sheet.tsx
+++ b/studio/frontend/src/components/assistant-ui/message-response-details-sheet.tsx
@@ -381,7 +381,7 @@ export const MessageResponseDetailsSheet: FC<{
<Sheet open={open} onOpenChange={onOpenChange}>
<SheetContent
side="right"
- className="w-[min(28rem,100vw)] p-0 sm:max-w-[28rem]"
+ className="w-[min(calc(28rem*var(--ui-space-scale,1)),100vw)] p-0 sm:max-w-[calc(28rem*var(--ui-space-scale,1))]"
showCloseButton={false}
>
<SheetHeader className="border-b p-4">
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsx
index e0432c9f074..f8c700e1e4b 100644
--- a/studio/frontend/src/components/assistant-ui/thread.tsx
+++ b/studio/frontend/src/components/assistant-ui/thread.tsx
@@ -2196,7 +2196,7 @@ export const Thread: FC<{
hideComposer
? "bottom-3"
: footerBottomPx == null
- ? "bottom-[150px]"
+ ? "bottom-[calc(150px*var(--ui-space-scale,1))]"
: undefined,
)}
style={
@@ -2263,11 +2263,11 @@ const GeneratedImageViewportOverlay: FC<{
/>
<section
className={cn(
- "pointer-events-none absolute inset-x-5 top-[48px] flex flex-col items-center",
+ "pointer-events-none absolute inset-x-5 top-[calc(48px*var(--ui-space-scale,1))] flex flex-col items-center",
hideComposer
? "bottom-4"
: bottomOffsetPx == null
- ? "bottom-[150px]"
+ ? "bottom-[calc(150px*var(--ui-space-scale,1))]"
: undefined,
)}
style={
@@ -2277,7 +2277,7 @@ const GeneratedImageViewportOverlay: FC<{
}
aria-label="Generated image preview"
>
- <div className="pointer-events-auto relative flex min-h-0 w-full max-w-[1100px] flex-1 flex-col items-center justify-center gap-3 rounded-3xl bg-muted/10 p-3 ring-1 ring-border/20">
+ <div className="pointer-events-auto relative flex min-h-0 w-full max-w-[calc(1100px*var(--ui-space-scale,1))] flex-1 flex-col items-center justify-center gap-3 rounded-3xl bg-muted/10 p-3 ring-1 ring-border/20">
<div className="absolute inset-x-3 top-3 z-10 flex justify-end">
<div className="flex shrink-0 items-center gap-1 rounded-full bg-background/70 p-1 ring-1 ring-border/20 backdrop-blur-sm">
<Button
@@ -2391,7 +2391,7 @@ const ThreadComposerDock: FC<{
className={cn(
// Inset both sides, not just the right: the offset keeps the bottom
// fade off the scrollbar, and a one-sided one also moves the centre.
- "aui-thread-composer-dock pointer-events-none absolute bottom-0 left-0 right-0 md:left-[10px] md:right-[10px]",
+ "aui-thread-composer-dock pointer-events-none absolute bottom-0 left-0 right-0 md:left-[calc(10px*var(--ui-space-scale,1))] md:right-[calc(10px*var(--ui-space-scale,1))]",
overlay ? "z-40" : "z-20",
)}
>
@@ -2402,7 +2402,7 @@ const ThreadComposerDock: FC<{
"thread-bottom-fade absolute inset-x-0 bottom-0 bg-gradient-to-t from-background from-[calc(100%_-_28px)] to-[rgb(from_var(--background)_r_g_b/0)]",
queueVisible
? "h-32 backdrop-blur-[1px] [mask-image:linear-gradient(to_top,black_0%,black_58%,transparent_100%)]"
- : "top-[10px]",
+ : "top-[calc(10px*var(--ui-space-scale,1))]",
)}
/>
{/* Narrow panes spend the gutter on the composer instead; index.css
@@ -5727,7 +5727,7 @@ const BulbIcon: FC<{ className?: string }> = ({ className }) => (
);
// Same bulb in every state; greyed by the pill's muted color when off.
-const ThinkIcon: FC = () => <BulbIcon className="size-[15.5px]" />;
+const ThinkIcon: FC = () => <BulbIcon className="size-[calc(15.5px*var(--ui-space-scale,1))]" />;
const ReasoningToggle: FC<{ side?: "top" | "bottom" }> = ({
side = "bottom",
@@ -5841,7 +5841,7 @@ const ReasoningToggle: FC<{ side?: "top" | "bottom" }> = ({
side={side}
align="end"
avoidCollisions={true}
- className="unsloth-plus-menu unsloth-thinking-menu min-w-0 w-[176px]"
+ className="unsloth-plus-menu unsloth-thinking-menu min-w-0 w-[calc(176px*var(--ui-space-scale,1))]"
trigger={(triggerRef) => (
<button
ref={triggerRef}
@@ -5862,7 +5862,7 @@ const ReasoningToggle: FC<{ side?: "top" | "bottom" }> = ({
{isEffort ? `Thinking · ${effortLabel}` : "Thinking"}
</span>
) : null}
- <ChevronDownIcon strokeWidth={1.5} className="unsloth-thinking-caret size-[15px]" />
+ <ChevronDownIcon strokeWidth={1.5} className="unsloth-thinking-caret size-[calc(15px*var(--ui-space-scale,1))]" />
</button>
)}
>
@@ -6080,7 +6080,7 @@ const WebSearchToggle: FC = () => {
aria-label={toolsEnabled ? "Disable web search" : "Enable web search"}
>
<PillGlyph>
- <GlobeIcon className="size-[15px]" />
+ <GlobeIcon className="size-[calc(15px*var(--ui-space-scale,1))]" />
</PillGlyph>
<span>Search</span>
</button>
@@ -6120,7 +6120,7 @@ const CodeToolsToggle: FC = () => {
<PillGlyph>
<HugeiconsIcon
icon={CodeIcon}
- className="size-[18.5px]"
+ className="size-[calc(18.5px*var(--ui-space-scale,1))]"
strokeWidth={2}
/>
</PillGlyph>
@@ -6187,7 +6187,7 @@ const ArtifactsToggle: FC = () => {
<PillGlyph>
<HugeiconsIcon
icon={PencilRulerIcon}
- className="size-[15.5px]"
+ className="size-[calc(15.5px*var(--ui-space-scale,1))]"
strokeWidth={2}
/>
</PillGlyph>
@@ -6535,7 +6535,7 @@ const ComposerToolsMenu: FC<{
</DropdownMenuSubTrigger>
<DropdownMenuSubContent
collisionPadding={16}
- className="unsloth-plus-menu w-[208px]"
+ className="unsloth-plus-menu w-[calc(208px*var(--ui-space-scale,1))]"
>
{recentPrompts.map((p) => (
<DropdownMenuItem
@@ -6566,7 +6566,7 @@ const ComposerToolsMenu: FC<{
</DropdownMenuSubTrigger>
<DropdownMenuSubContent
collisionPadding={16}
- className="unsloth-plus-menu w-[208px]"
+ className="unsloth-plus-menu w-[calc(208px*var(--ui-space-scale,1))]"
>
<DropdownMenuItem
onSelect={() => {
@@ -6640,7 +6640,7 @@ const ComposerToolsMenu: FC<{
<HugeiconsIcon icon={Folder01Icon} strokeWidth={2} />
Projects
</DropdownMenuSubTrigger>
- <DropdownMenuSubContent className="unsloth-plus-menu w-[232px]">
+ <DropdownMenuSubContent className="unsloth-plus-menu w-[calc(232px*var(--ui-space-scale,1))]">
<DropdownMenuItem onSelect={() => setNewProjectOpen(true)}>
<HugeiconsIcon icon={FolderAddIcon} strokeWidth={2} />
New project
@@ -6701,7 +6701,7 @@ const ComposerToolsMenu: FC<{
className="unsloth-composer-plus"
data-tour="chat-plus-menu"
>
- <PlusIcon className="size-[22px] stroke-[1.75px]" />
+ <PlusIcon className="size-[calc(22px*var(--ui-space-scale,1))] stroke-[1.75px]" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent
@@ -6709,7 +6709,7 @@ const ComposerToolsMenu: FC<{
align="start"
sideOffset={0}
avoidCollisions={true}
- className="unsloth-plus-menu w-[244px]"
+ className="unsloth-plus-menu w-[calc(244px*var(--ui-space-scale,1))]"
// Don't refocus the + on close; restored focus showed a stray ring.
onCloseAutoFocus={(event) => event.preventDefault()}
>
@@ -6823,7 +6823,7 @@ const ComposerToolsMenu: FC<{
<MoreHorizontalIcon className="size-4" />
More
</DropdownMenuSubTrigger>
- <DropdownMenuSubContent className="unsloth-plus-menu w-[248px]">
+ <DropdownMenuSubContent className="unsloth-plus-menu w-[calc(248px*var(--ui-space-scale,1))]">
{overflowPlusItems.map((id) => (
<Fragment key={id}>{plusMenuNodes[id]}</Fragment>
))}
@@ -7016,9 +7016,9 @@ const ComposerRightControls: FC<{
aria-label={t("promptQueue.sendLabel")}
>
{pendingSend ? (
- <Spinner className="size-[18px]" />
+ <Spinner className="size-[calc(18px*var(--ui-space-scale,1))]" />
) : (
- <ArrowUpIcon className="unsloth-send-icon aui-composer-send-icon size-[21px] stroke-2" />
+ <ArrowUpIcon className="unsloth-send-icon aui-composer-send-icon size-[calc(21px*var(--ui-space-scale,1))] stroke-2" />
)}
</TooltipIconButton>
</ComposerPrimitive.Send>
@@ -7062,7 +7062,7 @@ const ComposerRightControls: FC<{
className="aui-composer-send ml-1.5 size-9 rounded-full"
aria-label={followUpLabel}
>
- <ArrowUpIcon className="unsloth-send-icon aui-composer-send-icon size-[21px] stroke-2" />
+ <ArrowUpIcon className="unsloth-send-icon aui-composer-send-icon size-[calc(21px*var(--ui-space-scale,1))] stroke-2" />
</TooltipIconButton>
)}
</AuiIf>
@@ -7113,7 +7113,7 @@ const ComposerRightControls: FC<{
className="aui-composer-send size-9 rounded-full"
aria-label={followUpLabel}
>
- <ArrowUpIcon className="unsloth-send-icon aui-composer-send-icon size-[21px] stroke-2" />
+ <ArrowUpIcon className="unsloth-send-icon aui-composer-send-icon size-[calc(21px*var(--ui-space-scale,1))] stroke-2" />
</TooltipIconButton>
)}
</div>
diff --git a/studio/frontend/src/components/assistant-ui/tool-ui-knowledge-base.tsx b/studio/frontend/src/components/assistant-ui/tool-ui-knowledge-base.tsx
index 3c949322ba8..7364cfc5d4f 100644
--- a/studio/frontend/src/components/assistant-ui/tool-ui-knowledge-base.tsx
+++ b/studio/frontend/src/components/assistant-ui/tool-ui-knowledge-base.tsx
@@ -58,7 +58,7 @@ export function CitationBadge({
<Badge
variant="outline"
size="sm"
- className={`rounded-full inline-flex items-center gap-1.5 max-w-[15rem] ${
+ className={`rounded-full inline-flex items-center gap-1.5 max-w-[calc(15rem*var(--ui-space-scale,1))] ${
clickable
? "cursor-pointer hover:bg-accent hover:text-accent-foreground transition-colors"
: "cursor-default"
diff --git a/studio/frontend/src/components/llama-update-banner.tsx b/studio/frontend/src/components/llama-update-banner.tsx
index 78560950edb..25a8c68de2d 100644
--- a/studio/frontend/src/components/llama-update-banner.tsx
+++ b/studio/frontend/src/components/llama-update-banner.tsx
@@ -239,9 +239,9 @@ export function LlamaUpdateBanner({
<div
className={cn(
positioned
- ? "fixed bottom-4 right-4 z-[9998] w-[calc(100vw-2rem)] max-w-[448px]"
+ ? "fixed bottom-4 right-4 z-[9998] w-[calc(100vw-2rem)] max-w-[calc(448px*var(--ui-space-scale,1))]"
: cn(
- "pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[448px] flex-col",
+ "pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[calc(448px*var(--ui-space-scale,1))] flex-col",
// Only an open changelog needs a shrinkable height floor.
changelogPanelOpen
? "min-h-[calc(117px+93px*var(--ui-font-scale,1))] max-[383px]:min-h-[calc(24px+224px*var(--ui-font-scale,1))]"
diff --git a/studio/frontend/src/components/navbar.tsx b/studio/frontend/src/components/navbar.tsx
index cc1f0706858..75837a487af 100644
--- a/studio/frontend/src/components/navbar.tsx
+++ b/studio/frontend/src/components/navbar.tsx
@@ -66,7 +66,7 @@ export function Navbar() {
className={cn(
"pointer-events-auto",
usesCustomTitlebar
- ? "!size-[34px]"
+ ? "!size-[calc(34px*var(--ui-space-scale,1))]"
: "!size-[calc(34px*var(--ui-space-scale,1))]",
)}
/>
diff --git a/studio/frontend/src/components/resource-picker/picker-shell.tsx b/studio/frontend/src/components/resource-picker/picker-shell.tsx
index d342541c3d7..952dd235571 100644
--- a/studio/frontend/src/components/resource-picker/picker-shell.tsx
+++ b/studio/frontend/src/components/resource-picker/picker-shell.tsx
@@ -370,7 +370,7 @@ export function PickerShell({
<div
ref={scrollRef}
- className="min-h-0 max-h-[320px] flex-1 overflow-y-auto overscroll-contain rounded-[10px] [scrollbar-width:thin]"
+ className="min-h-0 max-h-[calc(320px*var(--ui-space-scale,1))] flex-1 overflow-y-auto overscroll-contain rounded-[10px] [scrollbar-width:thin]"
>
{canUseThis && (
<button
diff --git a/studio/frontend/src/components/sidebar-edge-trigger.tsx b/studio/frontend/src/components/sidebar-edge-trigger.tsx
index a0e887bf6fe..a731f83daf8 100644
--- a/studio/frontend/src/components/sidebar-edge-trigger.tsx
+++ b/studio/frontend/src/components/sidebar-edge-trigger.tsx
@@ -43,6 +43,7 @@ export function SidebarEdgeTrigger({
setPeeking,
toggleSidebar,
width,
+ widthScale,
storedWidth,
maxWidth,
setWidth,
@@ -86,6 +87,7 @@ export function SidebarEdgeTrigger({
stored={storedWidth}
min={SIDEBAR_WIDTH_MIN}
max={maxWidth}
+ scale={widthScale}
clamp={clampSidebarWidth}
setWidth={setWidth}
resetWidth={resetWidth}
diff --git a/studio/frontend/src/components/tauri/log-details.tsx b/studio/frontend/src/components/tauri/log-details.tsx
index 65637c8f4df..bb2cd64377a 100644
--- a/studio/frontend/src/components/tauri/log-details.tsx
+++ b/studio/frontend/src/components/tauri/log-details.tsx
@@ -85,7 +85,7 @@ export function LogDetails({
icon={ChevronDownIcon}
aria-hidden="true"
strokeWidth={1.5}
- className="size-[13px] shrink-0 transition-transform group-open:rotate-180"
+ className="size-[calc(13px*var(--ui-space-scale,1))] shrink-0 transition-transform group-open:rotate-180"
/>
</summary>
<pre
diff --git a/studio/frontend/src/components/tauri/update-banner.tsx b/studio/frontend/src/components/tauri/update-banner.tsx
index 2a08fd1cca9..61b3d9e68ad 100644
--- a/studio/frontend/src/components/tauri/update-banner.tsx
+++ b/studio/frontend/src/components/tauri/update-banner.tsx
@@ -107,9 +107,9 @@ export function UpdateBanner({
transition={{ duration: 0.35, ease: EASE_OUT_QUART }}
className={cn(
positioned
- ? "fixed bottom-4 right-4 z-[9999] w-[calc(100vw-2rem)] max-w-[448px]"
+ ? "fixed bottom-4 right-4 z-[9999] w-[calc(100vw-2rem)] max-w-[calc(448px*var(--ui-space-scale,1))]"
: cn(
- "pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[448px] shrink-0 flex-col",
+ "pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[calc(448px*var(--ui-space-scale,1))] shrink-0 flex-col",
// Only rendered notes may shrink in the capped rail.
"has-[[data-slot=update-release-notes]]:min-h-[calc(117px+93px*var(--ui-font-scale,1))] has-[[data-slot=update-release-notes]]:shrink max-[383px]:has-[[data-slot=update-release-notes]]:min-h-[calc(24px+224px*var(--ui-font-scale,1))]",
),
diff --git a/studio/frontend/src/components/tauri/window-titlebar.tsx b/studio/frontend/src/components/tauri/window-titlebar.tsx
index 023c6786f44..22debdb171b 100644
--- a/studio/frontend/src/components/tauri/window-titlebar.tsx
+++ b/studio/frontend/src/components/tauri/window-titlebar.tsx
@@ -210,11 +210,11 @@ export function WindowTitlebar({
const maximizeRefreshTimer = useRef<number | null>(null);
// The titlebar sits outside the sidebar wrapper, so it cannot inherit
// --sidebar-width. Read the resized width from the same store instead.
- const { width } = useSidebarWidth();
+ const { width, scale: widthScale } = useSidebarWidth();
const sidebarWidth = showSidebarSurface
? pinned
? // The live value only exists mid-drag; otherwise the committed width.
- `var(--studio-sidebar-live-width, ${width}px)`
+ `var(--studio-sidebar-live-width, ${width * widthScale}px)`
: "var(--studio-sidebar-collapsed-width,3rem)"
: "0px";
diff --git a/studio/frontend/src/components/ui/chart.tsx b/studio/frontend/src/components/ui/chart.tsx
index 234b86f39d5..425d1ad2dd7 100644
--- a/studio/frontend/src/components/ui/chart.tsx
+++ b/studio/frontend/src/components/ui/chart.tsx
@@ -247,7 +247,7 @@ function ChartTooltipContent({
return (
<div
className={cn(
- "border-border/50 corner-squircle bg-background gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl grid min-w-[8rem] items-start",
+ "border-border/50 corner-squircle bg-background gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl grid min-w-[calc(8rem*var(--ui-space-scale,1))] items-start",
className,
)}
>
diff --git a/studio/frontend/src/components/ui/context-menu.tsx b/studio/frontend/src/components/ui/context-menu.tsx
index 444486ed417..86f659734f1 100644
--- a/studio/frontend/src/components/ui/context-menu.tsx
+++ b/studio/frontend/src/components/ui/context-menu.tsx
@@ -129,7 +129,7 @@ function ContextMenuSubTrigger({
{children}
<ChevronRightIcon
strokeWidth={2}
- className="ml-auto size-[12px]"
+ className="ml-auto size-[calc(12px*var(--ui-space-scale,1))]"
/>
</ContextMenuPrimitive.SubTrigger>
);
diff --git a/studio/frontend/src/components/ui/copyable-error-chip.tsx b/studio/frontend/src/components/ui/copyable-error-chip.tsx
index 62b6d62f2dc..a5802597f04 100644
--- a/studio/frontend/src/components/ui/copyable-error-chip.tsx
+++ b/studio/frontend/src/components/ui/copyable-error-chip.tsx
@@ -52,7 +52,7 @@ export function CopyableErrorChip({
<button
type="button"
className={cn(
- "flex max-w-[28rem] min-w-0 cursor-pointer items-center rounded-md text-left text-xs text-destructive transition-colors hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
+ "flex max-w-[calc(28rem*var(--ui-space-scale,1))] min-w-0 cursor-pointer items-center rounded-md text-left text-xs text-destructive transition-colors hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
className,
)}
>
diff --git a/studio/frontend/src/components/ui/dropdown-menu.tsx b/studio/frontend/src/components/ui/dropdown-menu.tsx
index 90b16572fa4..9fb4b7d827c 100644
--- a/studio/frontend/src/components/ui/dropdown-menu.tsx
+++ b/studio/frontend/src/components/ui/dropdown-menu.tsx
@@ -254,7 +254,7 @@ function DropdownMenuSubTrigger({
<HugeiconsIcon
icon={ChevronRightStandardIcon}
strokeWidth={1.5}
- className="ml-auto size-[12px]"
+ className="ml-auto size-[calc(12px*var(--ui-space-scale,1))]"
/>
</DropdownMenuPrimitive.SubTrigger>
);
diff --git a/studio/frontend/src/components/ui/info-hint.tsx b/studio/frontend/src/components/ui/info-hint.tsx
index b16780a0911..0b016266d95 100644
--- a/studio/frontend/src/components/ui/info-hint.tsx
+++ b/studio/frontend/src/components/ui/info-hint.tsx
@@ -35,7 +35,7 @@ export function InfoHint({ children }: { children: ReactNode }) {
align="center"
sideOffset={6}
collisionPadding={12}
- className="[&_span>svg]:hidden! duration-0 max-w-[240px] text-left"
+ className="[&_span>svg]:hidden! duration-0 max-w-[calc(240px*var(--ui-space-scale,1))] text-left"
>
{children}
</TooltipContent>
diff --git a/studio/frontend/src/components/ui/menubar.tsx b/studio/frontend/src/components/ui/menubar.tsx
index 28d62d7dbcc..d7f738e848c 100644
--- a/studio/frontend/src/components/ui/menubar.tsx
+++ b/studio/frontend/src/components/ui/menubar.tsx
@@ -243,7 +243,7 @@ function MenubarSubTrigger({
<HugeiconsIcon
icon={ChevronRightStandardIcon}
strokeWidth={1.5}
- className="ml-auto size-[12px]"
+ className="ml-auto size-[calc(12px*var(--ui-space-scale,1))]"
/>
</MenubarPrimitive.SubTrigger>
);
diff --git a/studio/frontend/src/components/ui/panel-resize-handle.tsx b/studio/frontend/src/components/ui/panel-resize-handle.tsx
index 8b6373520cc..0908b9de2d6 100644
--- a/studio/frontend/src/components/ui/panel-resize-handle.tsx
+++ b/studio/frontend/src/components/ui/panel-resize-handle.tsx
@@ -99,8 +99,10 @@ export type PanelResizeHandleProps = {
/** Element to paint the live width onto, and the property to paint. */
target: () => HTMLElement | null
cssVar: string
- /** Measured to start a drag from the rendered size when collapsed. */
+ /** Measured to start a drag from the rendered size when collapsed, in layout px. */
measure: () => number
+ /** Browser interface scale: widths are layout px, painted times this. */
+ scale?: number
label: string
toggleLabel: string
/**
@@ -153,6 +155,7 @@ export function PanelResizeHandle({
target,
cssVar,
measure,
+ scale = 1,
label,
toggleLabel,
collapseHint,
@@ -191,6 +194,10 @@ export function PanelResizeHandle({
React.useEffect(() => {
committedRef.current = width
}, [width])
+ const scaleRef = React.useRef(scale)
+ React.useEffect(() => {
+ scaleRef.current = scale
+ }, [scale])
// Where `rootVar` is painted, resolved once on pointer down. Always
// [document.documentElement] with the flag off, which is what shipped.
@@ -219,7 +226,7 @@ export function PanelResizeHandle({
if (frameRef.current) return
frameRef.current = requestAnimationFrame(() => {
frameRef.current = 0
- paint(`${pendingRef.current}px`)
+ paint(`${pendingRef.current * scaleRef.current}px`)
})
},
[paint],
@@ -236,7 +243,7 @@ export function PanelResizeHandle({
}
// Hand the property back to the committed value. A commit re-renders with
// the new width; a cancel or a no-commit drag keeps DOM and store in step.
- paint(`${committedRef.current}px`)
+ paint(`${committedRef.current * scaleRef.current}px`)
if (rootVar) {
for (const el of rootTargetsRef.current) el.style.removeProperty(rootVar)
}
@@ -284,7 +291,8 @@ export function PanelResizeHandle({
if (!drag.moved && Math.abs(delta) < DRAG_SLOP) return
drag.moved = true
- const next = drag.startWidth + delta
+ // Screen px to layout px, so the edge stays under the pointer at any scale.
+ const next = drag.startWidth + delta / scaleRef.current
rawRef.current = next
if (!open) {
// Past the minimum, dragging the collapsed edge reopens it.
diff --git a/studio/frontend/src/components/ui/sidebar.tsx b/studio/frontend/src/components/ui/sidebar.tsx
index 30efe660aa2..61874f0b579 100644
--- a/studio/frontend/src/components/ui/sidebar.tsx
+++ b/studio/frontend/src/components/ui/sidebar.tsx
@@ -61,6 +61,8 @@ type SidebarContextProps = {
peeking: boolean
setPeeking: (value: boolean) => void
width: number
+ /** Browser interface scale: the sidebar renders at width * widthScale. */
+ widthScale: number
storedWidth: number
maxWidth: number
setWidth: (value: number) => void
@@ -104,6 +106,7 @@ function SidebarProvider({
const {
width,
max: maxWidth,
+ scale: widthScale,
stored: storedWidth,
setWidth,
resetWidth,
@@ -201,12 +204,13 @@ function SidebarProvider({
peeking,
setPeeking,
width,
+ widthScale,
storedWidth,
maxWidth,
setWidth,
resetWidth,
}),
- [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar, hasPinMode, pinned, setPinned, togglePinned, peeking, setPeeking, width, storedWidth, maxWidth, setWidth, resetWidth]
+ [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar, hasPinMode, pinned, setPinned, togglePinned, peeking, setPeeking, width, widthScale, storedWidth, maxWidth, setWidth, resetWidth]
)
return (
@@ -222,7 +226,7 @@ function SidebarProvider({
// even once the drag-time write had moved.
...(PANEL_RESIZE_SCOPED_VARS_ENABLED
? null
- : { "--sidebar-width": `${width}px` }),
+ : { "--sidebar-width": `${width * widthScale}px` }),
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
...style,
} as React.CSSProperties
@@ -293,7 +297,7 @@ function Sidebar({
collapsible?: "offcanvas" | "icon" | "none"
collapseToZero?: boolean
}) {
- const { isMobile, state, openMobile, setOpenMobile, hasPinMode, pinned, peeking, setPeeking, width } =
+ const { isMobile, state, openMobile, setOpenMobile, hasPinMode, pinned, peeking, setPeeking, width, widthScale } =
useSidebar()
// Only a sidebar that collapses to nothing has an edge to be held out from.
const holdsOut = hasPinMode && !pinned && collapseToZero
@@ -303,7 +307,7 @@ function Sidebar({
// sidebar-gap, sidebar-container) is inside it and the chat thread is not.
// Empty with the flag off, where the wrapper keeps the declaration.
const scopedWidthStyle = (
- PANEL_RESIZE_SCOPED_VARS_ENABLED ? { "--sidebar-width": `${width}px` } : {}
+ PANEL_RESIZE_SCOPED_VARS_ENABLED ? { "--sidebar-width": `${width * widthScale}px` } : {}
) as React.CSSProperties
if (collapsible === "none") {
@@ -330,7 +334,7 @@ function Sidebar({
data-sidebar="sidebar"
data-slot="sidebar"
data-mobile="true"
- className="bg-sidebar text-sidebar-foreground w-2/3 max-w-[18rem] p-0 [&>button]:hidden"
+ className="bg-sidebar text-sidebar-foreground w-2/3 max-w-[calc(18rem*var(--ui-space-scale,1))] p-0 [&>button]:hidden"
side={side}
>
<SheetHeader className="sr-only">
@@ -477,7 +481,7 @@ function SidebarResizeHandle({
className?: string
side?: "left" | "right"
}) {
- const { open, toggleSidebar, width, storedWidth, maxWidth, setWidth, resetWidth } =
+ const { open, toggleSidebar, width, widthScale, storedWidth, maxWidth, setWidth, resetWidth } =
useSidebar()
const ref = React.useRef<HTMLDivElement>(null)
const t = useT()
@@ -491,6 +495,7 @@ function SidebarResizeHandle({
stored={storedWidth}
min={SIDEBAR_WIDTH_MIN}
max={maxWidth}
+ scale={widthScale}
clamp={clampSidebarWidth}
setWidth={setWidth}
resetWidth={resetWidth}
@@ -514,9 +519,9 @@ function SidebarResizeHandle({
)
}
measure={() =>
- ref.current
+ (ref.current
?.closest<HTMLElement>('[data-slot="sidebar-container"]')
- ?.getBoundingClientRect().width ?? SIDEBAR_WIDTH_MIN
+ ?.getBoundingClientRect().width ?? SIDEBAR_WIDTH_MIN * widthScale) / widthScale
}
label={t("shell.aria.resizeSidebar")}
toggleLabel={t("shell.aria.openSidebar")}
diff --git a/studio/frontend/src/components/web/update-banner.tsx b/studio/frontend/src/components/web/update-banner.tsx
index 68bbf3e75cd..b12d5ce8b7d 100644
--- a/studio/frontend/src/components/web/update-banner.tsx
+++ b/studio/frontend/src/components/web/update-banner.tsx
@@ -83,9 +83,9 @@ export function WebUpdateBanner({
className={cn(
// Wider than the other overlays: notes preview plus three buttons.
positioned
- ? "fixed bottom-4 right-4 z-[9999] w-[calc(100vw-2rem)] max-w-[448px]"
+ ? "fixed bottom-4 right-4 z-[9999] w-[calc(100vw-2rem)] max-w-[calc(448px*var(--ui-space-scale,1))]"
: cn(
- "pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[448px] shrink-0 flex-col",
+ "pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[calc(448px*var(--ui-space-scale,1))] shrink-0 flex-col",
// Only rendered notes may shrink in the capped rail. Without
// them, shrink-0 keeps the compact card at its natural height.
// How far it may shrink is the surface's own content floor
diff --git a/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx b/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx
index 9973c7bd3db..070859a1f25 100644
--- a/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx
+++ b/studio/frontend/src/features/api-monitor/api-monitor-overlay.tsx
@@ -324,7 +324,7 @@ export function ApiMonitorOverlay(): ReactElement | null {
exit={{ opacity: 0, scale: 0.94 }}
/* Panel language from the sidebar menu: soft surface, 20px corner, heading font. */
className={cn(
- "menu-soft-surface pointer-events-auto fixed flex w-[400px] max-w-[calc(100vw-2rem)] cursor-default select-none resize flex-col overflow-hidden rounded-[20px] border-0 p-2.5 font-heading ring-0",
+ "menu-soft-surface pointer-events-auto fixed flex w-[calc(400px*var(--ui-space-scale,1))] max-w-[calc(100vw-2rem)] cursor-default select-none resize flex-col overflow-hidden rounded-[20px] border-0 p-2.5 font-heading ring-0",
// The CSS corner until it has been measured, so the first paint
// is the corner it has always opened in rather than the top left.
anchor ? "top-0 left-0" : "bottom-4 right-4",
diff --git a/studio/frontend/src/features/api-monitor/api-monitor-page.tsx b/studio/frontend/src/features/api-monitor/api-monitor-page.tsx
index 77f447dc3dd..0416cbc8535 100644
--- a/studio/frontend/src/features/api-monitor/api-monitor-page.tsx
+++ b/studio/frontend/src/features/api-monitor/api-monitor-page.tsx
@@ -948,7 +948,7 @@ export function ApiMonitorPage(): ReactElement {
>
<SelectTrigger
aria-label="Filter by status"
- className="h-9 w-[150px] rounded-full border-none bg-muted shadow-none dark:bg-background"
+ className="h-9 w-[calc(150px*var(--ui-space-scale,1))] rounded-full border-none bg-muted shadow-none dark:bg-background"
>
<SelectValue />
</SelectTrigger>
@@ -969,7 +969,7 @@ export function ApiMonitorPage(): ReactElement {
data-tour="api-log"
className="grid min-h-0 grid-cols-1 lg:grid-cols-[minmax(0,380px)_minmax(0,1fr)]"
>
- <div className="max-h-[560px] min-h-[220px] overflow-y-auto border-b border-border/60 lg:border-b-0 lg:border-r">
+ <div className="max-h-[calc(560px*var(--ui-space-scale,1))] min-h-[calc(220px*var(--ui-space-scale,1))] overflow-y-auto border-b border-border/60 lg:border-b-0 lg:border-r">
{loading ? (
<div className="flex flex-col gap-3 p-4">
{[0, 1, 2].map((i) => (
@@ -996,7 +996,7 @@ export function ApiMonitorPage(): ReactElement {
)}
</div>
- <div className="max-h-[560px] min-h-[220px] overflow-y-auto">
+ <div className="max-h-[calc(560px*var(--ui-space-scale,1))] min-h-[calc(220px*var(--ui-space-scale,1))] overflow-y-auto">
{selected ? (
<RequestDetail
entry={selected}
diff --git a/studio/frontend/src/features/audio/audio-page.tsx b/studio/frontend/src/features/audio/audio-page.tsx
index 603c8486055..1a3b0de39c7 100644
--- a/studio/frontend/src/features/audio/audio-page.tsx
+++ b/studio/frontend/src/features/audio/audio-page.tsx
@@ -2568,7 +2568,7 @@ export function AudioPage({
{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,408px)_minmax(13rem,1fr)]">
+ <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)]">
<div className="pointer-events-none flex h-full min-w-0 items-start overflow-hidden pl-[var(--studio-media-header-left-inset,1.5rem)] @[50rem]:border-r @[50rem]:border-border/60">
{/* A long resident model name must yield to the mode pill instead of painting over it. */}
<div className="pointer-events-auto flex min-w-0 max-w-full items-center gap-2 overflow-hidden pt-[var(--studio-chat-header-padding-top,11px)]">
@@ -2645,7 +2645,7 @@ export function AudioPage({
<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-[408px] @[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(calc(408px*var(--ui-space-scale,1)),calc(100%-13rem))] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0"
>
<div
ref={attachSettingsScroll}
@@ -2663,7 +2663,7 @@ export function AudioPage({
<h2 className="flex items-center gap-2 font-heading text-xl font-medium leading-none text-foreground">
<HugeiconsIcon
icon={mode === "speak" ? AudioWave01Icon : Mic01Icon}
- className="size-[18px] shrink-0"
+ className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0"
/>
{mode === "speak" ? "Generate audio" : "Transcribe"}
</h2>
diff --git a/studio/frontend/src/features/chat/bypass-permissions-menu-item.tsx b/studio/frontend/src/features/chat/bypass-permissions-menu-item.tsx
index 48edb937dd8..4d1004a2860 100644
--- a/studio/frontend/src/features/chat/bypass-permissions-menu-item.tsx
+++ b/studio/frontend/src/features/chat/bypass-permissions-menu-item.tsx
@@ -43,7 +43,7 @@ export function BypassPermissionsMenuItem() {
<HugeiconsIcon icon={ShieldBanIcon} strokeWidth={2} />
Tool permissions
</DropdownMenuSubTrigger>
- <DropdownMenuSubContent className="unsloth-plus-menu w-[300px]">
+ <DropdownMenuSubContent className="unsloth-plus-menu w-[calc(300px*var(--ui-space-scale,1))]">
<PermissionModeMenuItems
// Defer past Radix's menu-close focus restoration, or the dropdown grabs focus back
// and breaks the dialog's focus trap.
diff --git a/studio/frontend/src/features/chat/chat-mcp-servers-dialog.tsx b/studio/frontend/src/features/chat/chat-mcp-servers-dialog.tsx
index 14f572c5c99..f0578bc058d 100644
--- a/studio/frontend/src/features/chat/chat-mcp-servers-dialog.tsx
+++ b/studio/frontend/src/features/chat/chat-mcp-servers-dialog.tsx
@@ -210,7 +210,7 @@ function ArgumentsEditor({
onClick={add}
disabled={disabled}
>
- <HugeiconsIcon icon={PlusSignIcon} size={14} />
+ <HugeiconsIcon icon={PlusSignIcon} className="size-3.5" />
Add argument
</Button>
</div>
@@ -238,7 +238,7 @@ function ArgumentsEditor({
disabled={disabled}
aria-label={`Remove argument ${index + 1}`}
>
- <HugeiconsIcon icon={Delete02Icon} size={14} />
+ <HugeiconsIcon icon={Delete02Icon} className="size-3.5" />
</Button>
</div>
))}
@@ -292,7 +292,7 @@ function HeadersEditor({
onClick={add}
disabled={disabled}
>
- <HugeiconsIcon icon={PlusSignIcon} size={14} />
+ <HugeiconsIcon icon={PlusSignIcon} className="size-3.5" />
{copy.add}
</Button>
</div>
@@ -332,7 +332,7 @@ function HeadersEditor({
disabled={disabled}
aria-label={copy.remove}
>
- <HugeiconsIcon icon={Delete02Icon} size={14} />
+ <HugeiconsIcon icon={Delete02Icon} className="size-3.5" />
</Button>
</div>
))}
@@ -919,7 +919,7 @@ export function ChatMcpServersDialog({
disabled={importing || formPending}
title="Import servers from a mcpServers JSON config (Claude Desktop, Cursor, VS Code…)"
>
- {importing ? <Spinner /> : <UploadIcon size={14} />}
+ {importing ? <Spinner /> : <UploadIcon className="size-3.5" />}
Import config
</Button>
</div>
@@ -1108,11 +1108,11 @@ export function ChatMcpServersDialog({
disabled={importing || blenderBusy}
title="Import servers from a mcpServers JSON config (Claude Desktop, Cursor, VS Code…)"
>
- {importing ? <Spinner /> : <UploadIcon size={14} />}
+ {importing ? <Spinner /> : <UploadIcon className="size-3.5" />}
Import config
</Button>
<Button size="sm" onClick={startCreate} disabled={importing || blenderBusy}>
- <HugeiconsIcon icon={PlusSignIcon} size={14} />
+ <HugeiconsIcon icon={PlusSignIcon} className="size-3.5" />
Add server
</Button>
</div>
@@ -1158,7 +1158,7 @@ export function ChatMcpServersDialog({
{refreshingIds.has(server.id) ? (
<Spinner />
) : (
- <RefreshCwIcon size={14} />
+ <RefreshCwIcon className="size-3.5" />
)}
</Button>
<Button
@@ -1169,7 +1169,7 @@ export function ChatMcpServersDialog({
aria-label="Edit server"
disabled={importing || blenderBusy || busyIds.has(server.id)}
>
- <HugeiconsIcon icon={Edit03Icon} size={14} />
+ <HugeiconsIcon icon={Edit03Icon} className="size-3.5" />
</Button>
<Button
type="button"
@@ -1179,7 +1179,7 @@ export function ChatMcpServersDialog({
aria-label="Delete server"
disabled={importing || busyIds.has(server.id)}
>
- <HugeiconsIcon icon={Delete02Icon} size={14} />
+ <HugeiconsIcon icon={Delete02Icon} className="size-3.5" />
</Button>
</div>
</li>
diff --git a/studio/frontend/src/features/chat/chat-page.tsx b/studio/frontend/src/features/chat/chat-page.tsx
index 1b7b52b340b..a9231dee629 100644
--- a/studio/frontend/src/features/chat/chat-page.tsx
+++ b/studio/frontend/src/features/chat/chat-page.tsx
@@ -1719,7 +1719,7 @@ function ProjectLanding({
}
>
{/* Slightly narrower than the composer max; every block shares this. */}
- <div className="mx-auto flex w-full max-w-[44rem] flex-col pt-[calc(120px*var(--ui-space-scale,1))] pb-14">
+ <div className="mx-auto flex w-full max-w-[calc(44rem*var(--ui-space-scale,1))] flex-col pt-[calc(120px*var(--ui-space-scale,1))] pb-14">
<div className="mb-12 flex items-center gap-4">
<span className="flex size-13 shrink-0 items-center justify-center rounded-[18px] bg-muted text-foreground/80">
<HugeiconsIcon
@@ -3984,12 +3984,12 @@ export function ChatPage({
{view.mode !== "compare" && (
<div
aria-hidden
- className="chat-header-fade pointer-events-none absolute left-0 right-[10px] top-[calc(var(--studio-content-top-inset,0px)+var(--studio-chat-header-height,48px)+var(--studio-chat-notice-height,0px))] z-20 h-6 bg-gradient-to-b from-background to-transparent"
+ className="chat-header-fade pointer-events-none absolute left-0 right-[calc(10px*var(--ui-space-scale,1))] top-[calc(var(--studio-content-top-inset,0px)+var(--studio-chat-header-height,48px)+var(--studio-chat-notice-height,0px))] z-20 h-6 bg-gradient-to-b from-background to-transparent"
/>
)}
<div
className={cn(
- "pointer-events-none absolute top-[var(--studio-content-top-inset,0px)] left-0 right-[10px] z-40 flex h-[var(--studio-chat-header-height,48px)] shrink-0 items-start bg-background pt-[var(--studio-chat-header-padding-top,11px)] pr-[calc(0.5rem*var(--ui-space-scale,1)+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]",
+ "pointer-events-none absolute top-[var(--studio-content-top-inset,0px)] left-0 right-[calc(10px*var(--ui-space-scale,1))] z-40 flex h-[var(--studio-chat-header-height,48px)] shrink-0 items-start bg-background pt-[var(--studio-chat-header-padding-top,11px)] pr-[calc(0.5rem*var(--ui-space-scale,1)+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]",
isMobile
? "pl-12"
: pinned
@@ -3998,7 +3998,7 @@ export function ChatPage({
? "pl-[var(--studio-collapsed-chat-controls-inset,0.75rem)]"
: "pl-[calc(0.5rem*var(--ui-space-scale,1)+max(0px,var(--studio-mac-traffic-light-inset,0px)-var(--sidebar-width-icon,3rem)))]",
view.mode === "compare" &&
- "right-[10px] left-auto w-auto bg-transparent pl-0 pr-[calc(0.5rem*var(--ui-space-scale,1)+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]",
+ "right-[calc(10px*var(--ui-space-scale,1))] left-auto w-auto bg-transparent pl-0 pr-[calc(0.5rem*var(--ui-space-scale,1)+var(--studio-chat-header-right-inset,var(--studio-window-control-inset,0px)))]",
)}
>
<div className="pointer-events-auto flex items-center gap-1">
diff --git a/studio/frontend/src/features/chat/chat-providers-dialog.tsx b/studio/frontend/src/features/chat/chat-providers-dialog.tsx
index 25f753536d0..1c8fd9e8c82 100644
--- a/studio/frontend/src/features/chat/chat-providers-dialog.tsx
+++ b/studio/frontend/src/features/chat/chat-providers-dialog.tsx
@@ -1348,7 +1348,7 @@ export function ChatProvidersSettings({
</div>
</header>
- <div className="flex max-w-[760px] flex-col gap-3">
+ <div className="flex max-w-[calc(760px*var(--ui-space-scale,1))] flex-col gap-3">
<section className="overflow-hidden rounded-lg border border-border/70 bg-muted/[0.12]">
<div className="divide-y divide-border/60">
<div className="grid grid-cols-[minmax(140px,0.8fr)_minmax(0,1.2fr)] items-center gap-4 px-4 py-3 @max-[520px]:grid-cols-1">
@@ -1766,7 +1766,7 @@ export function ChatProvidersSettings({
}
placeholder={customProviderModelIdsPlaceholder(providerType)}
rows={5}
- className="min-h-[100px] resize-y font-mono text-sm"
+ className="min-h-[calc(100px*var(--ui-space-scale,1))] resize-y font-mono text-sm"
/>
</div>
</div>
@@ -1859,7 +1859,7 @@ export function ChatProvidersSettings({
onChange={(event) => setManualModelIds(event.target.value)}
placeholder={"model-id-1\nmodel-id-2"}
rows={5}
- className="min-h-[100px] resize-y font-mono text-sm"
+ className="min-h-[calc(100px*var(--ui-space-scale,1))] resize-y font-mono text-sm"
/>
</div>
) : null}
@@ -1955,7 +1955,7 @@ export function ChatProvidersSettings({
providerType,
)}
rows={4}
- className="min-h-[80px] resize-y font-mono text-sm"
+ className="min-h-[calc(80px*var(--ui-space-scale,1))] resize-y font-mono text-sm"
/>
</div>
) : null}
@@ -2011,7 +2011,7 @@ export function ChatProvidersSettings({
</p>
</header>
- <div className="flex w-full max-w-[760px] flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-x-6">
+ <div className="flex w-full max-w-[calc(760px*var(--ui-space-scale,1))] flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-x-6">
<div className="flex items-center gap-2">
<Label
htmlFor="chat-connections-enabled"
@@ -2035,7 +2035,7 @@ export function ChatProvidersSettings({
</p>
</div>
- <section className="flex max-w-[760px] flex-col gap-2">
+ <section className="flex max-w-[calc(760px*var(--ui-space-scale,1))] flex-col gap-2">
<div className="overflow-hidden rounded-lg border border-border/70 bg-muted/[0.12]">
<button
type="button"
@@ -2175,7 +2175,7 @@ export function ChatProvidersDialog({
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent
overlayClassName="bg-black/50 backdrop-blur-sm"
- className="flex max-h-[90dvh] w-[96vw] flex-col gap-0 overflow-y-auto p-8 sm:max-w-none md:max-w-[44rem]"
+ className="flex max-h-[90dvh] w-[96vw] flex-col gap-0 overflow-y-auto p-8 sm:max-w-none md:max-w-[calc(44rem*var(--ui-space-scale,1))]"
>
<DialogHeader className="sr-only">
<DialogTitle>Connections</DialogTitle>
diff --git a/studio/frontend/src/features/chat/chat-settings-sheet.tsx b/studio/frontend/src/features/chat/chat-settings-sheet.tsx
index 22a3c7dfcc8..e1cb5e58bae 100644
--- a/studio/frontend/src/features/chat/chat-settings-sheet.tsx
+++ b/studio/frontend/src/features/chat/chat-settings-sheet.tsx
@@ -185,7 +185,7 @@ export function ParamSlider({
return (
<div className="flex items-center gap-3">
{/* A floor rather than a fixed width, so a longer label is never clipped. */}
- <div className="flex min-w-[104px] shrink-0 items-center gap-1.5">
+ <div className="flex min-w-[calc(104px*var(--ui-space-scale,1))] shrink-0 items-center gap-1.5">
<span className="text-ui-13 font-medium leading-[1.25] tracking-nav text-nav-fg">
{label}
</span>
@@ -489,6 +489,7 @@ export function ChatSettingsPanel({
const {
width: settingsWidth,
max: settingsMax,
+ scale: settingsScale,
stored: settingsStored,
setWidth: setSettingsWidth,
resetWidth: resetSettingsWidth,
@@ -1649,7 +1650,7 @@ export function ChatSettingsPanel({
}}
placeholder="Random"
aria-label="Seed"
- className="panel-field h-8 w-[84px] shrink-0"
+ className="panel-field h-8 w-[calc(84px*var(--ui-space-scale,1))] shrink-0"
/>
</div>
) : null}
@@ -1783,7 +1784,7 @@ export function ChatSettingsPanel({
onChange={(event) => setSystemPromptDraft(event.target.value)}
placeholder="You are a helpful assistant..."
fieldSizing="fixed"
- className="min-h-[20rem] max-h-[48dvh] overflow-y-auto rounded-none border-0 text-sm leading-6 focus-visible:ring-0"
+ className="min-h-[min(calc(20rem*var(--ui-space-scale,1)),48dvh)] max-h-[48dvh] overflow-y-auto rounded-none border-0 text-sm leading-6 focus-visible:ring-0"
rows={14}
/>
</div>
@@ -1829,7 +1830,7 @@ export function ChatSettingsPanel({
if (isMobile) {
return (
<Sheet open={open} onOpenChange={onOpenChange}>
- <SheetContent side="right" className="w-[18rem] p-0 font-heading">
+ <SheetContent side="right" className="w-[min(calc(18rem*var(--ui-space-scale,1)),100vw)] p-0 font-heading">
<SheetHeader className="sr-only">
<SheetTitle>Run settings</SheetTitle>
<SheetDescription>Chat inference settings</SheetDescription>
@@ -1855,7 +1856,7 @@ export function ChatSettingsPanel({
)}
style={
{
- "--chat-settings-width": `${settingsWidth}px`,
+ "--chat-settings-width": `${settingsWidth * settingsScale}px`,
height: "calc(100% - var(--studio-custom-titlebar-height, 0px))",
marginTop: "var(--studio-custom-titlebar-height, 0px)",
} as CSSProperties
@@ -1869,13 +1870,14 @@ export function ChatSettingsPanel({
stored={settingsStored}
min={CHAT_SETTINGS_WIDTH_MIN}
max={settingsMax}
+ scale={settingsScale}
clamp={clampChatSettingsWidth}
setWidth={setSettingsWidth}
resetWidth={resetSettingsWidth}
onToggle={() => onOpenChange?.(!open)}
target={() => asideRef.current}
cssVar="--chat-settings-width"
- measure={() => asideRef.current?.getBoundingClientRect().width ?? 0}
+ measure={() => (asideRef.current?.getBoundingClientRect().width ?? 0) / settingsScale}
label={t("shell.aria.resizeRunSettings")}
toggleLabel={t("shell.aria.openRunSettings")}
collapseHint={t("shell.resize.collapse")}
diff --git a/studio/frontend/src/features/chat/components/chat-model-notice.tsx b/studio/frontend/src/features/chat/components/chat-model-notice.tsx
index 7025ed5507f..0bdb36b5433 100644
--- a/studio/frontend/src/features/chat/components/chat-model-notice.tsx
+++ b/studio/frontend/src/features/chat/components/chat-model-notice.tsx
@@ -87,11 +87,11 @@ export function ChatModelNotice({
return (
// Positioned, not in flow. The chat header is `absolute ... z-40` with an opaque `bg-background`,
// so an in-flow sibling starts at y=0 UNDER it and the bar is invisible bar the 10px the
- // header's `right-[10px]` leaves uncovered. Offset by the same header height the drop overlay
+ // header's `right-[calc(10px*var(--ui-space-scale,1))]` leaves uncovered. Offset by the same header height the drop overlay
// and the header fade use, above the fade (z-20) and below the header (z-40).
<div
data-chat-model-notice=""
- className="absolute left-0 right-[10px] top-[calc(var(--studio-content-top-inset,0px)+var(--studio-chat-header-height,48px))] z-30 flex h-[var(--studio-chat-notice-height,2.25rem)] items-center gap-2 border-b border-border/60 bg-muted px-4 text-ui-12 text-muted-foreground"
+ className="absolute left-0 right-[calc(10px*var(--ui-space-scale,1))] top-[calc(var(--studio-content-top-inset,0px)+var(--studio-chat-header-height,48px))] z-30 flex h-[var(--studio-chat-notice-height,2.25rem)] items-center gap-2 border-b border-border/60 bg-muted px-4 text-ui-12 text-muted-foreground"
>
<span className="min-w-0 truncate">
This chat was started on <span className="font-medium">{label}</span>.
diff --git a/studio/frontend/src/features/chat/components/chat-search-dialog.tsx b/studio/frontend/src/features/chat/components/chat-search-dialog.tsx
index c2e76b5a7e2..385edd16752 100644
--- a/studio/frontend/src/features/chat/components/chat-search-dialog.tsx
+++ b/studio/frontend/src/features/chat/components/chat-search-dialog.tsx
@@ -121,7 +121,7 @@ export function ChatSearchDialog() {
<CommandDialog
open={isOpen}
onOpenChange={setOpen}
- className="chat-search-surface rounded-3xl! max-sm:rounded-none! top-1/2 -translate-y-1/2 w-[635px] max-w-[calc(100%-2rem)] gap-0 p-0 ring-0 duration-[180ms] ease-[cubic-bezier(0.16,1,0.3,1)] sm:max-w-[635px]"
+ className="chat-search-surface rounded-3xl! max-sm:rounded-none! top-1/2 -translate-y-1/2 w-[calc(635px*var(--ui-space-scale,1))] max-w-[calc(100%-2rem)] gap-0 p-0 ring-0 duration-[180ms] ease-[cubic-bezier(0.16,1,0.3,1)] sm:max-w-[calc(635px*var(--ui-space-scale,1))]"
overlayClassName="bg-transparent supports-backdrop-filter:backdrop-blur-none"
>
<Command className="rounded-3xl p-0" shouldFilter={false}>
@@ -155,7 +155,7 @@ export function ChatSearchDialog() {
<CommandList
className={cn(
"cmd-native-scrollbar hover-scrollbar p-1",
- compactList ? "max-h-[420px]" : "h-[420px] max-h-[60dvh]",
+ compactList ? "max-h-[calc(420px*var(--ui-space-scale,1))]" : "h-[calc(420px*var(--ui-space-scale,1))] max-h-[60dvh]",
)}
>
<CommandEmpty className="py-6 text-center text-xs text-muted-foreground">
diff --git a/studio/frontend/src/features/chat/components/deep-research-composer-button.tsx b/studio/frontend/src/features/chat/components/deep-research-composer-button.tsx
index 11760dd1846..be0e20bf22b 100644
--- a/studio/frontend/src/features/chat/components/deep-research-composer-button.tsx
+++ b/studio/frontend/src/features/chat/components/deep-research-composer-button.tsx
@@ -173,7 +173,7 @@ export function DeepResearchComposerButton({
}}
className="composer-pill-glyph cursor-pointer"
>
- <HugeiconsIcon icon={Telescope02Icon} className="size-[15px]" />
+ <HugeiconsIcon icon={Telescope02Icon} className="size-[calc(15px*var(--ui-space-scale,1))]" />
<XIcon className="composer-pill-x" />
</span>
<span>Deep research</span>
@@ -181,7 +181,7 @@ export function DeepResearchComposerButton({
<HugeiconsIcon
icon={ChevronDownStandardIcon}
strokeWidth={1.5}
- className="composer-pill-caret size-[15px] text-primary/70"
+ className="composer-pill-caret size-[calc(15px*var(--ui-space-scale,1))] text-primary/70"
/>
</button>
);
diff --git a/studio/frontend/src/features/chat/components/model-load-status.tsx b/studio/frontend/src/features/chat/components/model-load-status.tsx
index 222a16e6f3d..bbacb66df02 100644
--- a/studio/frontend/src/features/chat/components/model-load-status.tsx
+++ b/studio/frontend/src/features/chat/components/model-load-status.tsx
@@ -129,14 +129,14 @@ export function ModelLoadInlineStatus({
const hasProgress = typeof progressPercent === "number";
return (
- <div className="flex min-w-[20rem] items-center gap-2.5 text-muted-foreground" title={title}>
+ <div className="flex min-w-[min(calc(20rem*var(--ui-space-scale,1)),100%)] items-center gap-2.5 text-muted-foreground" title={title}>
<div className="flex items-center gap-1.5 shrink-0">
<Spinner className="size-3.5 shrink-0" />
<span className="text-xs">{label}</span>
</div>
{hasProgress ? (
<div className="flex min-w-0 flex-[1.35] items-center gap-2.5">
- <div className="min-w-[7rem] flex-1">
+ <div className="min-w-[calc(7rem*var(--ui-space-scale,1))] flex-1">
<Progress value={clampProgress(progressPercent)} className="h-1 bg-[color-mix(in_oklab,var(--foreground)_calc(8%*var(--contrast-wash-gain,1)),transparent)]" />
</div>
<div
diff --git a/studio/frontend/src/features/chat/components/open-chat-folder-item.tsx b/studio/frontend/src/features/chat/components/open-chat-folder-item.tsx
index f007eb61649..b12f02fba60 100644
--- a/studio/frontend/src/features/chat/components/open-chat-folder-item.tsx
+++ b/studio/frontend/src/features/chat/components/open-chat-folder-item.tsx
@@ -52,7 +52,7 @@ export function OpenChatFolderUnavailableItem({
className="pointer-events-none absolute inset-y-0 right-0 w-0"
/>
</TooltipTrigger>
- <TooltipContent side="right" className="max-w-[220px]">
+ <TooltipContent side="right" className="max-w-[calc(220px*var(--ui-space-scale,1))]">
Only the desktop app can open a chat&apos;s files folder. In a browser, download a
file from the tool result that wrote it.
</TooltipContent>
diff --git a/studio/frontend/src/features/chat/components/openai-code-exec-section.tsx b/studio/frontend/src/features/chat/components/openai-code-exec-section.tsx
index 10a5b696c4d..541b5161225 100644
--- a/studio/frontend/src/features/chat/components/openai-code-exec-section.tsx
+++ b/studio/frontend/src/features/chat/components/openai-code-exec-section.tsx
@@ -421,7 +421,7 @@ export function OpenAICodeExecSection({
max={TTL_MAX}
value={ttlValue}
onChange={(e) => onTtlChange(e.target.value)}
- className="h-8 w-[72px] pl-3 text-sm tabular-nums"
+ className="h-8 w-[calc(72px*var(--ui-space-scale,1))] pl-3 text-sm tabular-nums"
/>
</div>
diff --git a/studio/frontend/src/features/chat/components/project-switcher.tsx b/studio/frontend/src/features/chat/components/project-switcher.tsx
index 0b60422563c..ccf70213c77 100644
--- a/studio/frontend/src/features/chat/components/project-switcher.tsx
+++ b/studio/frontend/src/features/chat/components/project-switcher.tsx
@@ -77,7 +77,7 @@ export function ProjectSwitcher({
className="size-icon shrink-0 text-foreground/70"
/>
<span className="flex min-w-0 flex-1 items-baseline">
- <span className="min-w-0 flex max-w-[150px] flex-1 items-baseline truncate font-heading text-ui-16 font-medium leading-tight text-black dark:text-foreground">
+ <span className="min-w-0 flex max-w-[calc(150px*var(--ui-space-scale,1))] flex-1 items-baseline truncate font-heading text-ui-16 font-medium leading-tight text-black dark:text-foreground">
{label}
</span>
</span>
diff --git a/studio/frontend/src/features/chat/components/research-activity-panel.tsx b/studio/frontend/src/features/chat/components/research-activity-panel.tsx
index dfeabb22697..01d93a05383 100644
--- a/studio/frontend/src/features/chat/components/research-activity-panel.tsx
+++ b/studio/frontend/src/features/chat/components/research-activity-panel.tsx
@@ -487,7 +487,7 @@ const ActivityRow = memo(function ActivityRow({
>
<div
className={cn(
- "relative pl-7 before:absolute before:left-[7px] before:top-6 before:h-[calc(100%-12px)] before:w-px before:bg-border last:before:hidden",
+ "relative pl-7 before:absolute before:left-[calc(7px*var(--ui-space-scale,1))] before:top-6 before:h-[calc(100%-12px)] before:w-px before:bg-border last:before:hidden",
activity.kind === "step" && "before:bg-primary/20",
)}
>
@@ -497,7 +497,7 @@ const ActivityRow = memo(function ActivityRow({
>
<span
className={cn(
- "absolute -left-7 top-1/2 flex size-[15px] -translate-y-1/2 items-center justify-center rounded-full bg-background text-muted-foreground",
+ "absolute -left-7 top-1/2 flex size-[calc(15px*var(--ui-space-scale,1))] -translate-y-1/2 items-center justify-center rounded-full bg-background text-muted-foreground",
activity.kind === "step" &&
activity.state !== "failed" &&
"bg-primary/10 text-primary",
@@ -904,7 +904,7 @@ export function ResearchActivityPanel({
<header className="shrink-0 border-b border-border/70 px-4 py-3.5">
<div className="flex items-start gap-3">
<div className="flex size-9 shrink-0 items-center justify-center rounded-[13px] bg-primary/10 text-primary">
- <HugeiconsIcon icon={Telescope02Icon} className="size-[18px]" />
+ <HugeiconsIcon icon={Telescope02Icon} className="size-[calc(18px*var(--ui-space-scale,1))]" />
</div>
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
diff --git a/studio/frontend/src/features/chat/mcp-composer-button.tsx b/studio/frontend/src/features/chat/mcp-composer-button.tsx
index dd5aec5c59f..443faa17094 100644
--- a/studio/frontend/src/features/chat/mcp-composer-button.tsx
+++ b/studio/frontend/src/features/chat/mcp-composer-button.tsx
@@ -324,13 +324,13 @@ export function McpComposerButton({
>
<HugeiconsIcon
icon={McpServerIcon}
- className="size-[15px]"
+ className="size-[calc(15px*var(--ui-space-scale,1))]"
strokeWidth={2}
/>
<XIcon className="composer-pill-x" />
</span>
<span>MCP</span>
- <ChevronDownIcon strokeWidth={1.5} className="composer-pill-caret size-[15px]" />
+ <ChevronDownIcon strokeWidth={1.5} className="composer-pill-caret size-[calc(15px*var(--ui-space-scale,1))]" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent
@@ -338,7 +338,7 @@ export function McpComposerButton({
align="start"
sideOffset={0}
avoidCollisions={true}
- className="unsloth-plus-menu mcp-menu w-[232px]"
+ className="unsloth-plus-menu mcp-menu w-[calc(232px*var(--ui-space-scale,1))]"
>
<DropdownMenuLabel>MCP Servers</DropdownMenuLabel>
{usable ? null : (
diff --git a/studio/frontend/src/features/chat/permission-mode-select.tsx b/studio/frontend/src/features/chat/permission-mode-select.tsx
index 353f512dfaf..1cf4a492d67 100644
--- a/studio/frontend/src/features/chat/permission-mode-select.tsx
+++ b/studio/frontend/src/features/chat/permission-mode-select.tsx
@@ -231,7 +231,7 @@ export function PermissionModeDropdown({
<DropdownMenuContent
side={side}
align={align}
- className="w-[300px]"
+ className="w-[calc(300px*var(--ui-space-scale,1))]"
avoidCollisions={true}
>
<DropdownMenuLabel>
@@ -284,13 +284,13 @@ export function PermissionModeComposerPill({
title={`${active.label}: ${active.description}`}
>
<span className="composer-pill-glyph">
- <ActiveIcon className="size-[15px]" strokeWidth={2} />
+ <ActiveIcon className="size-[calc(15px*var(--ui-space-scale,1))]" strokeWidth={2} />
</span>
<span>{active.label}</span>
<HugeiconsIcon
icon={ChevronDownStandardIcon}
strokeWidth={1.5}
- className="composer-pill-caret size-[15px]"
+ className="composer-pill-caret size-[calc(15px*var(--ui-space-scale,1))]"
/>
</button>
</DropdownMenuTrigger>
@@ -299,7 +299,7 @@ export function PermissionModeComposerPill({
align="start"
sideOffset={0}
avoidCollisions={true}
- className="unsloth-plus-menu w-[300px]"
+ className="unsloth-plus-menu w-[calc(300px*var(--ui-space-scale,1))]"
>
<DropdownMenuLabel>
How should tool calls be approved?
diff --git a/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsx b/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsx
index 023cd572704..0e99fcca00e 100644
--- a/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsx
+++ b/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsx
@@ -1204,7 +1204,7 @@ function ExportModal({
return (
<Dialog open onOpenChange={onClose}>
{/* */}
- <DialogContent className="sm:max-w-[520px] gap-0 p-0 overflow-hidden">
+ <DialogContent className="sm:max-w-[calc(520px*var(--ui-space-scale,1))] gap-0 p-0 overflow-hidden">
<div className="flex flex-col gap-5 p-6">
{/* */}
<DialogTitle className="text-base font-semibold tracking-tight">Export</DialogTitle>
@@ -2519,7 +2519,7 @@ export function PromptStorageDialog({
wraps on a narrow dialog. */}
<div className="flex-1 min-h-0 overflow-y-auto px-4 sm:px-6 pb-4 sm:pb-6 grid gap-2 sm:gap-4 grid-cols-1 grid-rows-[minmax(132px,30%)_minmax(272px,1fr)] sm:grid-cols-[200px_minmax(0,1fr)] sm:grid-rows-1 lg:grid-cols-[248px_minmax(0,1fr)]">
{/* */}
- <div className="flex min-h-[132px] flex-col gap-2 rounded-xl border border-border/50 bg-muted/20 p-2">
+ <div className="flex min-h-[calc(132px*var(--ui-space-scale,1))] flex-col gap-2 rounded-xl border border-border/50 bg-muted/20 p-2">
<button
type="button"
onClick={() => {
@@ -2602,7 +2602,7 @@ export function PromptStorageDialog({
</div>
{/* */}
- <div className="min-h-[272px] rounded-xl border border-border/60 bg-card p-4">
+ <div className="min-h-[calc(272px*var(--ui-space-scale,1))] rounded-xl border border-border/60 bg-card p-4">
{activeTab === "prompts" &&
(showNewPrompt ? (
<NewPromptForm
diff --git a/studio/frontend/src/features/chat/shared-composer.tsx b/studio/frontend/src/features/chat/shared-composer.tsx
index dc60868be6f..4fed9ca375e 100644
--- a/studio/frontend/src/features/chat/shared-composer.tsx
+++ b/studio/frontend/src/features/chat/shared-composer.tsx
@@ -2083,7 +2083,7 @@ export function SharedComposer({
</DropdownMenuSubTrigger>
<DropdownMenuSubContent
collisionPadding={16}
- className="unsloth-plus-menu w-[208px]"
+ className="unsloth-plus-menu w-[calc(208px*var(--ui-space-scale,1))]"
>
{recentPrompts.map((p) => (
<DropdownMenuItem
@@ -2122,7 +2122,7 @@ export function SharedComposer({
</DropdownMenuSubTrigger>
<DropdownMenuSubContent
collisionPadding={16}
- className="unsloth-plus-menu w-[208px]"
+ className="unsloth-plus-menu w-[calc(208px*var(--ui-space-scale,1))]"
>
{[
{ label: "Training JSONL", fn: exportConversationRawJsonl },
@@ -2176,7 +2176,7 @@ export function SharedComposer({
<HugeiconsIcon icon={Folder01Icon} strokeWidth={2} />
Projects
</DropdownMenuSubTrigger>
- <DropdownMenuSubContent className="unsloth-plus-menu w-[232px]">
+ <DropdownMenuSubContent className="unsloth-plus-menu w-[calc(232px*var(--ui-space-scale,1))]">
<DropdownMenuItem onSelect={() => setNewProjectOpen(true)}>
<HugeiconsIcon icon={FolderAddIcon} strokeWidth={2} />
New project
@@ -2412,7 +2412,7 @@ export function SharedComposer({
aria-label="Tools and attachments"
className="unsloth-composer-plus"
>
- <PlusIcon className="size-[22px] stroke-[1.75px]" />
+ <PlusIcon className="size-[calc(22px*var(--ui-space-scale,1))] stroke-[1.75px]" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent
@@ -2420,7 +2420,7 @@ export function SharedComposer({
align="start"
sideOffset={0}
avoidCollisions={true}
- className="unsloth-plus-menu w-[244px]"
+ className="unsloth-plus-menu w-[calc(244px*var(--ui-space-scale,1))]"
onCloseAutoFocus={(event) => event.preventDefault()}
>
<DropdownMenuItem onSelect={() => fileInputRef.current?.click()}>
@@ -2516,7 +2516,7 @@ export function SharedComposer({
<MoreHorizontalIcon className="size-4" />
More
</DropdownMenuSubTrigger>
- <DropdownMenuSubContent className="unsloth-plus-menu w-[248px]">
+ <DropdownMenuSubContent className="unsloth-plus-menu w-[calc(248px*var(--ui-space-scale,1))]">
{overflowPlusItems.map((id) => (
<Fragment key={id}>{plusMenuNodes[id]}</Fragment>
))}
@@ -2543,7 +2543,7 @@ export function SharedComposer({
aria-label="Exit compare chat"
>
<PillGlyph>
- <Columns2Icon className="size-[14px]" />
+ <Columns2Icon className="size-[calc(14px*var(--ui-space-scale,1))]" />
</PillGlyph>
<span>Compare</span>
</button>
@@ -2571,7 +2571,7 @@ export function SharedComposer({
}
>
<PillGlyph>
- <GlobeIcon className="size-[15px]" />
+ <GlobeIcon className="size-[calc(15px*var(--ui-space-scale,1))]" />
</PillGlyph>
<span>Search</span>
</button>
@@ -2591,7 +2591,7 @@ export function SharedComposer({
<PillGlyph>
<HugeiconsIcon
icon={CodeIcon}
- className="size-[18.5px]"
+ className="size-[calc(18.5px*var(--ui-space-scale,1))]"
strokeWidth={2}
/>
</PillGlyph>
@@ -2656,7 +2656,7 @@ export function SharedComposer({
<PillGlyph>
<HugeiconsIcon
icon={PencilRulerIcon}
- className="size-[15.5px]"
+ className="size-[calc(15.5px*var(--ui-space-scale,1))]"
strokeWidth={2}
/>
</PillGlyph>
@@ -2690,7 +2690,7 @@ export function SharedComposer({
reasoningEffort: displayedEffort,
})}
>
- <BulbIcon className="size-[15.5px]" />
+ <BulbIcon className="size-[calc(15.5px*var(--ui-space-scale,1))]" />
{thinkingActiveLook ? (
<span className="unsloth-thinking-label">
{isEffort
@@ -2701,7 +2701,7 @@ export function SharedComposer({
: "Thinking"}
</span>
) : null}
- <ChevronDownIcon strokeWidth={1.5} className="unsloth-thinking-caret size-[15px]" />
+ <ChevronDownIcon strokeWidth={1.5} className="unsloth-thinking-caret size-[calc(15px*var(--ui-space-scale,1))]" />
</button>
)}
>
@@ -2850,7 +2850,7 @@ export function SharedComposer({
})}
>
<PillGlyph>
- <BulbIcon className="size-[15.5px]" />
+ <BulbIcon className="size-[calc(15.5px*var(--ui-space-scale,1))]" />
</PillGlyph>
{thinkingActiveLook ? (
<span className="unsloth-thinking-label">Thinking</span>
@@ -2934,7 +2934,7 @@ export function SharedComposer({
disabled={!canSend}
aria-label={t("promptQueue.sendLabel")}
>
- <ArrowUpIcon className="unsloth-send-icon size-[22px] stroke-2" />
+ <ArrowUpIcon className="unsloth-send-icon size-[calc(22px*var(--ui-space-scale,1))] stroke-2" />
</TooltipIconButton>
)}
</div>
diff --git a/studio/frontend/src/features/find-in-page/components/find-bar.tsx b/studio/frontend/src/features/find-in-page/components/find-bar.tsx
index 9f727ed7da5..753d0e9c7e4 100644
--- a/studio/frontend/src/features/find-in-page/components/find-bar.tsx
+++ b/studio/frontend/src/features/find-in-page/components/find-bar.tsx
@@ -203,7 +203,7 @@ export default function FindBar({
// biome-ignore lint/a11y/useSemanticElements: this landmark contains the field and its navigation controls.
role="search"
aria-label={t("shell.find.label")}
- className="find-bar-surface fixed top-[calc(var(--studio-content-top-inset,0px)+3.5rem)] right-4 z-50 flex h-13 w-[22.25rem] max-w-[calc(100vw-2rem)] items-center gap-1 rounded-full pr-4 pl-5 sm:w-[28.25rem]"
+ className="find-bar-surface fixed top-[calc(var(--studio-content-top-inset,0px)+3.5rem)] right-4 z-50 flex h-13 w-[calc(22.25rem*var(--ui-space-scale,1))] max-w-[calc(100vw-2rem)] items-center gap-1 rounded-full pr-4 pl-5 sm:w-[calc(28.25rem*var(--ui-space-scale,1))]"
>
<input
ref={inputRef}
@@ -249,7 +249,7 @@ export default function FindBar({
aria-label={t("shell.find.previous")}
title={t("shell.find.previous")}
>
- <ArrowUpIcon strokeWidth={1.75} className="size-[18px]" />
+ <ArrowUpIcon strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))]" />
</Button>
<Button
variant="ghost"
@@ -261,7 +261,7 @@ export default function FindBar({
aria-label={t("shell.find.next")}
title={t("shell.find.next")}
>
- <ArrowDownIcon strokeWidth={1.75} className="size-[18px]" />
+ <ArrowDownIcon strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))]" />
</Button>
<Button
variant="ghost"
@@ -271,7 +271,7 @@ export default function FindBar({
aria-label={t("shell.find.close")}
title={t("shell.find.close")}
>
- <HugeiconsIcon icon={Cancel01Icon} className="size-[18px]" />
+ <HugeiconsIcon icon={Cancel01Icon} className="size-[calc(18px*var(--ui-space-scale,1))]" />
</Button>
</div>
);
diff --git a/studio/frontend/src/features/hub/catalog/catalog-states.tsx b/studio/frontend/src/features/hub/catalog/catalog-states.tsx
index 2fe02ba2a2b..5dbda488b82 100644
--- a/studio/frontend/src/features/hub/catalog/catalog-states.tsx
+++ b/studio/frontend/src/features/hub/catalog/catalog-states.tsx
@@ -81,7 +81,7 @@ export function NetworkErrorState({
const icon = offlineLike ? WifiDisconnected02Icon : CloudOffIcon;
return (
- <div className="flex min-h-[260px] flex-col items-center justify-center gap-3 px-6 text-center">
+ <div className="flex min-h-[calc(260px*var(--ui-space-scale,1))] flex-col items-center justify-center gap-3 px-6 text-center">
<div className="inline-flex size-11 items-center justify-center rounded-[12px] bg-amber-500/10 text-amber-700 dark:text-amber-300">
<HugeiconsIcon icon={icon} strokeWidth={1.6} className="size-5" />
</div>
@@ -135,7 +135,7 @@ export function DiscoverFetchMoreState({
onClearFilters: () => void;
}) {
return (
- <div className="flex min-h-[260px] flex-col items-center justify-center gap-3 px-6 text-center">
+ <div className="flex min-h-[calc(260px*var(--ui-space-scale,1))] flex-col items-center justify-center gap-3 px-6 text-center">
<div className="inline-flex size-11 items-center justify-center rounded-[12px] bg-muted text-muted-foreground">
<HugeiconsIcon icon={FilterIcon} strokeWidth={1.5} className="size-5" />
</div>
@@ -236,7 +236,7 @@ export function InventoryErrorState({
onRetry: () => void;
}) {
return (
- <div className="flex min-h-[260px] flex-col items-center justify-center gap-3 px-6 text-center">
+ <div className="flex min-h-[calc(260px*var(--ui-space-scale,1))] flex-col items-center justify-center gap-3 px-6 text-center">
<div className="inline-flex size-11 items-center justify-center rounded-[12px] bg-amber-500/10 text-amber-700 dark:text-amber-300">
<HugeiconsIcon icon={CloudOffIcon} strokeWidth={1.6} className="size-5" />
</div>
@@ -274,7 +274,7 @@ export function EmptyState({
action?: ReactNode;
}) {
return (
- <div className="flex min-h-[220px] flex-col items-center justify-center gap-3 px-6 text-center">
+ <div className="flex min-h-[calc(220px*var(--ui-space-scale,1))] flex-col items-center justify-center gap-3 px-6 text-center">
<div className="inline-flex size-11 items-center justify-center rounded-[12px] bg-muted text-muted-foreground">
<HugeiconsIcon icon={icon} strokeWidth={1.5} className="size-5" />
</div>
diff --git a/studio/frontend/src/features/hub/catalog/free-up-space-dialog.tsx b/studio/frontend/src/features/hub/catalog/free-up-space-dialog.tsx
index c9ff82b9771..663d85d37ad 100644
--- a/studio/frontend/src/features/hub/catalog/free-up-space-dialog.tsx
+++ b/studio/frontend/src/features/hub/catalog/free-up-space-dialog.tsx
@@ -123,7 +123,7 @@ export function FreeUpSpaceDialog({
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent className="max-w-[520px]">
+ <DialogContent className="max-w-[calc(520px*var(--ui-space-scale,1))]">
<DialogHeader>
<DialogTitle>Free up space</DialogTitle>
<DialogDescription>
@@ -144,7 +144,7 @@ export function FreeUpSpaceDialog({
installed.
</p>
) : (
- <ul className="flex max-h-[260px] flex-col gap-1 overflow-y-auto py-1">
+ <ul className="flex max-h-[calc(260px*var(--ui-space-scale,1))] flex-col gap-1 overflow-y-auto py-1">
{companions.map((companion, index) => (
<li
key={companionIdentity(companion)}
diff --git a/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx b/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx
index 485eb8b7458..2d903750971 100644
--- a/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx
+++ b/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx
@@ -1078,9 +1078,9 @@ export function GgufDownloadCard({
side="bottom"
sideOffset={8}
avoidCollisions={false}
- className="hub-menu-instant menu-soft-surface w-[var(--radix-popover-trigger-width)] min-w-[300px] gap-0 overflow-hidden p-0 py-2 ring-0"
+ className="hub-menu-instant menu-soft-surface w-[var(--radix-popover-trigger-width)] min-w-[min(calc(300px*var(--ui-space-scale,1)),calc(100vw-32px))] gap-0 overflow-hidden p-0 py-2 ring-0"
>
- <div className="max-h-[344px] overflow-y-auto [scrollbar-width:thin]">
+ <div className="max-h-[calc(344px*var(--ui-space-scale,1))] overflow-y-auto [scrollbar-width:thin]">
{variantMenuItems.map((item) => {
const liveState = liveVariantStates.get(item.key);
const liveActive = activeDownloadState(liveState?.state);
diff --git a/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx b/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx
index 6bc7b013088..8ed594f0861 100644
--- a/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx
+++ b/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx
@@ -469,7 +469,7 @@ export function LocalOnDeviceCard({
<button
type="button"
disabled={currentVariantState.loading || runPending}
- className="inline-flex h-6 max-w-[170px] shrink-0 cursor-pointer items-center gap-1.5 rounded-[8px] border border-format-gguf/35 px-2 font-mono text-ui-10p5 leading-none text-format-gguf transition-colors hover:bg-format-gguf/8 disabled:cursor-not-allowed disabled:opacity-60"
+ className="inline-flex h-6 max-w-[calc(170px*var(--ui-space-scale,1))] shrink-0 cursor-pointer items-center gap-1.5 rounded-[8px] border border-format-gguf/35 px-2 font-mono text-ui-10p5 leading-none text-format-gguf transition-colors hover:bg-format-gguf/8 disabled:cursor-not-allowed disabled:opacity-60"
>
<span className="truncate">
{currentVariantState.loading
@@ -496,9 +496,9 @@ export function LocalOnDeviceCard({
side="bottom"
sideOffset={8}
avoidCollisions={false}
- className="hub-menu-instant menu-soft-surface w-[var(--radix-popover-trigger-width)] min-w-[220px] gap-0 overflow-hidden p-0 py-2 ring-0"
+ className="hub-menu-instant menu-soft-surface w-[var(--radix-popover-trigger-width)] min-w-[min(calc(220px*var(--ui-space-scale,1)),calc(100vw-32px))] gap-0 overflow-hidden p-0 py-2 ring-0"
>
- <div className="max-h-[280px] overflow-y-auto [scrollbar-width:thin]">
+ <div className="max-h-[calc(280px*var(--ui-space-scale,1))] overflow-y-auto [scrollbar-width:thin]">
{sortedVariants?.map((variant) => {
const label = ggufVariantDisplayLabel(variant);
const isSelected = ggufVariantsMatch(
diff --git a/studio/frontend/src/features/hub/catalog/model-card.tsx b/studio/frontend/src/features/hub/catalog/model-card.tsx
index a02959d52bc..d862a4b2e85 100644
--- a/studio/frontend/src/features/hub/catalog/model-card.tsx
+++ b/studio/frontend/src/features/hub/catalog/model-card.tsx
@@ -309,21 +309,21 @@ export const ModelCard = memo(function ModelCard({
<span
role="img"
aria-label="Partial download"
- className="inline-block size-[5px] rounded-full bg-status-warning"
+ className="inline-block size-[calc(5px*var(--ui-space-scale,1))] rounded-full bg-status-warning"
/>
)}
{unsupported && (
<span
role="img"
aria-label="May not be supported yet"
- className="inline-block size-[5px] rounded-full bg-status-danger"
+ className="inline-block size-[calc(5px*var(--ui-space-scale,1))] rounded-full bg-status-danger"
/>
)}
{onDevice && (
<span
role="img"
aria-label="On device"
- className="inline-block size-[5px] rounded-full bg-status-success"
+ className="inline-block size-[calc(5px*var(--ui-space-scale,1))] rounded-full bg-status-success"
/>
)}
</div>
@@ -354,7 +354,7 @@ export const ModelCard = memo(function ModelCard({
return (
<Tooltip>
<TooltipTrigger asChild={true}>{card}</TooltipTrigger>
- <TooltipContent side="top" className="tooltip-compact max-w-[240px]">
+ <TooltipContent side="top" className="tooltip-compact max-w-[calc(240px*var(--ui-space-scale,1))]">
{tip}
</TooltipContent>
</Tooltip>
diff --git a/studio/frontend/src/features/hub/catalog/model-inspector.tsx b/studio/frontend/src/features/hub/catalog/model-inspector.tsx
index 45c3c0f82f1..d9965861456 100644
--- a/studio/frontend/src/features/hub/catalog/model-inspector.tsx
+++ b/studio/frontend/src/features/hub/catalog/model-inspector.tsx
@@ -83,7 +83,7 @@ function ViewRepositoryButton({
<HugeiconsIcon
icon={Share05Icon}
strokeWidth={1.75}
- className="size-[13px]"
+ className="size-[calc(13px*var(--ui-space-scale,1))]"
/>
);
return (
@@ -143,7 +143,7 @@ function CopyRepoButton({ repoId }: { repoId: string }) {
<HugeiconsIcon
icon={copied ? Tick02Icon : Copy01Icon}
strokeWidth={1.75}
- className="size-[13px]"
+ className="size-[calc(13px*var(--ui-space-scale,1))]"
/>
</button>
</TooltipTrigger>
@@ -189,7 +189,7 @@ function StatGrid({ children }: { children: React.ReactNode }) {
}
function InspectorDownloadSlot({ children }: { children: React.ReactNode }) {
- return <div className="max-w-[680px] pt-3">{children}</div>;
+ return <div className="max-w-[calc(680px*var(--ui-space-scale,1))] pt-3">{children}</div>;
}
function StatusChip({
@@ -602,7 +602,7 @@ export const ModelInspector = memo(function ModelInspector({
{model.owner.toLowerCase() === "unsloth" && (
<span
aria-label="Verified Unsloth"
- className="hub-verified-badge size-[18px] shrink-0 text-verified"
+ className="hub-verified-badge size-[calc(18px*var(--ui-space-scale,1))] shrink-0 text-verified"
/>
)}
</div>
diff --git a/studio/frontend/src/features/hub/catalog/model-readme.tsx b/studio/frontend/src/features/hub/catalog/model-readme.tsx
index b59cd9280f1..ec3f5a7cda8 100644
--- a/studio/frontend/src/features/hub/catalog/model-readme.tsx
+++ b/studio/frontend/src/features/hub/catalog/model-readme.tsx
@@ -267,7 +267,7 @@ function ReadmePlaceholder({
}) {
return (
<div
- className="min-h-[108px] space-y-3 py-0.5"
+ className="min-h-[calc(108px*var(--ui-space-scale,1))] space-y-3 py-0.5"
aria-busy="true"
aria-live="polite"
>
diff --git a/studio/frontend/src/features/hub/catalog/models-catalog-lists.tsx b/studio/frontend/src/features/hub/catalog/models-catalog-lists.tsx
index bde665baf8f..3fff3add36e 100644
--- a/studio/frontend/src/features/hub/catalog/models-catalog-lists.tsx
+++ b/studio/frontend/src/features/hub/catalog/models-catalog-lists.tsx
@@ -416,7 +416,7 @@ export function DownloadedList({
if (!downloadedReady && !hasInventoryRows) {
return (
- <div className="flex min-h-[240px] items-center justify-center gap-3 text-ui-13 text-muted-foreground">
+ <div className="flex min-h-[calc(240px*var(--ui-space-scale,1))] items-center justify-center gap-3 text-ui-13 text-muted-foreground">
<Spinner className="size-4" />
Loading local inventory...
</div>
diff --git a/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx b/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx
index b53dec39173..e720d82c0a8 100644
--- a/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx
+++ b/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx
@@ -320,7 +320,7 @@ function StatusDot({
<span
role="img"
aria-label={label}
- className={cn("inline-block size-[5px] shrink-0 rounded-full", toneClass)}
+ className={cn("inline-block size-[calc(5px*var(--ui-space-scale,1))] shrink-0 rounded-full", toneClass)}
/>
);
}
@@ -488,7 +488,7 @@ export const DiscoverModelRow = memo(function DiscoverModelRow({
<span
role="img"
aria-label="GGUF"
- className="inline-block size-[5px] shrink-0 rounded-full bg-format-gguf"
+ className="inline-block size-[calc(5px*var(--ui-space-scale,1))] shrink-0 rounded-full bg-format-gguf"
/>
)}
{unsupported && (
@@ -644,14 +644,14 @@ export const InventoryRow = memo(function InventoryRow({
<span
role="img"
aria-label="GGUF"
- className="inline-block size-[5px] shrink-0 rounded-full bg-format-gguf"
+ className="inline-block size-[calc(5px*var(--ui-space-scale,1))] shrink-0 rounded-full bg-format-gguf"
/>
)}
{row.modelFormat === "adapter" && (
<span
role="img"
aria-label="Adapter"
- className="inline-block size-[5px] shrink-0 rounded-full bg-format-adapter"
+ className="inline-block size-[calc(5px*var(--ui-space-scale,1))] shrink-0 rounded-full bg-format-adapter"
/>
)}
{partialRepoId ? (
@@ -865,7 +865,7 @@ export const InventoryRow = memo(function InventoryRow({
{metaChips}
- <div className="flex w-[96px] shrink-0 items-center justify-end text-right">
+ <div className="flex w-[calc(96px*var(--ui-space-scale,1))] shrink-0 items-center justify-end text-right">
{row.kind === "cache" ? (
<CachedSizeChip
repoId={row.repoId}
diff --git a/studio/frontend/src/features/hub/catalog/models-table.tsx b/studio/frontend/src/features/hub/catalog/models-table.tsx
index 53b670130f6..e811232bc4b 100644
--- a/studio/frontend/src/features/hub/catalog/models-table.tsx
+++ b/studio/frontend/src/features/hub/catalog/models-table.tsx
@@ -72,11 +72,11 @@ export type AllModelsView = "grid" | "two" | "split";
const LIST_COLS = {
model: "flex min-w-0 flex-[2.4] items-center gap-3",
caps: "hidden min-w-0 flex-[1.7] items-center gap-1.5 md:flex",
- capsModel: "hidden w-[132px] shrink-0 items-center gap-1.5 md:flex",
+ capsModel: "hidden w-[calc(132px*var(--ui-space-scale,1))] shrink-0 items-center gap-1.5 md:flex",
size: "hidden w-[calc(60px*var(--ui-space-scale,1))] shrink-0 lg:block",
- updated: "hidden w-[82px] shrink-0 xl:block",
- downloads: "hidden w-[104px] shrink-0 items-center gap-1.5 sm:flex",
- likes: "hidden w-[76px] shrink-0 items-center gap-1.5 sm:flex",
+ updated: "hidden w-[calc(82px*var(--ui-space-scale,1))] shrink-0 xl:block",
+ downloads: "hidden w-[calc(104px*var(--ui-space-scale,1))] shrink-0 items-center gap-1.5 sm:flex",
+ likes: "hidden w-[calc(76px*var(--ui-space-scale,1))] shrink-0 items-center gap-1.5 sm:flex",
actions: "flex w-[calc(64px*var(--ui-space-scale,1))] shrink-0 items-center justify-end gap-0.5",
} as const;
@@ -143,7 +143,7 @@ export function InventorySortControl({
title={selected?.label}
// Capped and shrinkable so a long label truncates instead of wrapping
// the "On device" heading beside these pills in the narrow split pane.
- className="h-8 min-w-[72px] max-w-[124px] shrink text-ui-11p5"
+ className="h-8 min-w-[calc(72px*var(--ui-space-scale,1))] max-w-[calc(124px*var(--ui-space-scale,1))] shrink text-ui-11p5"
triggerContent={
<span className="flex min-w-0 items-center gap-1">
<HugeiconsIcon
@@ -179,7 +179,7 @@ export function InventoryTypeFilterControl({
title={selected?.label}
// Capped and shrinkable so a long label ("Speech to text") truncates
// instead of wrapping the "On device" heading beside these pills.
- className="h-8 min-w-[72px] max-w-[124px] shrink text-ui-11p5"
+ className="h-8 min-w-[calc(72px*var(--ui-space-scale,1))] max-w-[calc(124px*var(--ui-space-scale,1))] shrink text-ui-11p5"
/>
);
}
@@ -254,7 +254,7 @@ export function HubListHeader({
<HugeiconsIcon
icon={Refresh01Icon}
strokeWidth={1.75}
- className={cn("size-[11px]", isRefreshing && "animate-spin")}
+ className={cn("size-[calc(11px*var(--ui-space-scale,1))]", isRefreshing && "animate-spin")}
/>
</button>
</TooltipTrigger>
@@ -325,7 +325,7 @@ export function ResultListHeader({ isDataset }: { isDataset: boolean }) {
);
}
-const STATUS_DOT_CLASS = "inline-block size-[6px] shrink-0 rounded-full";
+const STATUS_DOT_CLASS = "inline-block size-[calc(6px*var(--ui-space-scale,1))] shrink-0 rounded-full";
function TitleMarkers({
format,
@@ -521,7 +521,7 @@ function RowActions({
/>
</button>
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="min-w-[184px]">
+ <DropdownMenuContent align="end" className="min-w-[calc(184px*var(--ui-space-scale,1))]">
<DropdownMenuItem
onClick={async (event) => {
event.stopPropagation();
@@ -706,7 +706,7 @@ export const ResultCard = memo(function ResultCard({
return (
<Tooltip>
<TooltipTrigger asChild={true}>{card}</TooltipTrigger>
- <TooltipContent side="top" className="tooltip-compact max-w-[260px]">
+ <TooltipContent side="top" className="tooltip-compact max-w-[calc(260px*var(--ui-space-scale,1))]">
{tip}
</TooltipContent>
</Tooltip>
@@ -751,7 +751,7 @@ export const ResultGridRow = memo(function ResultGridRow({
<TooltipContent
side="top"
align="start"
- className="tooltip-compact max-w-[280px]"
+ className="tooltip-compact max-w-[calc(280px*var(--ui-space-scale,1))]"
>
{tip}
</TooltipContent>
@@ -913,7 +913,7 @@ export const ResultSplitRow = memo(function ResultSplitRow({
<HugeiconsIcon
icon={FavouriteIcon}
strokeWidth={1.75}
- className="size-[11px] shrink-0"
+ className="size-[calc(11px*var(--ui-space-scale,1))] shrink-0"
/>
{formatCompact(row.result.likes)}
</span>
@@ -921,7 +921,7 @@ export const ResultSplitRow = memo(function ResultSplitRow({
<HugeiconsIcon
icon={Download01Icon}
strokeWidth={1.75}
- className="size-[11px] shrink-0"
+ className="size-[calc(11px*var(--ui-space-scale,1))] shrink-0"
/>
{formatCompact(row.result.downloads)}
</span>
@@ -940,7 +940,7 @@ export const ResultSplitRow = memo(function ResultSplitRow({
return (
<Tooltip>
<TooltipTrigger asChild={true}>{node}</TooltipTrigger>
- <TooltipContent side="top" className="tooltip-compact max-w-[260px]">
+ <TooltipContent side="top" className="tooltip-compact max-w-[calc(260px*var(--ui-space-scale,1))]">
{tip}
</TooltipContent>
</Tooltip>
diff --git a/studio/frontend/src/features/hub/catalog/models-toolbar.tsx b/studio/frontend/src/features/hub/catalog/models-toolbar.tsx
index 9194d52c7ba..51bbc09a9f2 100644
--- a/studio/frontend/src/features/hub/catalog/models-toolbar.tsx
+++ b/studio/frontend/src/features/hub/catalog/models-toolbar.tsx
@@ -207,7 +207,7 @@ export const ModelsToolbar = memo(function ModelsToolbar({
<div
data-tour="hub-tabs"
className={cn(
- "hub-menu-trigger hub-tab-toggle relative inline-flex h-9 w-full shrink-0 items-center rounded-full lg:w-[280px]",
+ "hub-menu-trigger hub-tab-toggle relative inline-flex h-9 w-full shrink-0 items-center rounded-full lg:w-[calc(280px*var(--ui-space-scale,1))]",
)}
role="radiogroup"
aria-label="View"
@@ -253,7 +253,7 @@ export const ModelsToolbar = memo(function ModelsToolbar({
<div
ref={searchWrapRef}
data-tour="hub-search"
- className="relative min-w-0 flex-1 lg:min-w-[220px] lg:flex-[1_1_220px]"
+ className="relative min-w-0 flex-1 lg:min-w-[calc(220px*var(--ui-space-scale,1))] lg:flex-[1_1_220px]"
>
<HugeiconsIcon
icon={Search01Icon}
@@ -314,7 +314,7 @@ export const ModelsToolbar = memo(function ModelsToolbar({
<HugeiconsIcon
icon={CancelCircleIcon}
strokeWidth={1.75}
- className="size-[18px]"
+ className="size-[calc(18px*var(--ui-space-scale,1))]"
/>
</button>
) : isDiscover && isLoading ? (
@@ -398,7 +398,7 @@ export const ModelsToolbar = memo(function ModelsToolbar({
}
}}
ariaLabel="Format filter"
- className={cn(triggerBase, "w-[128px]")}
+ className={cn(triggerBase, "w-[calc(128px*var(--ui-space-scale,1))]")}
/>
)}
@@ -408,7 +408,7 @@ export const ModelsToolbar = memo(function ModelsToolbar({
options={capabilityOptions}
onValueChange={onCapabilityFilterChange}
ariaLabel="Capability filter"
- className={cn(triggerBase, "w-[128px]")}
+ className={cn(triggerBase, "w-[calc(128px*var(--ui-space-scale,1))]")}
/>
)}
@@ -418,7 +418,7 @@ export const ModelsToolbar = memo(function ModelsToolbar({
options={sortOptions}
onValueChange={onSortChange}
ariaLabel="Sort models"
- className={cn(triggerBase, "w-[128px]")}
+ className={cn(triggerBase, "w-[calc(128px*var(--ui-space-scale,1))]")}
footer={
isDataset ? undefined : (
<Tooltip>
diff --git a/studio/frontend/src/features/hub/catalog/on-device-folders-dialog.tsx b/studio/frontend/src/features/hub/catalog/on-device-folders-dialog.tsx
index 5b524aa2834..79900f0d74d 100644
--- a/studio/frontend/src/features/hub/catalog/on-device-folders-dialog.tsx
+++ b/studio/frontend/src/features/hub/catalog/on-device-folders-dialog.tsx
@@ -258,7 +258,7 @@ export function OnDeviceFoldersDialog({
<>
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent
- className="flex max-h-[90dvh] flex-col gap-0 overflow-hidden p-0 sm:max-w-[620px] lg:max-w-[660px] xl:max-w-[680px] [&_[data-slot=dialog-close]]:right-3 [&_[data-slot=dialog-close]]:top-3"
+ className="flex max-h-[90dvh] flex-col gap-0 overflow-hidden p-0 sm:max-w-[calc(620px*var(--ui-space-scale,1))] lg:max-w-[calc(660px*var(--ui-space-scale,1))] xl:max-w-[calc(680px*var(--ui-space-scale,1))] [&_[data-slot=dialog-close]]:right-3 [&_[data-slot=dialog-close]]:top-3"
overlayClassName="bg-black/20 backdrop-blur-none"
>
<DialogHeader className="shrink-0 border-b border-border/60 px-5 py-4">
diff --git a/studio/frontend/src/features/hub/catalog/owner-scope-toggle.tsx b/studio/frontend/src/features/hub/catalog/owner-scope-toggle.tsx
index d2870a09c4a..c21c5cee2e7 100644
--- a/studio/frontend/src/features/hub/catalog/owner-scope-toggle.tsx
+++ b/studio/frontend/src/features/hub/catalog/owner-scope-toggle.tsx
@@ -29,7 +29,7 @@ export function OwnerScopeToggle({
ariaLabel="Publisher scope"
align="end"
// Extra gap before the chevron; min-width keeps the pill readable.
- className="h-8 min-w-[96px] gap-1.5 text-ui-11p5"
+ className="h-8 min-w-[calc(96px*var(--ui-space-scale,1))] gap-1.5 text-ui-11p5"
/>
);
}
diff --git a/studio/frontend/src/features/hub/catalog/transport-conflict-dialog.tsx b/studio/frontend/src/features/hub/catalog/transport-conflict-dialog.tsx
index 7fe21268881..63dbaf57bd3 100644
--- a/studio/frontend/src/features/hub/catalog/transport-conflict-dialog.tsx
+++ b/studio/frontend/src/features/hub/catalog/transport-conflict-dialog.tsx
@@ -60,7 +60,7 @@ export function TransportConflictDialog({
if (!o) onCancel();
}}
>
- <AlertDialogContent className="sm:!max-w-[22rem]">
+ <AlertDialogContent className="sm:!max-w-[calc(22rem*var(--ui-space-scale,1))]">
<AlertDialogHeader>
<AlertDialogTitle>Different transport mode</AlertDialogTitle>
<AlertDialogDescription>{description}</AlertDialogDescription>
diff --git a/studio/frontend/src/features/hub/components/hf-token-indicator.tsx b/studio/frontend/src/features/hub/components/hf-token-indicator.tsx
index fca37abfce6..0ac99241e27 100644
--- a/studio/frontend/src/features/hub/components/hf-token-indicator.tsx
+++ b/studio/frontend/src/features/hub/components/hf-token-indicator.tsx
@@ -121,7 +121,7 @@ export function HfTokenIndicator({
icon={AiSecurity03Icon}
strokeWidth={1.75}
// Shield ink leans right; nudge left to optically centre it.
- className="block size-[13px] shrink-0 -translate-x-[0.5px]"
+ className="block size-[calc(13px*var(--ui-space-scale,1))] shrink-0 -translate-x-[0.5px]"
/>
</button>
</TooltipTrigger>
diff --git a/studio/frontend/src/features/hub/download-manager/download-manager-panel.tsx b/studio/frontend/src/features/hub/download-manager/download-manager-panel.tsx
index ad09b177e40..889d5d127a0 100644
--- a/studio/frontend/src/features/hub/download-manager/download-manager-panel.tsx
+++ b/studio/frontend/src/features/hub/download-manager/download-manager-panel.tsx
@@ -236,7 +236,7 @@ export function DownloadManagerPanel({
<HugeiconsIcon
icon={Download01Icon}
strokeWidth={1.75}
- className="size-[18px]"
+ className="size-[calc(18px*var(--ui-space-scale,1))]"
/>
{activeCount > 0 && (
<span className="hub-download-fab-badge">{activeCount}</span>
diff --git a/studio/frontend/src/features/hub/hub.css b/studio/frontend/src/features/hub/hub.css
index 6244f3f1645..4f90be26da0 100644
--- a/studio/frontend/src/features/hub/hub.css
+++ b/studio/frontend/src/features/hub/hub.css
@@ -183,7 +183,7 @@
pointer-events: none;
position: absolute;
z-index: 5;
- width: 44px;
+ width: calc(44px * var(--ui-space-scale, 1));
opacity: 0;
transition: opacity 240ms ease;
}
@@ -195,7 +195,7 @@
.hub-page .hub-carousel-fade-left {
/* -8px matches the scroller's -mx-2 bleed so the opaque edge sits on the
clip edge and no card peeks out beside the fade. */
- left: -8px;
+ left: calc(-8px * var(--ui-space-scale, 1));
background: linear-gradient(
to right,
var(--background),
@@ -206,7 +206,7 @@
.hub-page .hub-carousel-fade-right {
/* Mirror of fade-left: offset by the -mx-2 bleed to reach the clip edge. */
- right: -8px;
+ right: calc(-8px * var(--ui-space-scale, 1));
background: linear-gradient(
to left,
var(--background),
@@ -869,8 +869,8 @@
.hub-download-fab {
position: relative;
display: inline-flex;
- width: 2.75rem;
- height: 2.75rem;
+ width: calc(2.75rem * var(--ui-space-scale, 1));
+ height: calc(2.75rem * var(--ui-space-scale, 1));
cursor: pointer;
align-items: center;
justify-content: center;
@@ -903,9 +903,9 @@
top: -3px;
right: -3px;
display: inline-flex;
- width: 1.125rem;
- min-width: 1.125rem;
- height: 1.125rem;
+ width: calc(1.125rem * var(--ui-space-scale, 1));
+ min-width: calc(1.125rem * var(--ui-space-scale, 1));
+ height: calc(1.125rem * var(--ui-space-scale, 1));
align-items: center;
justify-content: center;
border-radius: 9999px;
@@ -1178,7 +1178,7 @@
@apply so the cascade is explicit and predictable. */
.hub-action-btn {
display: inline-flex;
- height: 2.25rem;
+ height: calc(2.25rem * var(--ui-space-scale, 1));
cursor: pointer;
align-items: center;
justify-content: center;
@@ -1208,18 +1208,17 @@
cursor: not-allowed;
}
- /* Every glyph inside a hub action button — explicit icon, spinner, or
- embedded SVG — locks to 16px so swapping icons or replacing the
- spinner can't drift the layout. */
+ /* Every glyph in a hub action button (icon, spinner or embedded SVG) locks
+ to one scaled size so swapping icons can't drift the layout. */
.hub-action-btn svg {
- width: 1rem;
- height: 1rem;
+ width: calc(1rem * var(--ui-space-scale, 1));
+ height: calc(1rem * var(--ui-space-scale, 1));
flex-shrink: 0;
}
.hub-run-action-btn {
display: inline-flex;
- height: 2.25rem;
+ height: calc(2.25rem * var(--ui-space-scale, 1));
cursor: pointer;
align-items: center;
justify-content: center;
@@ -1260,8 +1259,8 @@
}
.hub-run-action-btn svg {
- width: 0.9rem;
- height: 0.9rem;
+ width: calc(0.9rem * var(--ui-space-scale, 1));
+ height: calc(0.9rem * var(--ui-space-scale, 1));
flex-shrink: 0;
}
@@ -1271,8 +1270,8 @@
.hub-cta-indicator {
position: relative;
display: inline-flex;
- width: 1rem;
- height: 1rem;
+ width: calc(1rem * var(--ui-space-scale, 1));
+ height: calc(1rem * var(--ui-space-scale, 1));
flex-shrink: 0;
align-items: center;
justify-content: center;
@@ -1285,11 +1284,11 @@
`.group/dl` ancestor for the hover scope (the Hub download row). */
.hub-row-action {
position: absolute;
- right: 0.25rem;
+ right: calc(0.25rem * var(--ui-space-scale, 1));
top: 50%;
display: inline-flex;
- width: 1.75rem;
- height: 1.75rem;
+ width: calc(1.75rem * var(--ui-space-scale, 1));
+ height: calc(1.75rem * var(--ui-space-scale, 1));
transform: translateY(-50%);
align-items: center;
justify-content: center;
@@ -1314,8 +1313,8 @@
}
.hub-row-action svg {
- width: 1rem;
- height: 1rem;
+ width: calc(1rem * var(--ui-space-scale, 1));
+ height: calc(1rem * var(--ui-space-scale, 1));
flex-shrink: 0;
}
}
@@ -1338,7 +1337,7 @@
flex-shrink: 0;
align-items: center;
gap: calc(0.4rem * var(--ui-space-scale, 1));
- height: 2rem;
+ height: calc(2rem * var(--ui-space-scale, 1));
padding-inline: calc(0.7rem * var(--ui-space-scale, 1));
border-radius: 9999px;
border: 1px solid color-mix(in srgb, var(--foreground) calc(8% * var(--contrast-edge-gain, 1)), transparent);
diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsx
index 46cce23e8be..52206dd8330 100644
--- a/studio/frontend/src/features/images/images-page.tsx
+++ b/studio/frontend/src/features/images/images-page.tsx
@@ -345,7 +345,7 @@ function DimensionSelect({
>
<ChevronDown className="size-4" />
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="max-h-72 overflow-y-auto">
+ <DropdownMenuContent align="end" className="max-h-[min(--spacing(72),var(--radix-dropdown-menu-content-available-height))] overflow-y-auto">
{dimOptions(limits).map((n) => (
<DropdownMenuItem key={n} onSelect={() => pick(n)}>
<span className="tabular-nums">{n}</span>
@@ -738,7 +738,7 @@ function AdvancedSelect({
{badge}
</span>
<Select value={value} onValueChange={onValueChange}>
- <SelectTrigger aria-label={label} className="h-8 w-[160px] text-xs">
+ <SelectTrigger aria-label={label} className="h-8 w-[calc(160px*var(--ui-space-scale,1))] text-xs">
<SelectValue />
</SelectTrigger>
<SelectContent>
@@ -4160,7 +4160,7 @@ export function ImagesPage({
{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,408px)_minmax(13rem,1fr)]">
+ <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)]">
<div
className={cn(
"pointer-events-none flex h-full min-w-0 items-start overflow-hidden @[50rem]:border-r @[50rem]:border-border/60",
@@ -4272,7 +4272,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-[408px] @[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(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
@@ -4291,7 +4291,7 @@ export function ImagesPage({
{/* Same icon the sidebar submenu uses for this workflow. */}
<HugeiconsIcon
icon={activeWorkflowTab.icon}
- className="size-[18px] shrink-0"
+ className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0"
/>
{activeWorkflowTab.heading ?? activeWorkflowTab.label}
</h2>
@@ -4666,7 +4666,7 @@ export function ImagesPage({
value={String(matchResolution)}
onValueChange={(v) => setMatchResolution(Number(v))}
>
- <SelectTrigger aria-label="Match size" className="w-[120px]">
+ <SelectTrigger aria-label="Match size" className="w-[calc(120px*var(--ui-space-scale,1))]">
<SelectValue />
</SelectTrigger>
<SelectContent>
diff --git a/studio/frontend/src/features/images/train/dataset-labeling-grid.tsx b/studio/frontend/src/features/images/train/dataset-labeling-grid.tsx
index 3cb4b894b17..7efb3bfe845 100644
--- a/studio/frontend/src/features/images/train/dataset-labeling-grid.tsx
+++ b/studio/frontend/src/features/images/train/dataset-labeling-grid.tsx
@@ -290,7 +290,7 @@ export function DatasetLabelingGrid({
{/* Two columns at any width: the column is fixed, so viewport breakpoints do not apply. */}
{/* auto-rows-min: past max-h the height is definite and auto rows split it, flattening every
tile until its thumbnail collapses. */}
- <div className="hover-scrollbar grid max-h-[420px] auto-rows-min grid-cols-2 gap-2.5 overflow-y-auto pb-0.5 pr-1">
+ <div className="hover-scrollbar grid max-h-[calc(420px*var(--ui-space-scale,1))] auto-rows-min grid-cols-2 gap-2.5 overflow-y-auto pb-0.5 pr-1">
{pageRecords.map((r) => (
<LabelTile
key={r.filename}
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 39bf10d3250..fdd78b76f5a 100644
--- a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx
+++ b/studio/frontend/src/features/images/train/diffusion-train-panel.tsx
@@ -1521,7 +1521,7 @@ export function DiffusionTrainPanel({
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 @[50rem]:w-[408px] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0">
+ <div className="flex w-full min-w-0 shrink-0 flex-col border-b border-border/60 pl-10 @[50rem]:w-[calc(408px*var(--ui-space-scale,1))] @[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}
@@ -1537,7 +1537,7 @@ export function DiffusionTrainPanel({
<h2 className="flex items-center gap-2 font-heading text-xl font-medium leading-none">
<HugeiconsIcon
icon={TestTubeOutlineIcon}
- className="size-[18px] shrink-0"
+ className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0"
/>
Train a LoRA
</h2>
@@ -1985,7 +1985,7 @@ export function DiffusionTrainPanel({
<span className="flex items-center gap-2 font-heading text-xl font-medium leading-none">
<HugeiconsIcon
icon={Settings02Icon}
- className="size-[18px] shrink-0"
+ className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0"
/>
Train settings
</span>
diff --git a/studio/frontend/src/features/images/train/example-dataset-cards.tsx b/studio/frontend/src/features/images/train/example-dataset-cards.tsx
index 6b269ad447d..554e1ab5c79 100644
--- a/studio/frontend/src/features/images/train/example-dataset-cards.tsx
+++ b/studio/frontend/src/features/images/train/example-dataset-cards.tsx
@@ -130,7 +130,7 @@ export function ExampleDatasetCards({
</Tooltip>
<Tooltip>
<TooltipTrigger asChild={true}>
- <span className="max-w-[110px] shrink truncate rounded-full bg-secondary px-2 py-0.5 text-ui-10 font-normal text-secondary-foreground">
+ <span className="max-w-[calc(110px*var(--ui-space-scale,1))] shrink truncate rounded-full bg-secondary px-2 py-0.5 text-ui-10 font-normal text-secondary-foreground">
{ex.license}
</span>
</TooltipTrigger>
diff --git a/studio/frontend/src/features/images/train/train-base-selector.tsx b/studio/frontend/src/features/images/train/train-base-selector.tsx
index 12e33a024d5..0a0bcad6c0e 100644
--- a/studio/frontend/src/features/images/train/train-base-selector.tsx
+++ b/studio/frontend/src/features/images/train/train-base-selector.tsx
@@ -46,7 +46,7 @@ export function TrainBaseSelector({
<button
type="button"
aria-label="Training base model"
- className="unsloth-model-selector-trigger flex h-[calc(34px*var(--ui-space-scale,1))] min-w-0 max-w-[320px] items-center gap-2 rounded-full pl-4 pr-2 text-sm transition-colors hover:bg-accent"
+ className="unsloth-model-selector-trigger flex h-[calc(34px*var(--ui-space-scale,1))] min-w-0 max-w-[calc(320px*var(--ui-space-scale,1))] items-center gap-2 rounded-full pl-4 pr-2 text-sm transition-colors hover:bg-accent"
>
<span className="min-w-0 truncate font-medium">{label}</span>
{family && (
@@ -63,7 +63,7 @@ export function TrainBaseSelector({
</span>
</button>
</DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="max-h-[420px] w-[340px] overflow-y-auto">
+ <DropdownMenuContent align="start" className="max-h-[min(calc(420px*var(--ui-space-scale,1)),var(--radix-dropdown-menu-content-available-height))] w-[calc(340px*var(--ui-space-scale,1))] overflow-y-auto">
{families.map((f) => (
<DropdownMenuGroup key={f.name}>
<DropdownMenuLabel className="text-ui-11 text-muted-foreground">
diff --git a/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsx b/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsx
index 458d9b66780..4d48e4985e6 100644
--- a/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsx
+++ b/studio/frontend/src/features/loaded-models/loaded-models-indicator.tsx
@@ -104,7 +104,7 @@ function LoadedModelRow({
<HugeiconsIcon
icon={KIND_ICONS[entry.kind]}
strokeWidth={1.75}
- className="size-[15px]"
+ className="size-[calc(15px*var(--ui-space-scale,1))]"
/>
</span>
<span className="min-w-0 flex-1">
@@ -278,7 +278,7 @@ export function LoadedModelsIndicator({
<HugeiconsIcon
icon={SparkleIcon}
strokeWidth={1.75}
- className="size-[15px]"
+ className="size-[calc(15px*var(--ui-space-scale,1))]"
/>
<span className="text-ui-12p5 font-medium tabular-nums">
{entries.length}
@@ -290,12 +290,12 @@ export function LoadedModelsIndicator({
</TooltipContent>
</Tooltip>
) : (
- <div className="menu-soft-surface menu-soft-edgeless pointer-events-auto flex min-h-0 w-[268px] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-[20px] p-1.5 font-heading">
+ <div className="menu-soft-surface menu-soft-edgeless pointer-events-auto flex min-h-0 w-[calc(268px*var(--ui-space-scale,1))] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-[20px] p-1.5 font-heading">
<div className="flex items-center gap-1.5 px-1.5 pb-2.5 pt-0.5">
<HugeiconsIcon
icon={SparkleIcon}
strokeWidth={1.75}
- className="size-[15px] shrink-0 text-muted-foreground"
+ className="size-[calc(15px*var(--ui-space-scale,1))] shrink-0 text-muted-foreground"
/>
<span className="min-w-0 flex-1 truncate text-ui-12p5 font-semibold text-foreground">
Loaded models
diff --git a/studio/frontend/src/features/model-picker/components/chat-template-editor-dialog.tsx b/studio/frontend/src/features/model-picker/components/chat-template-editor-dialog.tsx
index 0ee31a08596..2c87e7c2a48 100644
--- a/studio/frontend/src/features/model-picker/components/chat-template-editor-dialog.tsx
+++ b/studio/frontend/src/features/model-picker/components/chat-template-editor-dialog.tsx
@@ -128,7 +128,7 @@ export function ChatTemplateEditorDialog({
setError(null);
}}
readOnly={readOnly}
- className="min-h-[20rem] max-h-[50dvh] overflow-y-auto rounded-none border-0 font-mono text-xs leading-5 focus-visible:ring-0"
+ className="min-h-[min(calc(20rem*var(--ui-space-scale,1)),50dvh)] max-h-[50dvh] overflow-y-auto rounded-none border-0 font-mono text-xs leading-5 focus-visible:ring-0"
rows={14}
spellCheck={false}
placeholder={defaultLoading ? "Loading model default..." : ""}
diff --git a/studio/frontend/src/features/model-picker/components/memory-estimate-row.tsx b/studio/frontend/src/features/model-picker/components/memory-estimate-row.tsx
index c760f65cb98..fb2806bc0de 100644
--- a/studio/frontend/src/features/model-picker/components/memory-estimate-row.tsx
+++ b/studio/frontend/src/features/model-picker/components/memory-estimate-row.tsx
@@ -105,7 +105,7 @@ function MemoryFigure({
ref={buttonRef}
type="button"
aria-label={`${label}: ${value}`}
- className={`relative inline-flex h-8 w-auto min-w-[64px] max-w-full shrink-0 cursor-default! items-center justify-center overflow-hidden rounded-full border-transparent bg-[var(--panel-input-surface)] px-3.5 text-ui-13 font-medium leading-none tabular-nums focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 ${tone ?? "text-foreground"}`}
+ className={`relative inline-flex h-8 w-auto min-w-[calc(64px*var(--ui-space-scale,1))] max-w-full shrink-0 cursor-default! items-center justify-center overflow-hidden rounded-full border-transparent bg-[var(--panel-input-surface)] px-3.5 text-ui-13 font-medium leading-none tabular-nums focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 ${tone ?? "text-foreground"}`}
>
<span aria-hidden="true" className="min-w-0 truncate">
{candidates[displayIndex] ?? value}
diff --git a/studio/frontend/src/features/model-picker/components/model-config-page.tsx b/studio/frontend/src/features/model-picker/components/model-config-page.tsx
index cd6982a7cc7..3075558d5f8 100644
--- a/studio/frontend/src/features/model-picker/components/model-config-page.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-config-page.tsx
@@ -190,7 +190,7 @@ const CONTROL_SURFACE =
"rounded-full border-transparent bg-[var(--panel-input-surface)] hover:bg-[var(--panel-input-surface-hover)] dark:bg-[var(--panel-input-surface)] dark:hover:bg-[var(--panel-input-surface-hover)]";
// One width for every typed field: a box that resized per keystroke would jump under the
// caret. Narrow, so the label beside it is not clipped in a ~240px panel.
-const INPUT_WIDTH_CLASS = "w-[84px] shrink-0";
+const INPUT_WIDTH_CLASS = "w-[calc(84px*var(--ui-space-scale,1))] shrink-0";
// A select holds one of a known set of values, so it sizes to that value.
const SELECT_WIDTH_CLASS = "w-auto max-w-full shrink-0";
// .panel-select-trigger carries the surface, padding and type; this adds the layout.
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 b5167669a7f..f50940b755a 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
@@ -552,7 +552,7 @@ function CapabilityIcons({ caps }: { caps: ModelCapabilities }) {
key={key}
title={title}
aria-label={title}
- className="flex size-[18px] shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground"
+ className="flex size-[calc(18px*var(--ui-space-scale,1))] shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground"
>
<Glyph className="size-3" />
</span>
@@ -608,11 +608,11 @@ function FormatTag({ tone, label }: { tone: FormatTone; label: string }) {
{/* Hit area, so hovering the dot is not a pixel hunt. */}
<span
aria-label={label}
- className="flex size-[14px] shrink-0 items-center justify-center"
+ className="flex size-[calc(14px*var(--ui-space-scale,1))] shrink-0 items-center justify-center"
>
<span
aria-hidden="true"
- className={cn("size-[5px] rounded-full", FORMAT_TONE_DOT[tone])}
+ className={cn("size-[calc(5px*var(--ui-space-scale,1))] rounded-full", FORMAT_TONE_DOT[tone])}
/>
</span>
</TooltipTrigger>
@@ -635,7 +635,7 @@ function DownloadedBadge() {
>
<span
aria-hidden="true"
- className="size-[5px] rounded-full bg-status-success"
+ className="size-[calc(5px*var(--ui-space-scale,1))] rounded-full bg-status-success"
/>
</span>
</TooltipTrigger>
@@ -660,7 +660,7 @@ function PartialBadge({ resumable }: { resumable?: boolean }) {
>
<span
aria-hidden="true"
- className="size-[5px] rounded-full bg-status-warning"
+ className="size-[calc(5px*var(--ui-space-scale,1))] rounded-full bg-status-warning"
/>
</span>
</TooltipTrigger>
@@ -785,7 +785,7 @@ function VramBadge({
event.stopPropagation();
}}
className={cn(
- "flex size-[18px] shrink-0 items-center justify-center",
+ "flex size-[calc(18px*var(--ui-space-scale,1))] shrink-0 items-center justify-center",
verdict.tone,
revealOnHover &&
"opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-visible/row:opacity-100",
@@ -1229,7 +1229,7 @@ function ModelRow({
tone="success"
label="Loaded"
className="ml-2 h-[calc(18px*var(--ui-space-scale,1))] shrink-0 gap-1 rounded-md px-1.5"
- dotClassName="size-[5px]"
+ dotClassName="size-[calc(5px*var(--ui-space-scale,1))]"
/>
)}
{alignMeta !== "device" && quantChip ? (
@@ -1293,7 +1293,7 @@ function ModelRow({
tone="success"
label="Loaded"
className="h-[calc(18px*var(--ui-space-scale,1))] gap-1 rounded-md px-1.5"
- dotClassName="size-[5px]"
+ dotClassName="size-[calc(5px*var(--ui-space-scale,1))]"
/>
)}
{partial ? <PartialBadge resumable={partialResumable} /> : null}
@@ -1408,7 +1408,7 @@ function ModelRow({
connection name stretch the box to 320px, most of it slack beside the model id. */}
<TooltipContent
side="right"
- className="tooltip-compact max-w-[15rem] break-words"
+ className="tooltip-compact max-w-[calc(15rem*var(--ui-space-scale,1))] break-words"
>
{tooltipBody}
</TooltipContent>
@@ -6252,7 +6252,7 @@ export function HubModelPicker({
className={cn(
// The list sits within the menu padding so gaps match; scroll-py and symmetric px keep the
// focus ring off the overflow clip edges during keyboard nav.
- "model-list-scroll max-h-[335px] overflow-y-auto scroll-py-1.5 px-0.5 mr-1",
+ "model-list-scroll max-h-[calc(335px*var(--ui-space-scale,1))] overflow-y-auto scroll-py-1.5 px-0.5 mr-1",
listScrolled && "is-scrolled",
listMoreBelow && "is-bottom-faded",
)}
diff --git a/studio/frontend/src/features/native-intents/components/native-model-chip.tsx b/studio/frontend/src/features/native-intents/components/native-model-chip.tsx
index 40a6362ce01..3f1d4c90562 100644
--- a/studio/frontend/src/features/native-intents/components/native-model-chip.tsx
+++ b/studio/frontend/src/features/native-intents/components/native-model-chip.tsx
@@ -67,7 +67,7 @@ export function NativeModelChip({
}
return (
- <div className="flex min-w-0 max-w-[34rem] items-center gap-2 rounded-lg border border-border/70 bg-muted/70 px-2.5 py-1.5 text-xs">
+ <div className="flex min-w-0 max-w-[calc(34rem*var(--ui-space-scale,1))] items-center gap-2 rounded-lg border border-border/70 bg-muted/70 px-2.5 py-1.5 text-xs">
<span className="shrink-0 font-medium text-muted-foreground">Local GGUF</span>
<span className="min-w-0 flex-1 truncate" title={label}>{label}</span>
<button
diff --git a/studio/frontend/src/features/profile/components/profile-personalization-panel.tsx b/studio/frontend/src/features/profile/components/profile-personalization-panel.tsx
index 84ad6e24b22..e0ae9cb4717 100644
--- a/studio/frontend/src/features/profile/components/profile-personalization-panel.tsx
+++ b/studio/frontend/src/features/profile/components/profile-personalization-panel.tsx
@@ -227,7 +227,7 @@ export function ProfilePersonalizationPanel() {
name={previewName}
imageUrl={shownAvatar}
size="lg"
- className="size-[128px] text-[calc(3.2rem*var(--ui-font-scale,1))]"
+ className="size-[calc(128px*var(--ui-space-scale,1))] text-[calc(3.2rem*var(--ui-font-scale,1))]"
/>
<span className="absolute inset-0 flex items-center justify-center rounded-full bg-black/45 opacity-0 transition-opacity group-hover:opacity-100">
<HugeiconsIcon
@@ -256,7 +256,7 @@ export function ProfilePersonalizationPanel() {
<PopoverContent
align="start"
sideOffset={10}
- className="w-[320px] gap-4 p-4"
+ className="w-[calc(320px*var(--ui-space-scale,1))] gap-4 p-4"
>
<div className="flex items-center justify-between gap-3">
<span className="text-ui-11 font-medium uppercase tracking-wide text-muted-foreground">
diff --git a/studio/frontend/src/features/profile/components/user-avatar.tsx b/studio/frontend/src/features/profile/components/user-avatar.tsx
index 99d7a4f3398..e0df6b0f6c2 100644
--- a/studio/frontend/src/features/profile/components/user-avatar.tsx
+++ b/studio/frontend/src/features/profile/components/user-avatar.tsx
@@ -21,7 +21,7 @@ const SIZE: Record<"sm" | "md" | "lg", string> = {
sm: "size-9 text-xs",
md: "size-11 text-sm",
/** ~10% larger than `size-24` / `text-2xl` for the edit-profile dialog. */
- lg: "size-[106px] text-[calc(1.65rem*var(--ui-font-scale,1))]",
+ lg: "size-[calc(106px*var(--ui-space-scale,1))] text-[calc(1.65rem*var(--ui-font-scale,1))]",
};
// Percentage radius keeps the rounded-rectangle proportional across sizes.
diff --git a/studio/frontend/src/features/rag/components/document-status-chip.tsx b/studio/frontend/src/features/rag/components/document-status-chip.tsx
index ca6907e9b3a..c6feabeb646 100644
--- a/studio/frontend/src/features/rag/components/document-status-chip.tsx
+++ b/studio/frontend/src/features/rag/components/document-status-chip.tsx
@@ -51,7 +51,7 @@ export function DocumentStatusChip({
: filename)
}
className={cn(
- "rounded-full inline-flex items-center gap-1.5 max-w-[16rem]",
+ "rounded-full inline-flex items-center gap-1.5 max-w-[calc(16rem*var(--ui-space-scale,1))]",
status === "failed" && "border-destructive/40 text-destructive",
)}
>
diff --git a/studio/frontend/src/features/rag/components/knowledge-base-composer-button.tsx b/studio/frontend/src/features/rag/components/knowledge-base-composer-button.tsx
index 5b8df08b1bc..f16aa0bf947 100644
--- a/studio/frontend/src/features/rag/components/knowledge-base-composer-button.tsx
+++ b/studio/frontend/src/features/rag/components/knowledge-base-composer-button.tsx
@@ -113,12 +113,12 @@ export function KnowledgeBaseComposerButton({
<HugeiconsIcon
icon={FileDatabaseIcon}
strokeWidth={2}
- className="size-[15px]"
+ className="size-[calc(15px*var(--ui-space-scale,1))]"
/>
<XIcon className="composer-pill-x" />
</span>
<span>RAG</span>
- <ChevronDownIcon strokeWidth={1.5} className="composer-pill-caret size-[15px]" />
+ <ChevronDownIcon strokeWidth={1.5} className="composer-pill-caret size-[calc(15px*var(--ui-space-scale,1))]" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent
@@ -126,7 +126,7 @@ export function KnowledgeBaseComposerButton({
align="start"
sideOffset={2}
avoidCollisions={true}
- className="unsloth-plus-menu mcp-menu w-[232px]"
+ className="unsloth-plus-menu mcp-menu w-[calc(232px*var(--ui-space-scale,1))]"
>
<DropdownMenuLabel>Retrieve from</DropdownMenuLabel>
<DropdownMenuItem
diff --git a/studio/frontend/src/features/rag/components/knowledge-base-dialog.tsx b/studio/frontend/src/features/rag/components/knowledge-base-dialog.tsx
index 761767ebe78..967365e2ba5 100644
--- a/studio/frontend/src/features/rag/components/knowledge-base-dialog.tsx
+++ b/studio/frontend/src/features/rag/components/knowledge-base-dialog.tsx
@@ -231,7 +231,7 @@ export function KnowledgeBaseDialog({
disabled={ragUnavailable}
title={ragUnavailableHint}
>
- <HugeiconsIcon icon={PlusSignIcon} size={14} />
+ <HugeiconsIcon icon={PlusSignIcon} className="size-3.5" />
New knowledge base
</Button>
</div>
@@ -275,7 +275,7 @@ export function KnowledgeBaseDialog({
onClick={() => startEdit(kb)}
aria-label="Rename knowledge base"
>
- <HugeiconsIcon icon={Edit03Icon} size={14} />
+ <HugeiconsIcon icon={Edit03Icon} className="size-3.5" />
</Button>
<Button
type="button"
@@ -284,7 +284,7 @@ export function KnowledgeBaseDialog({
onClick={() => setConfirmingDelete(kb)}
aria-label="Delete knowledge base"
>
- <HugeiconsIcon icon={Delete02Icon} size={14} />
+ <HugeiconsIcon icon={Delete02Icon} className="size-3.5" />
</Button>
</div>
</li>
diff --git a/studio/frontend/src/features/recipe-studio/components/executions/execution-overview-tab.tsx b/studio/frontend/src/features/recipe-studio/components/executions/execution-overview-tab.tsx
index fd9d743e17c..80c4a10c63f 100644
--- a/studio/frontend/src/features/recipe-studio/components/executions/execution-overview-tab.tsx
+++ b/studio/frontend/src/features/recipe-studio/components/executions/execution-overview-tab.tsx
@@ -194,7 +194,7 @@ export function ExecutionOverviewTab({
<TableBody>
{modelUsageRows.map((usage) => (
<TableRow key={usage.model}>
- <TableCell className="max-w-[320px] truncate">{usage.model}</TableCell>
+ <TableCell className="max-w-[calc(320px*var(--ui-space-scale,1))] truncate">{usage.model}</TableCell>
<TableCell className="text-right">
{formatMetricValue(usage.input)}
</TableCell>
diff --git a/studio/frontend/src/features/recipe-studio/components/executions/executions-view.tsx b/studio/frontend/src/features/recipe-studio/components/executions/executions-view.tsx
index 77800a005a6..544b812575b 100644
--- a/studio/frontend/src/features/recipe-studio/components/executions/executions-view.tsx
+++ b/studio/frontend/src/features/recipe-studio/components/executions/executions-view.tsx
@@ -167,7 +167,7 @@ export function ExecutionsView({
src={imagePreview.src}
alt={`${name} preview`}
loading="lazy"
- className="h-24 w-auto max-w-[260px] rounded-md border border-border/60 bg-muted/20 object-contain"
+ className="h-24 w-auto max-w-[calc(260px*var(--ui-space-scale,1))] rounded-md border border-border/60 bg-muted/20 object-contain"
/>
</div>
);
@@ -182,7 +182,7 @@ export function ExecutionsView({
const value = formatCellValue(rawValue);
const isWide = wideColumns.has(name);
return (
- <div className={cn(isWide ? "min-w-[48rem]" : "min-w-[12rem]")}>
+ <div className={cn(isWide ? "min-w-[calc(48rem*var(--ui-space-scale,1))]" : "min-w-[calc(12rem*var(--ui-space-scale,1))]")}>
<p className="whitespace-pre-wrap break-all">{value}</p>
</div>
);
diff --git a/studio/frontend/src/features/recipe-studio/components/recipe-graph-aux-node.tsx b/studio/frontend/src/features/recipe-studio/components/recipe-graph-aux-node.tsx
index 045f91db56a..8b3676874a8 100644
--- a/studio/frontend/src/features/recipe-studio/components/recipe-graph-aux-node.tsx
+++ b/studio/frontend/src/features/recipe-studio/components/recipe-graph-aux-node.tsx
@@ -138,7 +138,7 @@ function AuxNodeBase({
</BaseNodeHeader>
<BaseNodeContent className="gap-2 px-3 py-2">
<Textarea
- className="corner-squircle nodrag nowheel max-h-40 min-h-[88px] w-full resize-none overflow-y-auto text-xs"
+ className="corner-squircle nodrag nowheel max-h-40 min-h-[calc(88px*var(--ui-space-scale,1))] w-full resize-none overflow-y-auto text-xs"
aria-invalid={hasInvalidRefs}
value={value}
disabled={executionLocked}
diff --git a/studio/frontend/src/features/recipe-studio/components/recipe-studio-header.tsx b/studio/frontend/src/features/recipe-studio/components/recipe-studio-header.tsx
index b8bf0c0d6f8..319dbbcaa8c 100644
--- a/studio/frontend/src/features/recipe-studio/components/recipe-studio-header.tsx
+++ b/studio/frontend/src/features/recipe-studio/components/recipe-studio-header.tsx
@@ -122,7 +122,7 @@ export function RecipeStudioHeader({
{STATUS_MESSAGE_CLASS[saveTone]}
</Badge>
<span
- className="hidden max-w-[12rem] truncate text-xs text-muted-foreground sm:inline"
+ className="hidden max-w-[calc(12rem*var(--ui-space-scale,1))] truncate text-xs text-muted-foreground sm:inline"
title={savedAtLabel}
>
{savedAtLabel}
diff --git a/studio/frontend/src/features/recipe-studio/components/runtime/execution-progress-island.tsx b/studio/frontend/src/features/recipe-studio/components/runtime/execution-progress-island.tsx
index 1ebdda367f9..47313098098 100644
--- a/studio/frontend/src/features/recipe-studio/components/runtime/execution-progress-island.tsx
+++ b/studio/frontend/src/features/recipe-studio/components/runtime/execution-progress-island.tsx
@@ -133,7 +133,7 @@ export function ExecutionProgressIsland({
<div
className={cn(
"w-[clamp(15rem,26vw,20rem)] max-w-[calc(100vw-1rem)] rounded-b-xl border-x border-b bg-card/96 shadow-sm backdrop-blur-sm transition-all",
- minimized ? "min-h-[calc(3rem*var(--ui-space-scale,1))]" : "min-h-[8.5rem]",
+ minimized ? "min-h-[calc(3rem*var(--ui-space-scale,1))]" : "min-h-[calc(8.5rem*var(--ui-space-scale,1))]",
)}
aria-live="polite"
>
diff --git a/studio/frontend/src/features/recipe-studio/dialogs/config-dialog.tsx b/studio/frontend/src/features/recipe-studio/dialogs/config-dialog.tsx
index c62169956d4..71d170de2b6 100644
--- a/studio/frontend/src/features/recipe-studio/dialogs/config-dialog.tsx
+++ b/studio/frontend/src/features/recipe-studio/dialogs/config-dialog.tsx
@@ -56,7 +56,7 @@ export function ConfigDialog({
position="absolute"
overlayPosition="absolute"
overlayClassName="bg-transparent"
- className="corner-squircle max-h-[650px] overflow-y-auto overflow-x-hidden sm:max-w-2xl shadow-border"
+ className="corner-squircle max-h-[min(calc(650px*var(--ui-space-scale,1)),calc(100dvh-var(--studio-window-chrome-top,0px)-2rem))] overflow-y-auto overflow-x-hidden sm:max-w-2xl shadow-border"
>
<DialogShell
title={blockDefinition ? blockDefinition.title : undefined}
diff --git a/studio/frontend/src/features/recipe-studio/dialogs/import-dialog.tsx b/studio/frontend/src/features/recipe-studio/dialogs/import-dialog.tsx
index 89f08db20cd..f392846190a 100644
--- a/studio/frontend/src/features/recipe-studio/dialogs/import-dialog.tsx
+++ b/studio/frontend/src/features/recipe-studio/dialogs/import-dialog.tsx
@@ -53,7 +53,7 @@ export function ImportDialog({
position="absolute"
overlayPosition="absolute"
overlayClassName="bg-transparent"
- className="corner-squircle max-h-[650px] overflow-auto sm:max-w-2xl shadow-border"
+ className="corner-squircle max-h-[min(calc(650px*var(--ui-space-scale,1)),calc(100dvh-var(--studio-window-chrome-top,0px)-2rem))] overflow-auto sm:max-w-2xl shadow-border"
>
<DialogHeader>
<DialogTitle>Import recipe</DialogTitle>
@@ -66,7 +66,7 @@ export function ImportDialog({
/>
<Textarea
id={payloadId}
- className="corner-squircle nodrag min-h-[220px] max-h-[450px]"
+ className="corner-squircle nodrag min-h-[calc(220px*var(--ui-space-scale,1))] max-h-[calc(450px*var(--ui-space-scale,1))]"
placeholder='{"recipe": { "columns": [] }}'
value={value}
onChange={(event) => setValue(event.target.value)}
diff --git a/studio/frontend/src/features/recipe-studio/dialogs/llm/general-tab.tsx b/studio/frontend/src/features/recipe-studio/dialogs/llm/general-tab.tsx
index 2b288d0dc77..0e61b06ccf8 100644
--- a/studio/frontend/src/features/recipe-studio/dialogs/llm/general-tab.tsx
+++ b/studio/frontend/src/features/recipe-studio/dialogs/llm/general-tab.tsx
@@ -334,7 +334,7 @@ export function LlmGeneralTab({
/>
<Textarea
id={promptId}
- className="corner-squircle nodrag max-h-[450px] overflow-auto"
+ className="corner-squircle nodrag max-h-[calc(450px*var(--ui-space-scale,1))] overflow-auto"
aria-invalid={invalidPromptRefs.length > 0}
value={config.prompt}
onChange={(event) => onUpdate({ prompt: event.target.value })}
@@ -448,7 +448,7 @@ export function LlmGeneralTab({
/>
<Textarea
id={systemPromptId}
- className="corner-squircle nodrag max-h-[450px] overflow-auto"
+ className="corner-squircle nodrag max-h-[calc(450px*var(--ui-space-scale,1))] overflow-auto"
aria-invalid={invalidSystemRefs.length > 0}
value={config.system_prompt}
onChange={(event) =>
diff --git a/studio/frontend/src/features/recipe-studio/dialogs/markdown-note/markdown-note-dialog.tsx b/studio/frontend/src/features/recipe-studio/dialogs/markdown-note/markdown-note-dialog.tsx
index f4683549561..fbb2ba170be 100644
--- a/studio/frontend/src/features/recipe-studio/dialogs/markdown-note/markdown-note-dialog.tsx
+++ b/studio/frontend/src/features/recipe-studio/dialogs/markdown-note/markdown-note-dialog.tsx
@@ -66,7 +66,7 @@ export function MarkdownNoteDialog({
/>
<Textarea
id={markdownId}
- className="corner-squircle nodrag min-h-[180px]"
+ className="corner-squircle nodrag min-h-[calc(180px*var(--ui-space-scale,1))]"
placeholder="## Note"
value={config.markdown}
onChange={(event) => onUpdate({ markdown: event.target.value })}
diff --git a/studio/frontend/src/features/recipe-studio/dialogs/preview-dialog.tsx b/studio/frontend/src/features/recipe-studio/dialogs/preview-dialog.tsx
index f2ef34df8c6..77855927fd3 100644
--- a/studio/frontend/src/features/recipe-studio/dialogs/preview-dialog.tsx
+++ b/studio/frontend/src/features/recipe-studio/dialogs/preview-dialog.tsx
@@ -717,7 +717,7 @@ export function RunDialog({
position="absolute"
overlayPosition="absolute"
overlayClassName="bg-transparent"
- className="corner-squircle max-h-[650px] overflow-y-auto overflow-x-hidden border-border/70 bg-background/95 sm:max-w-2xl shadow-border backdrop-blur-xl"
+ className="corner-squircle max-h-[min(calc(650px*var(--ui-space-scale,1)),calc(100dvh-var(--studio-window-chrome-top,0px)-2rem))] overflow-y-auto overflow-x-hidden border-border/70 bg-background/95 sm:max-w-2xl shadow-border backdrop-blur-xl"
>
<RunDialogBody
key={draftKey}
diff --git a/studio/frontend/src/features/recipe-studio/dialogs/processors-dialog.tsx b/studio/frontend/src/features/recipe-studio/dialogs/processors-dialog.tsx
index 4e96c5803fe..15d89f5aac4 100644
--- a/studio/frontend/src/features/recipe-studio/dialogs/processors-dialog.tsx
+++ b/studio/frontend/src/features/recipe-studio/dialogs/processors-dialog.tsx
@@ -71,7 +71,7 @@ export function ProcessorsDialog({
position="absolute"
overlayPosition="absolute"
overlayClassName="bg-transparent"
- className="corner-squircle max-h-[650px] overflow-auto sm:max-w-2xl shadow-border"
+ className="corner-squircle max-h-[min(calc(650px*var(--ui-space-scale,1)),calc(100dvh-var(--studio-window-chrome-top,0px)-2rem))] overflow-auto sm:max-w-2xl shadow-border"
>
<VisuallyHidden.Root>
<DialogTitle>Processors</DialogTitle>
@@ -114,7 +114,7 @@ export function ProcessorsDialog({
/>
<Textarea
id={templateId}
- className="corner-squircle nodrag min-h-[220px]"
+ className="corner-squircle nodrag min-h-[calc(220px*var(--ui-space-scale,1))]"
value={schemaProcessor.template}
onChange={(event) =>
updateSchema({ template: event.target.value })
diff --git a/studio/frontend/src/features/recipe-studio/dialogs/seed/seed-dialog.tsx b/studio/frontend/src/features/recipe-studio/dialogs/seed/seed-dialog.tsx
index f21c3c059c1..dd4e1231acf 100644
--- a/studio/frontend/src/features/recipe-studio/dialogs/seed/seed-dialog.tsx
+++ b/studio/frontend/src/features/recipe-studio/dialogs/seed/seed-dialog.tsx
@@ -1324,7 +1324,7 @@ export function SeedDialog({
<div className="text-xs text-muted-foreground">
Loaded columns: {previewColumns.join(", ") || "None"}
</div>
- <div className="max-h-[360px] overflow-y-auto overflow-x-hidden rounded-xl corner-squircle border border-border/60">
+ <div className="max-h-[calc(360px*var(--ui-space-scale,1))] overflow-y-auto overflow-x-hidden rounded-xl corner-squircle border border-border/60">
<Table className="corner-squircle min-w-max">
<TableHeader>
<TableRow>
@@ -1358,7 +1358,7 @@ export function SeedDialog({
{previewColumns.map((col) => (
<TableCell
key={`${rowIdx}-${col}`}
- className="max-w-[260px] whitespace-pre-wrap break-words text-xs"
+ className="max-w-[calc(260px*var(--ui-space-scale,1))] whitespace-pre-wrap break-words text-xs"
>
{(() => {
const imagePreview = resolveImagePreview(
@@ -1370,7 +1370,7 @@ export function SeedDialog({
src={imagePreview.src}
alt={`${col} preview`}
loading="lazy"
- className="h-20 w-auto max-w-[220px] rounded-md border border-border/60 bg-muted/20 object-contain"
+ className="h-20 w-auto max-w-[calc(220px*var(--ui-space-scale,1))] rounded-md border border-border/60 bg-muted/20 object-contain"
/>
);
}
diff --git a/studio/frontend/src/features/security/components/remote-code-consent-dialog.tsx b/studio/frontend/src/features/security/components/remote-code-consent-dialog.tsx
index 69bab2156ed..bea586b138a 100644
--- a/studio/frontend/src/features/security/components/remote-code-consent-dialog.tsx
+++ b/studio/frontend/src/features/security/components/remote-code-consent-dialog.tsx
@@ -266,7 +266,7 @@ export function RemoteCodeConsentDialog() {
<p className="text-xs font-medium text-muted-foreground">
Our automatic scanner flagged issues including:
</p>
- <div className="max-h-[14rem] min-w-0 space-y-2 overflow-y-auto pr-1">
+ <div className="max-h-[calc(14rem*var(--ui-space-scale,1))] min-w-0 space-y-2 overflow-y-auto pr-1">
{unsafeFiles.map((f, i) => (
<UnsafeFileCard key={`${f.path}-${i}`} file={f} />
))}
@@ -279,7 +279,7 @@ export function RemoteCodeConsentDialog() {
<p className="text-xs font-medium text-muted-foreground">
Our automatic scanner flagged issues including:
</p>
- <div className="max-h-[22rem] min-w-0 space-y-3 overflow-y-auto pr-1">
+ <div className="max-h-[calc(22rem*var(--ui-space-scale,1))] min-w-0 space-y-3 overflow-y-auto pr-1">
{findings.map((f, i) => (
<FindingCard key={i} finding={f} />
))}
diff --git a/studio/frontend/src/features/settings/components/appearance-custom-controls.tsx b/studio/frontend/src/features/settings/components/appearance-custom-controls.tsx
index b57afa12ef1..31aff643a45 100644
--- a/studio/frontend/src/features/settings/components/appearance-custom-controls.tsx
+++ b/studio/frontend/src/features/settings/components/appearance-custom-controls.tsx
@@ -942,7 +942,7 @@ export function ContrastSliderRow() {
step={1}
onChange={(value) => patch({ contrast: value })}
ariaLabel={t("settings.appearance.custom.contrast.label")}
- className="panel-field h-8 w-[84px] shrink-0"
+ className="panel-field h-8 w-[calc(84px*var(--ui-space-scale,1))] shrink-0"
fixedWidth={true}
size={4}
/>
diff --git a/studio/frontend/src/features/settings/components/create-key-form.tsx b/studio/frontend/src/features/settings/components/create-key-form.tsx
index a16f67f1c13..09af929f002 100644
--- a/studio/frontend/src/features/settings/components/create-key-form.tsx
+++ b/studio/frontend/src/features/settings/components/create-key-form.tsx
@@ -51,7 +51,7 @@ export function CreateKeyForm({
value={name}
onChange={(e) => setName(e.target.value)}
placeholder={t("settings.apiKeys.tokenNamePlaceholder")}
- className="h-9 min-w-[200px] flex-1 text-sm"
+ className="h-9 min-w-[calc(200px*var(--ui-space-scale,1))] flex-1 text-sm"
aria-label={t("settings.apiKeys.newAccessTokenName")}
/>
<div className="hub-tab-toggle inline-flex h-8 items-center rounded-full">
diff --git a/studio/frontend/src/features/settings/components/documents-rag-section.tsx b/studio/frontend/src/features/settings/components/documents-rag-section.tsx
index 60bfdfe946d..dfda5fbad67 100644
--- a/studio/frontend/src/features/settings/components/documents-rag-section.tsx
+++ b/studio/frontend/src/features/settings/components/documents-rag-section.tsx
@@ -362,10 +362,10 @@ export function DocumentsRagSection(): ReactElement {
accessToken={hfToken || undefined}
disabled={!embeddingModel}
busy={isSavingEmbeddingModel}
- className="w-[260px] max-[360px]:w-full"
+ className="w-[calc(260px*var(--ui-space-scale,1))] max-[360px]:w-full"
/>
{embeddingModelError ? (
- <span className="max-w-[300px] text-right text-xs text-destructive">
+ <span className="max-w-[calc(300px*var(--ui-space-scale,1))] text-right text-xs text-destructive">
{embeddingModelError}
</span>
) : null}
@@ -420,7 +420,7 @@ export function DocumentsRagSection(): ReactElement {
</Button>
) : null}
</div>
- <span className="max-w-[300px] text-right text-xs text-muted-foreground">
+ <span className="max-w-[calc(300px*var(--ui-space-scale,1))] text-right text-xs text-muted-foreground">
{t("settings.general.rag.reindexWarning")}
</span>
</div>
diff --git a/studio/frontend/src/features/settings/components/download-transport-row.tsx b/studio/frontend/src/features/settings/components/download-transport-row.tsx
index 47a3aef4fff..cca6abe8366 100644
--- a/studio/frontend/src/features/settings/components/download-transport-row.tsx
+++ b/studio/frontend/src/features/settings/components/download-transport-row.tsx
@@ -148,7 +148,7 @@ export function DownloadTransportRow() {
<TooltipContent
side="bottom"
sideOffset={6}
- className="max-w-[260px]"
+ className="max-w-[calc(260px*var(--ui-space-scale,1))]"
>
{disabled && !capabilityPending
? xetReason
@@ -163,14 +163,14 @@ export function DownloadTransportRow() {
})}
</div>
{status ? (
- <span className="max-w-[280px] text-right text-xs text-muted-foreground">
+ <span className="max-w-[calc(280px*var(--ui-space-scale,1))] text-right text-xs text-muted-foreground">
{status}
</span>
) : null}
{statusReason ? (
<span
lang="en"
- className="max-w-[280px] text-right text-xs text-muted-foreground/70"
+ className="max-w-[calc(280px*var(--ui-space-scale,1))] text-right text-xs text-muted-foreground/70"
>
{statusReason}
</span>
diff --git a/studio/frontend/src/features/settings/components/embedding-model-picker.tsx b/studio/frontend/src/features/settings/components/embedding-model-picker.tsx
index 68f91b440c3..62acb35ea76 100644
--- a/studio/frontend/src/features/settings/components/embedding-model-picker.tsx
+++ b/studio/frontend/src/features/settings/components/embedding-model-picker.tsx
@@ -221,7 +221,7 @@ export function EmbeddingModelPicker({
// unannounced. Same role the Hub's own on-device dot carries.
role="img"
aria-label={t("settings.general.rag.onDevice")}
- className="size-[5px] shrink-0 rounded-full bg-status-success"
+ className="size-[calc(5px*var(--ui-space-scale,1))] shrink-0 rounded-full bg-status-success"
/>
) : null}
<span className="truncate font-mono text-ui-11">
diff --git a/studio/frontend/src/features/settings/components/llama-backend-section.tsx b/studio/frontend/src/features/settings/components/llama-backend-section.tsx
index 01f1b1de7dd..00d36089cce 100644
--- a/studio/frontend/src/features/settings/components/llama-backend-section.tsx
+++ b/studio/frontend/src/features/settings/components/llama-backend-section.tsx
@@ -119,7 +119,7 @@ function LlamaCppPathRow({ onChanged }: { onChanged: () => void }) {
hint={t("settings.resources.llamaBackend.customPath.hint")}
className="max-[840px]:flex-col max-[840px]:items-stretch max-[840px]:gap-2"
>
- <div className="grid w-[392px] min-w-0 grid-cols-[minmax(0,1fr)_auto_auto] gap-x-2 gap-y-1.5 max-[840px]:w-full">
+ <div className="grid w-[calc(392px*var(--ui-space-scale,1))] min-w-0 grid-cols-[minmax(0,1fr)_auto_auto] gap-x-2 gap-y-1.5 max-[840px]:w-full">
<Input
readOnly={!settings?.editable}
aria-label={t("settings.resources.llamaBackend.customPath.label")}
diff --git a/studio/frontend/src/features/settings/components/model-auto-switch-section.tsx b/studio/frontend/src/features/settings/components/model-auto-switch-section.tsx
index dc53380e527..79103cadfed 100644
--- a/studio/frontend/src/features/settings/components/model-auto-switch-section.tsx
+++ b/studio/frontend/src/features/settings/components/model-auto-switch-section.tsx
@@ -78,11 +78,11 @@ function MediaIdleUnloadRow({
</Button>
</div>
{error ? (
- <span className="max-w-[260px] text-right text-xs text-destructive">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-destructive">
{error}
</span>
) : paused ? (
- <span className="max-w-[260px] text-right text-xs text-muted-foreground">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-muted-foreground">
{t("settings.general.modelAutoSwitch.mediaIdlePaused")}
</span>
) : null}
@@ -301,15 +301,15 @@ export function ModelAutoSwitchSection() {
</Button>
</div>
{error ? (
- <span className="max-w-[260px] text-right text-xs text-destructive">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-destructive">
{error}
</span>
) : settings && !settings.enabled && settings.idleUnloadActive ? (
- <span className="max-w-[260px] text-right text-xs text-muted-foreground">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-muted-foreground">
{t("settings.general.modelAutoSwitch.idleActiveViaEnv")}
</span>
) : settings && !settings.enabled ? (
- <span className="max-w-[260px] text-right text-xs text-muted-foreground">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-muted-foreground">
{t("settings.general.modelAutoSwitch.idleNeedsEnable")}
</span>
) : null}
diff --git a/studio/frontend/src/features/settings/components/settings-row.tsx b/studio/frontend/src/features/settings/components/settings-row.tsx
index ec5d2561e65..9101a613b36 100644
--- a/studio/frontend/src/features/settings/components/settings-row.tsx
+++ b/studio/frontend/src/features/settings/components/settings-row.tsx
@@ -50,7 +50,7 @@ export function SettingsRow({
<div
className={cn(
// Widest floor that leaves already-fitting rows unchanged.
- "flex min-w-[11rem] flex-1 basis-0 gap-2.5",
+ "flex min-w-[calc(11rem*var(--ui-space-scale,1))] flex-1 basis-0 gap-2.5",
alignTop ? "items-start" : "items-center",
)}
>
@@ -89,7 +89,7 @@ export function SettingsRow({
/>
</button>
</TooltipTrigger>
- <TooltipContent className="max-w-[300px] text-ui-11 leading-snug">
+ <TooltipContent className="max-w-[calc(300px*var(--ui-space-scale,1))] text-ui-11 leading-snug">
{hint}
</TooltipContent>
</Tooltip>
diff --git a/studio/frontend/src/features/settings/components/uploaded-files-dialog.tsx b/studio/frontend/src/features/settings/components/uploaded-files-dialog.tsx
index f03e2381833..6a0b4bc6b49 100644
--- a/studio/frontend/src/features/settings/components/uploaded-files-dialog.tsx
+++ b/studio/frontend/src/features/settings/components/uploaded-files-dialog.tsx
@@ -585,7 +585,7 @@ export function UploadedFilesView() {
<span className="flex min-w-0 items-center gap-2">
{/* Floor keeps the name visible when the chip and fixed
columns squeeze the cell at narrow widths. */}
- <span className="min-w-[3.5rem] truncate underline-offset-2 group-hover/name:underline">
+ <span className="min-w-[calc(3.5rem*var(--ui-space-scale,1))] truncate underline-offset-2 group-hover/name:underline">
{row.name}
</span>
{row.typeLabel ? (
diff --git a/studio/frontend/src/features/settings/components/usage-examples.tsx b/studio/frontend/src/features/settings/components/usage-examples.tsx
index e246186edbb..17ef0eb91b0 100644
--- a/studio/frontend/src/features/settings/components/usage-examples.tsx
+++ b/studio/frontend/src/features/settings/components/usage-examples.tsx
@@ -893,7 +893,7 @@ export function UsageExamples({
/>
</button>
</TooltipTrigger>
- <TooltipContent className="max-w-[260px] text-ui-11 leading-snug">
+ <TooltipContent className="max-w-[calc(260px*var(--ui-space-scale,1))] text-ui-11 leading-snug">
{t("settings.apiKeys.secureHttpsHint")}
</TooltipContent>
</Tooltip>
diff --git a/studio/frontend/src/features/settings/settings-dialog.tsx b/studio/frontend/src/features/settings/settings-dialog.tsx
index 42e640ac41f..c5d66f215b7 100644
--- a/studio/frontend/src/features/settings/settings-dialog.tsx
+++ b/studio/frontend/src/features/settings/settings-dialog.tsx
@@ -15,6 +15,7 @@ import { type TranslationKey, useT } from "@/i18n";
import { isTauri } from "@/lib/api-base";
import { MicIcon } from "@/lib/mic-icon";
import { cn } from "@/lib/utils";
+import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";
import { scheduleIdleTask } from "@/lib/schedule-idle-task";
import {
BotIcon,
@@ -47,6 +48,7 @@ import {
useMemo,
useRef,
useState,
+ useSyncExternalStore,
} from "react";
import {
SETTINGS_SEARCH_KEYWORDS,
@@ -262,9 +264,30 @@ const SETTINGS_SEARCH_INDEX = createSettingsSearchIndex({
clientPlatform.includes("linux")),
});
+/**
+ * Stack the tab rail over the pane when the dialog is narrower than it is at
+ * sm (608px, 640px less its 2rem margin) scaled by the UI. At 100% that is
+ * max-sm exactly; at 200% the 960px cap is always too narrow.
+ */
+function useStackedLayout(): boolean {
+ const width = 608 * useUiSpaceScale();
+ const query = `(width < ${width + 32}px)`;
+ const narrow = useSyncExternalStore(
+ (onChange) => {
+ const list = window.matchMedia(query);
+ list.addEventListener("change", onChange);
+ return () => list.removeEventListener("change", onChange);
+ },
+ () => window.matchMedia(query).matches,
+ () => false,
+ );
+ return width > 960 || narrow;
+}
+
export function SettingsDialog() {
const t = useT();
const isOwner = useIsAccountOwner();
+ const stacked = useStackedLayout();
const visibleTabs = useMemo(() => TABS.filter((tab) => settingsTabVisible(tab.id, isOwner)), [isOwner]);
const open = useSettingsDialogStore((s) => s.open);
const requestedTab = useSettingsDialogStore((s) => s.activeTab);
@@ -465,11 +488,14 @@ export function SettingsDialog() {
{t("settings.dialog.description")}
</DialogDescription>
{/* Keep tab content from expanding the dialog grid. */}
- <div className="flex h-full min-h-0 min-w-0 w-full max-sm:flex-col">
+ <div
+ data-stacked={stacked || undefined}
+ className="group/settings flex h-full min-h-0 min-w-0 w-full data-stacked:flex-col"
+ >
{/* Match the app shell: tabs on the sidebar fill, content on the
page fill, so both track the active palette. */}
- <aside className="font-heading flex w-[248px] shrink-0 flex-col border-r border-sidebar-border bg-sidebar text-sidebar-foreground p-2 dark:border-r-0 max-sm:w-full max-sm:border-r-0 max-sm:border-b max-sm:border-sidebar-border">
- <div className="relative mx-1 mt-3 mb-2 shrink-0 max-sm:hidden">
+ <aside className="font-heading flex w-[min(calc(248px*var(--ui-space-scale,1)),50%)] shrink-0 flex-col border-r border-sidebar-border bg-sidebar text-sidebar-foreground p-2 dark:border-r-0 group-data-stacked/settings:w-full group-data-stacked/settings:border-r-0 group-data-stacked/settings:border-b group-data-stacked/settings:border-sidebar-border">
+ <div className="relative mx-1 mt-3 mb-2 shrink-0 group-data-stacked/settings:hidden">
<HugeiconsIcon
icon={Search01Icon}
strokeWidth={2}
@@ -500,7 +526,7 @@ export function SettingsDialog() {
)}
</div>
{results ? (
- <div className="hover-scrollbar flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto px-1 py-1 max-sm:hidden">
+ <div className="hover-scrollbar flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto px-1 py-1 group-data-stacked/settings:hidden">
{results.length === 0 ? (
<p className="px-3 py-2 text-sm text-muted-foreground">
{t("settings.dialog.searchNoResults")}
@@ -541,7 +567,7 @@ export function SettingsDialog() {
) : null}
<p
className={cn(
- "shrink-0 pl-4 pt-3 pb-2.5 text-ui-13 font-medium text-muted-foreground max-sm:hidden",
+ "shrink-0 pl-4 pt-3 pb-2.5 text-ui-13 font-medium text-muted-foreground group-data-stacked/settings:hidden",
results !== null && "hidden",
)}
>
@@ -553,8 +579,8 @@ export function SettingsDialog() {
// leaves it taller than the sidebar, and the dialog clips its
// overflow, so scroll it rather than losing the last tabs.
"hover-scrollbar flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-1 py-1",
- "max-sm:flex-none max-sm:flex-row max-sm:overflow-x-auto max-sm:py-0",
- results !== null && "max-sm:flex hidden",
+ "group-data-stacked/settings:flex-none group-data-stacked/settings:flex-row group-data-stacked/settings:overflow-x-auto group-data-stacked/settings:py-0",
+ results !== null && "group-data-stacked/settings:flex hidden",
)}
>
{visibleTabs.map((tab) => {
diff --git a/studio/frontend/src/features/settings/settings-search.ts b/studio/frontend/src/features/settings/settings-search.ts
index 64e409b9faf..9046132e6ca 100644
--- a/studio/frontend/src/features/settings/settings-search.ts
+++ b/studio/frontend/src/features/settings/settings-search.ts
@@ -69,6 +69,7 @@ export const SETTINGS_SEARCH_INDEX: Record<SettingsTab, TranslationKey[]> = {
"settings.appearance.custom.pointerCursors.label",
"settings.appearance.custom.reduceMotion.label",
"settings.appearance.custom.uiFontSize.label",
+ "settings.appearance.custom.interfaceScale.label",
"settings.appearance.custom.codeFontSize.label",
"settings.appearance.custom.fontSmoothing.label",
"settings.appearance.layout.compactSidebar",
@@ -287,10 +288,6 @@ export function createSettingsSearchIndex({
// and searching Settings for "repair" answered "No settings found."
"settings.general.repairInstall.label",
],
- appearance: [
- ...SETTINGS_SEARCH_INDEX.appearance,
- "settings.appearance.custom.interfaceScale.label",
- ],
about: SETTINGS_SEARCH_INDEX.about.filter(
(key) => key !== "settings.about.updates",
),
diff --git a/studio/frontend/src/features/settings/stores/appearance-custom-store.ts b/studio/frontend/src/features/settings/stores/appearance-custom-store.ts
index 73f417bb411..de9f3d777dd 100644
--- a/studio/frontend/src/features/settings/stores/appearance-custom-store.ts
+++ b/studio/frontend/src/features/settings/stores/appearance-custom-store.ts
@@ -928,14 +928,16 @@ export function applyCustomizationToDocument(
const effectiveUiFontSize = c.uiFontSize ?? UI_FONT_SIZE_RANGE.default;
if (effectiveUiFontSize !== UI_FONT_SIZE_RANGE.default) {
setVar(
- "--ui-font-scale",
+ "--ui-font-size-scale",
String(effectiveUiFontSize / UI_FONT_SIZE_CSS_BASE),
);
el.setAttribute("data-ui-font-size", String(effectiveUiFontSize));
} else {
- setVar("--ui-font-scale", null);
+ setVar("--ui-font-size-scale", null);
el.removeAttribute("data-ui-font-size");
}
+ // index.css derives --ui-font-scale; clear the value older builds wrote.
+ setVar("--ui-font-scale", null);
// Older builds scaled the root font size directly; clear any stale inline
// value so layout never scales with the preference again.
style.removeProperty("font-size");
diff --git a/studio/frontend/src/features/settings/stores/interface-scale-store.ts b/studio/frontend/src/features/settings/stores/interface-scale-store.ts
index 80d3b146bfa..59e97210267 100644
--- a/studio/frontend/src/features/settings/stores/interface-scale-store.ts
+++ b/studio/frontend/src/features/settings/stores/interface-scale-store.ts
@@ -2,6 +2,7 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import { isTauri } from "@/lib/api-base";
+import { setLayoutScale } from "@/lib/layout-scale";
import { create } from "zustand";
import {
type StateStorage,
@@ -94,8 +95,30 @@ let appliedInterfaceScale: number | null = null;
let requestedInterfaceScale: number = INTERFACE_SCALE_RANGE.default;
let interfaceScaleApplicationQueue = Promise.resolve();
+/** Browser-only multiplier on --ui-font-scale; spacing and icons follow. */
+export const INTERFACE_SCALE_VAR = "--ui-interface-scale";
+
+/**
+ * The browser scales through the UI tokens, not CSS `zoom`: root zoom inflates
+ * viewport units (a 100dvh shell overflows at 125%).
+ */
+function applyWebInterfaceScale(scale: number): void {
+ if (typeof document === "undefined") return;
+ const zoom = interfaceScaleToZoom(scale);
+ setLayoutScale(zoom);
+ const style = document.documentElement.style;
+ if (zoom === 1) style.removeProperty(INTERFACE_SCALE_VAR);
+ else style.setProperty(INTERFACE_SCALE_VAR, String(zoom));
+}
+
+/** Token multiplier: the scale in the browser, 1 on desktop (webview zoom). */
+export function webInterfaceScaleFactor(scale: number): number {
+ return isTauri ? 1 : interfaceScaleToZoom(scale);
+}
+
export function applyInterfaceScale(scale: number): Promise<void> {
if (!isTauri) {
+ applyWebInterfaceScale(scale);
return Promise.resolve();
}
requestedInterfaceScale = sanitizeInterfaceScale(scale);
diff --git a/studio/frontend/src/features/settings/tabs/agents-tab.tsx b/studio/frontend/src/features/settings/tabs/agents-tab.tsx
index 4068a7cb910..b629eb2bb9f 100644
--- a/studio/frontend/src/features/settings/tabs/agents-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/agents-tab.tsx
@@ -1532,10 +1532,10 @@ export function AgentsTab() {
</div>
<div className="flex min-w-0 flex-col gap-1.5">
- <div className="flex h-5 items-center">
+ <div className="flex h-5 min-w-0 items-center">
<span
data-settings-label={t("settings.agents.quantization")}
- className="text-xs font-medium text-foreground"
+ className="truncate text-xs font-medium text-foreground"
>
{t("settings.agents.quantization")}
</span>
@@ -1575,7 +1575,7 @@ export function AgentsTab() {
)}
</SelectValue>
</SelectTrigger>
- <SelectContent align="start" className="min-w-[16rem]">
+ <SelectContent align="start" className="min-w-[min(calc(16rem*var(--ui-space-scale,1)),calc(100vw-32px))]">
{variants.map((variant) => {
// Size only: the recommended/downloaded tags wrapped every
// row onto two lines and made the list hard to scan.
diff --git a/studio/frontend/src/features/settings/tabs/appearance-tab.tsx b/studio/frontend/src/features/settings/tabs/appearance-tab.tsx
index 63e5695b588..e66ef6d5eb8 100644
--- a/studio/frontend/src/features/settings/tabs/appearance-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/appearance-tab.tsx
@@ -5,7 +5,6 @@ import { useEffect, useRef } from "react";
import { Switch } from "@/components/ui/switch";
import { useSidebarPin } from "@/hooks/use-sidebar-pin";
import { useT } from "@/i18n";
-import { isTauri } from "@/lib/api-base";
import {
ActiveColorControl,
ChatFontRow,
@@ -73,16 +72,14 @@ export function AppearanceTab() {
<SettingsRow label={t("settings.appearance.custom.codeFont.label")}>
<CodeFontRow />
</SettingsRow>
- {isTauri && (
- <SettingsRow
- label={t("settings.appearance.custom.interfaceScale.label")}
- description={t(
- "settings.appearance.custom.interfaceScale.description",
- )}
- >
- <InterfaceScaleRow />
- </SettingsRow>
- )}
+ <SettingsRow
+ label={t("settings.appearance.custom.interfaceScale.label")}
+ description={t(
+ "settings.appearance.custom.interfaceScale.description",
+ )}
+ >
+ <InterfaceScaleRow />
+ </SettingsRow>
<SettingsRow
label={t("settings.appearance.custom.chatWidth.label")}
description={t("settings.appearance.custom.chatWidth.description")}
diff --git a/studio/frontend/src/features/settings/tabs/chat-tab.tsx b/studio/frontend/src/features/settings/tabs/chat-tab.tsx
index 84d4703708a..531f7ce8c23 100644
--- a/studio/frontend/src/features/settings/tabs/chat-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/chat-tab.tsx
@@ -52,7 +52,7 @@ import { useSettingsDialogStore } from "../stores/settings-dialog-store";
// Adjustable "+" menu items shown in settings, in display order. Icons mirror
// the ones used in the composer + menu itself.
-const PLUS_MENU_ICON_CLASS = "size-[18px]";
+const PLUS_MENU_ICON_CLASS = "size-[calc(18px*var(--ui-space-scale,1))]";
const PLUS_MENU_SETTINGS: {
id: PlusMenuItemId;
labelKey: TranslationKey;
@@ -408,7 +408,7 @@ export function ChatTab() {
{currentDatePromptError ? (
<span
role="alert"
- className="max-w-[260px] text-right text-xs text-destructive"
+ className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-destructive"
>
{currentDatePromptError}
</span>
diff --git a/studio/frontend/src/features/settings/tabs/debugging-tab.tsx b/studio/frontend/src/features/settings/tabs/debugging-tab.tsx
index c7e16e425ab..6d0ee11d449 100644
--- a/studio/frontend/src/features/settings/tabs/debugging-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/debugging-tab.tsx
@@ -480,7 +480,7 @@ export function DebuggingTab() {
size="sm"
data-testid="debug-log-source"
aria-label={t("settings.debugging.source")}
- className="max-w-[22rem] font-mono text-ui-12"
+ className="max-w-[calc(22rem*var(--ui-space-scale,1))] font-mono text-ui-12"
>
<SelectValue placeholder={t("settings.debugging.missing")} />
</SelectTrigger>
@@ -733,7 +733,7 @@ export function DebuggingTab() {
</TooltipContent>
</Tooltip>
</div>
- <div className="flex shrink-0 flex-wrap items-center justify-end gap-1">
+ <div className="flex max-w-full shrink-0 flex-wrap items-center justify-end gap-1">
<Button
size="sm"
variant="ghost"
@@ -774,7 +774,7 @@ export function DebuggingTab() {
/>
</button>
</TooltipTrigger>
- <TooltipContent className="max-w-[300px] text-ui-11 leading-snug">
+ <TooltipContent className="max-w-[calc(300px*var(--ui-space-scale,1))] text-ui-11 leading-snug">
{t("settings.debugging.exportMaskedNote")}
</TooltipContent>
</Tooltip>
diff --git a/studio/frontend/src/features/settings/tabs/general-tab.tsx b/studio/frontend/src/features/settings/tabs/general-tab.tsx
index 29482dda2d1..35c227f4196 100644
--- a/studio/frontend/src/features/settings/tabs/general-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/general-tab.tsx
@@ -502,9 +502,9 @@ export function GeneralTab() {
label={t("settings.general.huggingFaceToken")}
description={t("settings.general.huggingFaceTokenDescription")}
>
- <div className="flex flex-col items-end gap-1.5">
- <div className="flex items-center gap-2">
- <div className="relative w-[260px]">
+ <div className="flex min-w-0 flex-col items-end gap-1.5">
+ <div className="flex max-w-full items-center gap-2">
+ <div className="relative w-[calc(260px*var(--ui-space-scale,1))] min-w-0">
<Input
type={showToken ? "text" : "password"}
name="hf-token"
@@ -559,7 +559,7 @@ export function GeneralTab() {
</Button>
</div>
{hfTokenPersistenceError ? (
- <p className="max-w-[330px] text-right text-xs text-destructive">
+ <p className="max-w-[calc(330px*var(--ui-space-scale,1))] text-right text-xs text-destructive">
{hfTokenPersistenceError}
</p>
) : tokenValidation.isChecking ? (
@@ -567,7 +567,7 @@ export function GeneralTab() {
{t("settings.general.checkingToken")}
</p>
) : tokenValidation.error ? (
- <p className="max-w-[330px] text-right text-xs text-destructive">
+ <p className="max-w-[calc(330px*var(--ui-space-scale,1))] text-right text-xs text-destructive">
{tokenValidation.error}
</p>
) : null}
@@ -619,7 +619,7 @@ export function GeneralTab() {
onCheckedChange={(enabled) => void launchAtLoginSetting.update(enabled)}
/>
{launchAtLoginSetting.error ? (
- <span className="max-w-[260px] text-right text-xs text-destructive">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-destructive">
{launchAtLoginSetting.error}
</span>
) : null}
@@ -640,7 +640,7 @@ export function GeneralTab() {
onCheckedChange={(enabled) => void closeToTraySetting.update(enabled)}
/>
{closeToTraySetting.error ? (
- <span className="max-w-[260px] text-right text-xs text-destructive">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-destructive">
{closeToTraySetting.error}
</span>
) : null}
@@ -703,7 +703,7 @@ export function GeneralTab() {
onCheckedChange={(enabled) => void savePreviewSharing(enabled)}
/>
{previewSharingError ? (
- <span className="max-w-[260px] text-right text-xs text-destructive">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-destructive">
{previewSharingError}
</span>
) : null}
@@ -748,12 +748,12 @@ export function GeneralTab() {
}
/>
{managedProviderUrls?.lockedByEnvironment ? (
- <span className="max-w-[260px] text-right text-xs text-muted-foreground">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-muted-foreground">
{t("settings.general.managedProviderUrls.lockedByEnvironment")}
</span>
) : null}
{managedProviderUrlsError ? (
- <span className="max-w-[260px] text-right text-xs text-destructive">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-destructive">
{managedProviderUrlsError}
</span>
) : null}
@@ -804,7 +804,7 @@ export function GeneralTab() {
</Button>
</div>
{uploadLimitError ? (
- <span className="max-w-[260px] text-right text-xs text-destructive">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-destructive">
{uploadLimitError}
</span>
) : null}
@@ -831,11 +831,11 @@ export function GeneralTab() {
onCheckedChange={(enabled) => void saveHelperPrecache(enabled)}
/>
{helperPrecache?.disabledByEnv ? (
- <span className="max-w-[260px] text-right text-xs text-muted-foreground">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-muted-foreground">
{t("settings.general.helperLlm.disabledByEnv")}
</span>
) : helperPrecacheError ? (
- <span className="max-w-[260px] text-right text-xs text-destructive">
+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-destructive">
{helperPrecacheError}
</span>
) : null}
diff --git a/studio/frontend/src/features/settings/tabs/keyboard-shortcuts-tab.tsx b/studio/frontend/src/features/settings/tabs/keyboard-shortcuts-tab.tsx
index 0b2aa1f8856..b7931a96384 100644
--- a/studio/frontend/src/features/settings/tabs/keyboard-shortcuts-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/keyboard-shortcuts-tab.tsx
@@ -82,7 +82,7 @@ function Chord({
return (
<Tooltip>
<TooltipTrigger asChild={true}>{cap}</TooltipTrigger>
- <TooltipContent className="max-w-[260px] leading-snug">
+ <TooltipContent className="max-w-[calc(260px*var(--ui-space-scale,1))] leading-snug">
{note}
</TooltipContent>
</Tooltip>
diff --git a/studio/frontend/src/features/settings/tabs/resources-tab.tsx b/studio/frontend/src/features/settings/tabs/resources-tab.tsx
index 42df66a3c15..cc58f510a06 100644
--- a/studio/frontend/src/features/settings/tabs/resources-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/resources-tab.tsx
@@ -718,7 +718,7 @@ export function ResourcesTab() {
// pane's, so it reads as one device's usage, not a rule.
<div
key={`${device.index ?? index}-${device.name ?? "gpu"}`}
- className="flex min-w-0 items-center justify-between gap-x-4 gap-y-2 py-3 max-[992px]:flex-col max-[992px]:items-stretch"
+ className="flex min-w-0 flex-wrap items-center justify-between gap-x-4 gap-y-2 py-3 max-[992px]:flex-col max-[992px]:items-stretch"
>
<div className="min-w-0 flex-1">
<div className="truncate text-sm font-medium text-foreground">
@@ -761,7 +761,7 @@ export function ResourcesTab() {
})}
</div>
) : (
- <div className="flex w-[392px] shrink-0 flex-col items-stretch gap-2.5 max-[992px]:w-full">
+ <div className="flex w-[min(calc(392px*var(--ui-space-scale,1)),100%)] shrink-0 flex-col items-stretch gap-2.5 max-[992px]:w-full">
{/* Ruled between the three readings: run together they are
easy to misread as one number. */}
{/* min-w-0 on each reading, or truncate cannot fire: a flex
@@ -838,7 +838,7 @@ export function ResourcesTab() {
hint={t("settings.resources.storage.modelsFolderHint")}
className="max-[840px]:flex-col max-[840px]:items-stretch max-[840px]:gap-2"
>
- <div className="grid w-[392px] min-w-0 grid-cols-[minmax(0,1fr)_auto] gap-x-2 gap-y-1.5 max-[840px]:w-full">
+ <div className="grid w-[calc(392px*var(--ui-space-scale,1))] min-w-0 grid-cols-[minmax(0,1fr)_auto] gap-x-2 gap-y-1.5 max-[840px]:w-full">
<div className="relative min-w-0">
<Input
readOnly
diff --git a/studio/frontend/src/features/settings/tabs/voice-tab.tsx b/studio/frontend/src/features/settings/tabs/voice-tab.tsx
index 6822bb491b9..5e11540c9eb 100644
--- a/studio/frontend/src/features/settings/tabs/voice-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/voice-tab.tsx
@@ -1434,7 +1434,7 @@ export function VoiceTab() {
>
<SelectValue />
</SelectTrigger>
- <SelectContent className="max-h-72">
+ <SelectContent className="max-h-[min(--spacing(72),var(--radix-select-content-available-height))]">
<SelectItem value="default">
{t("settings.voice.dictation.systemDefault")}
</SelectItem>
diff --git a/studio/frontend/src/features/studio/history-card-grid.tsx b/studio/frontend/src/features/studio/history-card-grid.tsx
index 96797c61c87..0756af895b2 100644
--- a/studio/frontend/src/features/studio/history-card-grid.tsx
+++ b/studio/frontend/src/features/studio/history-card-grid.tsx
@@ -471,7 +471,7 @@ export function HistoryCardGrid({
<div
key={run.id}
className={cn(
- "elevated-card group relative h-[11.5rem] cursor-pointer bg-card transition-colors hover:bg-accent/30",
+ "elevated-card group relative h-[calc(11.5rem*var(--ui-space-scale,1))] cursor-pointer bg-card transition-colors hover:bg-accent/30",
isRunning && "!border-blue-400/50 dark:!border-blue-500/30",
)}
>
diff --git a/studio/frontend/src/features/studio/sections/charts-section.tsx b/studio/frontend/src/features/studio/sections/charts-section.tsx
index 4c7bf46d9da..87b02045440 100644
--- a/studio/frontend/src/features/studio/sections/charts-section.tsx
+++ b/studio/frontend/src/features/studio/sections/charts-section.tsx
@@ -76,7 +76,7 @@ export function ChartsSection({
{SKELETON_KEYS.map((key) => (
<div
key={key}
- className="h-[280px] rounded-xl border bg-muted/30 animate-pulse"
+ className="h-[calc(280px*var(--ui-space-scale,1))] rounded-xl border bg-muted/30 animate-pulse"
/>
))}
</div>
diff --git a/studio/frontend/src/features/studio/sections/charts/utils.ts b/studio/frontend/src/features/studio/sections/charts/utils.ts
index 8d22bea380a..d743c2f7973 100644
--- a/studio/frontend/src/features/studio/sections/charts/utils.ts
+++ b/studio/frontend/src/features/studio/sections/charts/utils.ts
@@ -5,7 +5,7 @@ import type { LossHistoryItem, OutlierMode, SmoothedLossItem } from "./types";
export const CHART_SYNC_ID = "train-metrics-sync";
export const MAX_RENDER_POINTS = 800;
-export const CHART_CONTAINER_CLASS = "h-[220px] w-full";
+export const CHART_CONTAINER_CLASS = "h-[calc(220px*var(--ui-space-scale,1))] w-full";
export const DEFAULT_CHART_MARGIN = { top: 4, right: 8, bottom: 0, left: 4 };
export const DEFAULT_Y_AXIS_WIDTH = 45;
const TRAILING_ZEROES_RE = /\.?0+$/;
diff --git a/studio/frontend/src/features/studio/sections/dataset-preview-dialog-mapping.tsx b/studio/frontend/src/features/studio/sections/dataset-preview-dialog-mapping.tsx
index e6a93d83bd7..469c12b9296 100644
--- a/studio/frontend/src/features/studio/sections/dataset-preview-dialog-mapping.tsx
+++ b/studio/frontend/src/features/studio/sections/dataset-preview-dialog-mapping.tsx
@@ -49,7 +49,7 @@ export function HeaderRolePicker({
value={currentRole ?? "_none"}
onValueChange={(v) => onRoleChange(v === "_none" ? undefined : v)}
>
- <SelectTrigger className="h-6 w-[90px] text-ui-10 px-2 py-0 border-dashed cursor-pointer">
+ <SelectTrigger className="h-6 w-[calc(90px*var(--ui-space-scale,1))] text-ui-10 px-2 py-0 border-dashed cursor-pointer">
<SelectValue placeholder="Role..." />
</SelectTrigger>
<SelectContent>
diff --git a/studio/frontend/src/features/studio/sections/dataset-preview-dialog.tsx b/studio/frontend/src/features/studio/sections/dataset-preview-dialog.tsx
index be09e97f467..0d425fb9ebc 100644
--- a/studio/frontend/src/features/studio/sections/dataset-preview-dialog.tsx
+++ b/studio/frontend/src/features/studio/sections/dataset-preview-dialog.tsx
@@ -689,7 +689,7 @@ export function DatasetPreviewDialog({
)}
{/* Data table */}
- <div className="flex-1 min-h-[250px] rounded-xl corner-squircle ring-1 ring-border/60 overflow-auto">
+ <div className="flex-1 min-h-[calc(250px*var(--ui-space-scale,1))] rounded-xl corner-squircle ring-1 ring-border/60 overflow-auto">
<DataTable columns={tableColumns} data={rows} />
</div>
diff --git a/studio/frontend/src/features/studio/sections/dataset-source-toggle.tsx b/studio/frontend/src/features/studio/sections/dataset-source-toggle.tsx
index 58e6e12d4eb..7c26d27e8cc 100644
--- a/studio/frontend/src/features/studio/sections/dataset-source-toggle.tsx
+++ b/studio/frontend/src/features/studio/sections/dataset-source-toggle.tsx
@@ -45,7 +45,7 @@ export function DatasetSourceToggle({
}}
ariaLabel={t("studio.dataset.sourceAriaLabel")}
size="compact"
- className="@md/train-card:w-[200px]"
+ className="@md/train-card:w-[calc(200px*var(--ui-space-scale,1))]"
/>
);
}
diff --git a/studio/frontend/src/features/studio/sections/training-hyperparameters-section.tsx b/studio/frontend/src/features/studio/sections/training-hyperparameters-section.tsx
index 687eb0a2823..b3a4c96e6b1 100644
--- a/studio/frontend/src/features/studio/sections/training-hyperparameters-section.tsx
+++ b/studio/frontend/src/features/studio/sections/training-hyperparameters-section.tsx
@@ -141,7 +141,7 @@ export function TrainingHyperparametersSection({
value={tab}
options={tabs}
ariaLabel={t("studio.params.trainingHyperparameters")}
- className="w-full max-w-[520px] [&>button]:px-6"
+ className="w-full max-w-[calc(520px*var(--ui-space-scale,1))] [&>button]:px-6"
/>
</div>
diff --git a/studio/frontend/src/features/studio/studio-page.tsx b/studio/frontend/src/features/studio/studio-page.tsx
index 702dd70f9fc..d87892c44a3 100644
--- a/studio/frontend/src/features/studio/studio-page.tsx
+++ b/studio/frontend/src/features/studio/studio-page.tsx
@@ -187,7 +187,7 @@ export function StudioPage(): ReactElement {
onValueChange={(value) => handleTabChange(value as TrainSubTab)}
className="contents"
>
- <div className="mx-auto flex w-full max-w-[1180px] flex-col gap-7 px-5 pb-20 pt-8 sm:px-9 sm:pt-10">
+ <div className="mx-auto flex w-full max-w-[calc(1180px*var(--ui-space-scale,1))] flex-col gap-7 px-5 pb-20 pt-8 sm:px-9 sm:pt-10">
<header className="font-heading flex flex-col gap-5">
<div className="flex flex-col gap-0.5">
<h1 className="page-title-halo text-ui-30 font-semibold leading-[1.04] tracking-[-0.028em] text-foreground sm:text-ui-34">
diff --git a/studio/frontend/src/features/studio/training-start-overlay.tsx b/studio/frontend/src/features/studio/training-start-overlay.tsx
index f1fd049e8a9..f26e061839b 100644
--- a/studio/frontend/src/features/studio/training-start-overlay.tsx
+++ b/studio/frontend/src/features/studio/training-start-overlay.tsx
@@ -376,9 +376,12 @@ export function TrainingStartOverlay({
}
}, [jobId]);
+ // my-auto, not items-center: a column taller than the overlay starts at its
+ // top and runs down into the page's scroll, instead of spilling above it
+ // where the cancel button cannot be reached.
return (
- <div className="pointer-events-none absolute inset-0 z-30 flex items-center justify-center rounded-2xl bg-background/45 backdrop-blur-[1px]">
- <div className="pointer-events-auto relative flex w-[860px] max-w-[calc(100%-2rem)] flex-col items-center">
+ <div className="pointer-events-none absolute inset-0 z-30 flex flex-col items-center rounded-2xl bg-background/45 backdrop-blur-[1px]">
+ <div className="pointer-events-auto relative my-auto flex w-[calc(860px*var(--ui-space-scale,1))] max-w-[calc(100%-2rem)] flex-col items-center">
<MascotImg src="unsloth-gem.png" className="size-24 object-contain" />
<div className="relative w-full">
<AlertDialog open={cancelDialogOpen} onOpenChange={setCancelDialogOpen}>
@@ -424,7 +427,7 @@ export function TrainingStartOverlay({
</AlertDialogContent>
</AlertDialog>
<Terminal
- className="w-full min-h-[390px] rounded-2xl border-0 px-7 py-6 text-left"
+ className="w-full min-h-[calc(390px*var(--ui-space-scale,1))] rounded-2xl border-0 px-7 py-6 text-left"
startOnView={false}
instant={alreadyAnimated}
>
diff --git a/studio/frontend/src/features/studio/wizard/run-preview-card.tsx b/studio/frontend/src/features/studio/wizard/run-preview-card.tsx
index 12495f10f16..c76bdd1b90a 100644
--- a/studio/frontend/src/features/studio/wizard/run-preview-card.tsx
+++ b/studio/frontend/src/features/studio/wizard/run-preview-card.tsx
@@ -105,7 +105,7 @@ function ResourceNoticeRow({
<HugeiconsIcon icon={InformationCircleIcon} className="size-3" />
</button>
</TooltipTrigger>
- <TooltipContent side="top" className="max-w-[260px] leading-relaxed">
+ <TooltipContent side="top" className="max-w-[calc(260px*var(--ui-space-scale,1))] leading-relaxed">
{description}
</TooltipContent>
</Tooltip>
diff --git a/studio/frontend/src/features/studio/wizard/training-wizard.tsx b/studio/frontend/src/features/studio/wizard/training-wizard.tsx
index 3e4c833efed..e40a418984e 100644
--- a/studio/frontend/src/features/studio/wizard/training-wizard.tsx
+++ b/studio/frontend/src/features/studio/wizard/training-wizard.tsx
@@ -80,7 +80,7 @@ function SectionBox({
<HugeiconsIcon
icon={icon}
strokeWidth={1.5}
- className="size-[18px]"
+ className="size-[calc(18px*var(--ui-space-scale,1))]"
/>
</span>
)}
@@ -131,7 +131,7 @@ function ParamModeToggle({
options={options}
ariaLabel={t("studio.params.mode.ariaLabel")}
size="compact"
- className="@md/train-card:w-[180px]"
+ className="@md/train-card:w-[calc(180px*var(--ui-space-scale,1))]"
/>
</Tabs>
);
@@ -173,7 +173,7 @@ function TrainingMethodSelect() {
aria-label={`${t("studio.wizard.methodLabel")}: ${activeLabel}`}
className={cn(
PICKER_TRIGGER_CLASS,
- "w-full min-w-[148px] justify-between",
+ "w-full min-w-[calc(148px*var(--ui-space-scale,1))] justify-between",
)}
data-tour="studio-method"
>
@@ -227,7 +227,7 @@ function TrainingMethodSelect() {
<TooltipContent
side="right"
sideOffset={10}
- className="max-w-[220px] text-ui-11p5 leading-snug"
+ className="max-w-[calc(220px*var(--ui-space-scale,1))] text-ui-11p5 leading-snug"
>
{unsupportedOnMlx
? t("studio.params.notSupportedAppleSilicon")
diff --git a/studio/frontend/src/features/train-model-picker/components/train-model-selector.tsx b/studio/frontend/src/features/train-model-picker/components/train-model-selector.tsx
index c2334eeb75b..a9321f93beb 100644
--- a/studio/frontend/src/features/train-model-picker/components/train-model-selector.tsx
+++ b/studio/frontend/src/features/train-model-picker/components/train-model-selector.tsx
@@ -778,7 +778,7 @@ export function TrainModelSelector({
}`}
className={cn(
PICKER_TRIGGER_CLASS,
- "w-full min-w-[180px] justify-between",
+ "w-full min-w-[calc(180px*var(--ui-space-scale,1))] justify-between",
)}
>
<span className="flex min-w-0 items-center gap-1.5">
diff --git a/studio/frontend/src/features/video/video-page.tsx b/studio/frontend/src/features/video/video-page.tsx
index 7666b2e681b..a80ed262618 100644
--- a/studio/frontend/src/features/video/video-page.tsx
+++ b/studio/frontend/src/features/video/video-page.tsx
@@ -596,7 +596,7 @@ function AdvancedSelect({
{badge}
</span>
<Select value={value} onValueChange={onValueChange}>
- <SelectTrigger className="h-8 w-[160px] text-xs">
+ <SelectTrigger className="h-8 w-[calc(160px*var(--ui-space-scale,1))] text-xs">
<SelectValue />
</SelectTrigger>
<SelectContent>
@@ -3518,7 +3518,7 @@ 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 md:w-[400px] md:overflow-hidden md:border-r md:border-b-0"
+ className="flex w-full shrink-0 flex-col border-b border-border/60 pl-8 md:w-[min(calc(400px*var(--ui-space-scale,1)),calc(100%-13rem))] md:overflow-hidden md:border-r md:border-b-0"
>
{/* pl-0.5 keeps focus rings off the scroll container's edge. */}
<div
@@ -3534,7 +3534,7 @@ function VideoGenerator({
<div className="min-w-0 grid gap-1.5">
<h2 className="flex items-center gap-2 font-heading text-xl font-medium leading-none text-foreground">
{/* The app's Video icon, same as the sidebar row. */}
- <HugeiconsIcon icon={FlimSlateIcon} className="size-[18px] shrink-0" />
+ <HugeiconsIcon icon={FlimSlateIcon} className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0" />
Create videos
</h2>
<p className="text-xs leading-snug text-muted-foreground">
diff --git a/studio/frontend/src/hooks/use-panel-width.ts b/studio/frontend/src/hooks/use-panel-width.ts
index d753c3a1bb4..568460634a5 100644
--- a/studio/frontend/src/hooks/use-panel-width.ts
+++ b/studio/frontend/src/hooks/use-panel-width.ts
@@ -2,6 +2,7 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import { useCallback, useSyncExternalStore } from "react";
+import { layoutScale, subscribeLayoutScale } from "../lib/layout-scale.ts";
/** Never let one panel eat more than this share of a narrow window. */
const MAX_VIEWPORT_FRACTION = 0.4;
@@ -12,6 +13,8 @@ export type PanelWidthStore = {
useWidth: () => {
width: number;
max: number;
+ /** Browser interface scale; render at width * scale. */
+ scale: number;
/** The uncapped stored preference. */
stored: number;
setWidth: (value: number) => void;
@@ -20,7 +23,8 @@ export type PanelWidthStore = {
};
/**
- * A persisted, viewport-aware width for a draggable panel. The preference is
+ * A persisted, viewport-aware width for a draggable panel. Widths are layout px:
+ * the panel renders them times `scale`, as desktop webview zoom would. The preference is
* stored whole and an effective width is derived from it, so narrowing the
* window shrinks the panel without losing what the user picked.
*/
@@ -37,8 +41,12 @@ export function createPanelWidthStore({
}): PanelWidthStore {
function maxWidth(): number {
if (typeof window === "undefined") return max;
- // The floor wins on a narrow window; collapsing is the escape.
- return Math.max(min, Math.min(max, window.innerWidth * MAX_VIEWPORT_FRACTION));
+ // The floor wins on a narrow window; collapsing is the escape. The window
+ // 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),
+ );
}
/** Clamps to the absolute range, ignoring the viewport. */
@@ -105,8 +113,10 @@ export function createPanelWidthStore({
};
window.addEventListener("storage", onStorage);
window.addEventListener("resize", recompute);
+ const unsubscribeScale = subscribeLayoutScale(recompute);
return () => {
listeners.delete(cb);
+ unsubscribeScale();
window.removeEventListener("storage", onStorage);
window.removeEventListener("resize", recompute);
};
@@ -129,9 +139,10 @@ export function createPanelWidthStore({
const panelMax = useSyncExternalStore(subscribe, () => effectiveMax, () => max);
// The uncapped preference, so a capped drag can avoid lowering it.
const preference = useSyncExternalStore(subscribe, () => storedWidth, () => fallback);
+ const scale = useSyncExternalStore(subscribeLayoutScale, layoutScale, () => 1);
const setWidth = useCallback((value: number) => setWidthGlobal(value), []);
const resetWidth = useCallback(() => setWidthGlobal(fallback), []);
- return { width, max: panelMax, stored: preference, setWidth, resetWidth };
+ return { width, max: panelMax, scale, stored: preference, setWidth, resetWidth };
}
return { clamp, useWidth };
diff --git a/studio/frontend/src/hooks/use-ui-space-scale.ts b/studio/frontend/src/hooks/use-ui-space-scale.ts
index 520fab90436..20bf24c165a 100644
--- a/studio/frontend/src/hooks/use-ui-space-scale.ts
+++ b/studio/frontend/src/hooks/use-ui-space-scale.ts
@@ -5,15 +5,21 @@ import {
UI_FONT_SIZE_RANGE,
useAppearanceCustomStore,
} from "@/features/settings/stores/appearance-custom-store";
+import {
+ useInterfaceScaleStore,
+ webInterfaceScaleFactor,
+} from "@/features/settings/stores/interface-scale-store";
/**
* The JS twin of --ui-space-scale, for geometry that only exists in JS:
* virtualizer slot heights and anything measured against them. Everything
- * else scales through the CSS variable.
+ * else scales through the CSS variable. Includes the browser interface scale.
*/
export function useUiSpaceScale(): number {
const uiFontSize = useAppearanceCustomStore((s) => s.customization.uiFontSize);
+ const interfaceScale = useInterfaceScaleStore((s) => s.scale);
return (
- (uiFontSize ?? UI_FONT_SIZE_RANGE.default) / UI_FONT_SIZE_RANGE.default
+ ((uiFontSize ?? UI_FONT_SIZE_RANGE.default) / UI_FONT_SIZE_RANGE.default) *
+ webInterfaceScaleFactor(interfaceScale)
);
}
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index 9f687e3788b..81f9900c391 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -311,9 +311,10 @@
the signal never changes with the theme. */
--verified: #17b88b;
- /* The authored typography tokens use a 16px CSS base; the product default
- is 15px. An explicit user preference overrides this inline. */
- --ui-font-scale: 0.9375;
+ /* Typography tokens use a 16px base; the default is 15px. UI font size sets
+ --ui-font-size-scale. In the browser, interface scale multiplies it via
+ --ui-interface-scale; the desktop app zooms its webview instead. */
+ --ui-font-scale: calc(var(--ui-font-size-scale, 0.9375) * var(--ui-interface-scale, 1));
/* Every padding, gap and margin multiplies by this, so spacing stays the
same fraction of the text at any UI font size (12px -> 0.8, 20px ->
@@ -322,6 +323,22 @@
hairlines) skip it. */
--ui-space-scale: calc(var(--ui-font-scale, 1) / 0.9375);
+ /* Named widths (max-w-md, max-w-xs) scale with their content. @container
+ thresholds are inlined at build time, so breakpoints do not move. */
+ --container-3xs: calc(16rem * var(--ui-space-scale, 1));
+ --container-2xs: calc(18rem * var(--ui-space-scale, 1));
+ --container-xs: calc(20rem * var(--ui-space-scale, 1));
+ --container-sm: calc(24rem * var(--ui-space-scale, 1));
+ --container-md: calc(28rem * var(--ui-space-scale, 1));
+ --container-lg: calc(32rem * var(--ui-space-scale, 1));
+ --container-xl: calc(36rem * var(--ui-space-scale, 1));
+ --container-2xl: calc(42rem * var(--ui-space-scale, 1));
+ --container-3xl: calc(48rem * var(--ui-space-scale, 1));
+ --container-4xl: calc(56rem * var(--ui-space-scale, 1));
+ --container-5xl: calc(64rem * var(--ui-space-scale, 1));
+ --container-6xl: calc(72rem * var(--ui-space-scale, 1));
+ --container-7xl: calc(80rem * var(--ui-space-scale, 1));
+
/* Chat chrome that holds text. Declared here because the web shell sets no
chrome vars; the desktop shells override these in app/provider.tsx.
Window geometry stays pinned there: it is the OS window's, not ours. */
@@ -335,14 +352,12 @@
icons read as minimally larger than adjacent labels (~14px text).
Follows the UI font size preference; 15px at the app default.
Theme-independent — declared once in :root. */
- /* Standard icon size follows the UI font size itself: matches it below
- the 16px CSS scale base, grows at half the change above it (setting 20 ->
- 18px), so icons read slightly smaller than enlarged text. */
- --ui-icon-size: min(calc(1rem * var(--ui-font-scale, 1)), calc(0.5rem + 0.5rem * var(--ui-font-scale, 1)));
+ /* Scales at the same rate as text and padding (12 -> 12px, 20 -> 20px). */
+ --ui-icon-size: calc(1rem * var(--ui-font-scale, 1));
--icon-size: var(--ui-icon-size);
/* Mirrors the size-3.5 rule applied inside popovers (see the icon block
below), so widths that reserve room for those icons track them. */
- --ui-icon-size-sm: min(calc(0.875rem * var(--ui-font-scale, 1)), calc(0.4375rem + 0.4375rem * var(--ui-font-scale, 1)));
+ --ui-icon-size-sm: calc(0.875rem * var(--ui-font-scale, 1));
/* Model picker header controls. Padding and gaps follow --ui-space-scale,
icons and label follow --ui-font-scale, so reserve each separately. The
trigger is 2.25rem of padding and gaps, two icons, then the label, plus
@@ -1437,8 +1452,8 @@ html[data-chat-font] .aui-root {
background-color: var(--panel-slider-fg) !important;
}
.panel-slider [data-slot="slider-thumb"] {
- width: 0.875rem !important;
- height: 0.875rem !important;
+ width: calc(0.875rem * var(--ui-space-scale, 1)) !important;
+ height: calc(0.875rem * var(--ui-space-scale, 1)) !important;
background-color: var(--panel-slider-fg) !important;
border-color: var(--panel-slider-fg) !important;
transform: none !important;
@@ -1680,7 +1695,7 @@ html[data-chat-font] .aui-root {
.app-user-menu [data-slot="dropdown-menu-item"],
.app-user-menu [data-slot="dropdown-menu-sub-trigger"] {
- height: 36px;
+ height: calc(36px * var(--ui-space-scale, 1));
padding: 0 calc(0.75rem * var(--ui-space-scale, 1)) !important;
gap: calc(9.5px * var(--ui-space-scale, 1)) !important;
border-radius: 12px;
@@ -2003,7 +2018,7 @@ html[data-chat-font] .aui-root {
/* Too small for the circle, so show a bare x. */
& .composer-pill-x {
- @apply size-[min(calc(15px*var(--ui-font-scale,1)),calc(7.5px+7.5px*var(--ui-font-scale,1)))] bg-transparent p-0 dark:bg-transparent;
+ @apply size-[calc(15px*var(--ui-font-scale,1))] bg-transparent p-0 dark:bg-transparent;
}
/* Hidden name comes back as a hover tooltip, like .tooltip-compact. */
@@ -2350,10 +2365,10 @@ html[data-chat-font] .aui-root {
.unsloth-composer-left > .unsloth-composer-plus,
.unsloth-composer-line .aui-composer-action-wrapper > button,
.unsloth-composer-line .aui-composer-run-controls > button {
- width: 1.75rem;
- height: 1.75rem;
+ width: calc(1.75rem * var(--ui-space-scale, 1));
+ height: calc(1.75rem * var(--ui-space-scale, 1));
/* The thinking pill reserves a text line; that would win over height. */
- min-height: 1.75rem;
+ min-height: calc(1.75rem * var(--ui-space-scale, 1));
}
/* Tool pills only once the fit hook has collapsed their labels. Applied
@@ -2362,9 +2377,9 @@ html[data-chat-font] .aui-root {
.unsloth-composer-left[data-pill-compact="true"] > button.composer-pill-btn,
.unsloth-composer-left[data-pill-compact="first"]
> button.composer-pill-btn.composer-pill-permissions {
- width: 1.75rem;
- height: 1.75rem;
- min-height: 1.75rem;
+ width: calc(1.75rem * var(--ui-space-scale, 1));
+ height: calc(1.75rem * var(--ui-space-scale, 1));
+ min-height: calc(1.75rem * var(--ui-space-scale, 1));
}
/* Send commits, so keep it clear of the toggle strip. Needs the same
@@ -2389,9 +2404,9 @@ html[data-chat-font] .aui-root {
}
.unsloth-dictation-actions > button {
- width: 1.75rem;
- height: 1.75rem;
- min-height: 1.75rem;
+ width: calc(1.75rem * var(--ui-space-scale, 1));
+ height: calc(1.75rem * var(--ui-space-scale, 1));
+ min-height: calc(1.75rem * var(--ui-space-scale, 1));
}
/* The wave is flex-1 and min-width 0, so all it still contributes at
@@ -2489,8 +2504,8 @@ html[data-chat-font] .aui-root {
}
.unsloth-welcome-sloth {
- width: 2.125rem;
- height: 2.125rem;
+ width: calc(2.125rem * var(--ui-space-scale, 1));
+ height: calc(2.125rem * var(--ui-space-scale, 1));
}
.unsloth-welcome-greeting {
@@ -2506,8 +2521,8 @@ html[data-chat-font] .aui-root {
}
.unsloth-welcome-sloth {
- width: 1.75rem;
- height: 1.75rem;
+ width: calc(1.75rem * var(--ui-space-scale, 1));
+ height: calc(1.75rem * var(--ui-space-scale, 1));
}
.unsloth-welcome-greeting {
@@ -2521,7 +2536,7 @@ html[data-chat-font] .aui-root {
@apply inline-flex shrink-0 cursor-pointer items-center gap-1 rounded-full py-1.5 pl-2 pr-2.5 text-ui-14 font-medium text-muted-foreground dark:text-foreground transition-colors hover:bg-primary/10 dark:hover:bg-accent disabled:cursor-not-allowed disabled:opacity-40;
/* Reserve a text line so the icon-only (inactive) pill matches the
text pills' height instead of collapsing to the icon. */
- min-height: calc(1lh + 0.75rem);
+ min-height: calc(1lh + 0.75rem * var(--ui-space-scale, 1));
}
.unsloth-thinking-pill[data-active="true"] {
@@ -2539,7 +2554,7 @@ html[data-chat-font] .aui-root {
@container (max-width: 36rem) {
.unsloth-thinking-pill {
@apply size-8 justify-center gap-0 px-0;
- min-height: 2rem;
+ min-height: calc(2rem * var(--ui-space-scale, 1));
}
.unsloth-thinking-label,
@@ -2559,8 +2574,8 @@ html[data-chat-font] .aui-root {
/* Smaller tick for selected Thinking options. */
.unsloth-tick {
- width: min(calc(0.8rem * var(--ui-font-scale, 1)), calc(0.4rem + 0.4rem * var(--ui-font-scale, 1))) !important;
- height: min(calc(0.8rem * var(--ui-font-scale, 1)), calc(0.4rem + 0.4rem * var(--ui-font-scale, 1))) !important;
+ width: calc(0.8rem * var(--ui-font-scale, 1)) !important;
+ height: calc(0.8rem * var(--ui-font-scale, 1)) !important;
}
/* Soft elevation; [data-slot] outranks the component ring-1, dropping the border. */
@@ -2815,7 +2830,7 @@ html[data-chat-font] .aui-root {
.artifact-panel-shell::after {
top: 50%;
left: -2px;
- height: 28px;
+ height: calc(28px * var(--ui-space-scale, 1));
width: 4px;
border-radius: 999px;
background: transparent;
@@ -3844,13 +3859,10 @@ body.sidebar-row-dragging * {
width: 8px;
}
-/* Icons that sit beside scaled labels follow the UI font size itself:
- glyphs at or above a 16px base render at --ui-icon-size (12 -> 12px,
- 16 -> 16px, 20 -> 18px), so icons track the text below the default and
- read slightly smaller than it above. Sub-16px glyphs keep their
- proportions through the same curve as a factor. Menu, select and closed select trigger surfaces, popovers, toasts,
- the chat thread and both composers. Only glyphs scale; hit targets,
- paddings and surface geometry stay fixed. Identity at the default. */
+/* Icons in menus, selects, popovers, toasts, the thread and both composers
+ scale at the same rate as the text. Glyphs 16px and up render at
+ --ui-icon-size. Arbitrary sizes match in both their plain and scaled
+ spelling. Identity at the default. */
:is(
[data-slot='dropdown-menu-content'],
[data-slot='dropdown-menu-sub-content'],
@@ -3869,29 +3881,29 @@ body.sidebar-row-dragging * {
.aui-action-bar-more-content,
.aui-root
) {
- & svg.size-2\.5 { width: min(calc(0.625rem * var(--ui-font-scale, 1)), calc(0.3125rem + 0.3125rem * var(--ui-font-scale, 1))); height: min(calc(0.625rem * var(--ui-font-scale, 1)), calc(0.3125rem + 0.3125rem * var(--ui-font-scale, 1))); }
- & svg.size-3 { width: min(calc(0.75rem * var(--ui-font-scale, 1)), calc(0.375rem + 0.375rem * var(--ui-font-scale, 1))); height: min(calc(0.75rem * var(--ui-font-scale, 1)), calc(0.375rem + 0.375rem * var(--ui-font-scale, 1))); }
- & svg.size-3\.5 { width: min(calc(0.875rem * var(--ui-font-scale, 1)), calc(0.4375rem + 0.4375rem * var(--ui-font-scale, 1))); height: min(calc(0.875rem * var(--ui-font-scale, 1)), calc(0.4375rem + 0.4375rem * var(--ui-font-scale, 1))); }
+ & svg.size-2\.5 { width: calc(0.625rem * var(--ui-font-scale, 1)); height: calc(0.625rem * var(--ui-font-scale, 1)); }
+ & svg.size-3 { width: calc(0.75rem * var(--ui-font-scale, 1)); height: calc(0.75rem * var(--ui-font-scale, 1)); }
+ & svg.size-3\.5 { width: calc(0.875rem * var(--ui-font-scale, 1)); height: calc(0.875rem * var(--ui-font-scale, 1)); }
& svg.size-4 { width: var(--ui-icon-size); height: var(--ui-icon-size); }
& svg.size-4\.5 { width: var(--ui-icon-size); height: var(--ui-icon-size); }
& svg.size-5 { width: var(--ui-icon-size); height: var(--ui-icon-size); }
- & svg.size-6 { width: min(calc(1.5rem * var(--ui-font-scale, 1)), calc(0.75rem + 0.75rem * var(--ui-font-scale, 1))); height: min(calc(1.5rem * var(--ui-font-scale, 1)), calc(0.75rem + 0.75rem * var(--ui-font-scale, 1))); }
- & svg.size-\[5px\] { width: min(calc(5px * var(--ui-font-scale, 1)), calc(2.5px + 2.5px * var(--ui-font-scale, 1))); height: min(calc(5px * var(--ui-font-scale, 1)), calc(2.5px + 2.5px * var(--ui-font-scale, 1))); }
- & svg.size-\[6px\] { width: min(calc(6px * var(--ui-font-scale, 1)), calc(3px + 3px * var(--ui-font-scale, 1))); height: min(calc(6px * var(--ui-font-scale, 1)), calc(3px + 3px * var(--ui-font-scale, 1))); }
- & svg.size-\[10px\] { width: min(calc(10px * var(--ui-font-scale, 1)), calc(5px + 5px * var(--ui-font-scale, 1))); height: min(calc(10px * var(--ui-font-scale, 1)), calc(5px + 5px * var(--ui-font-scale, 1))); }
- & svg.size-\[11px\] { width: min(calc(11px * var(--ui-font-scale, 1)), calc(5.5px + 5.5px * var(--ui-font-scale, 1))); height: min(calc(11px * var(--ui-font-scale, 1)), calc(5.5px + 5.5px * var(--ui-font-scale, 1))); }
- & svg.size-\[12px\] { width: min(calc(12px * var(--ui-font-scale, 1)), calc(6px + 6px * var(--ui-font-scale, 1))); height: min(calc(12px * var(--ui-font-scale, 1)), calc(6px + 6px * var(--ui-font-scale, 1))); }
- & svg.size-\[13px\] { width: min(calc(13px * var(--ui-font-scale, 1)), calc(6.5px + 6.5px * var(--ui-font-scale, 1))); height: min(calc(13px * var(--ui-font-scale, 1)), calc(6.5px + 6.5px * var(--ui-font-scale, 1))); }
- & svg.size-\[14px\] { width: min(calc(14px * var(--ui-font-scale, 1)), calc(7px + 7px * var(--ui-font-scale, 1))); height: min(calc(14px * var(--ui-font-scale, 1)), calc(7px + 7px * var(--ui-font-scale, 1))); }
- & svg.size-\[15px\] { width: min(calc(15px * var(--ui-font-scale, 1)), calc(7.5px + 7.5px * var(--ui-font-scale, 1))); height: min(calc(15px * var(--ui-font-scale, 1)), calc(7.5px + 7.5px * var(--ui-font-scale, 1))); }
- & svg.size-\[15\.5px\] { width: min(calc(15.5px * var(--ui-font-scale, 1)), calc(7.75px + 7.75px * var(--ui-font-scale, 1))); height: min(calc(15.5px * var(--ui-font-scale, 1)), calc(7.75px + 7.75px * var(--ui-font-scale, 1))); }
- & svg.size-\[16px\] { width: var(--ui-icon-size); height: var(--ui-icon-size); }
- & svg.size-\[17px\] { width: var(--ui-icon-size); height: var(--ui-icon-size); }
- & svg.size-\[18px\] { width: var(--ui-icon-size); height: var(--ui-icon-size); }
- & svg.size-\[18\.5px\] { width: var(--ui-icon-size); height: var(--ui-icon-size); }
- & svg.size-\[20px\] { width: var(--ui-icon-size); height: var(--ui-icon-size); }
- & svg.size-\[21px\] { width: var(--ui-icon-size); height: var(--ui-icon-size); }
- & svg.size-\[22px\] { width: var(--ui-icon-size); height: var(--ui-icon-size); }
+ & svg.size-6 { width: calc(1.5rem * var(--ui-font-scale, 1)); height: calc(1.5rem * var(--ui-font-scale, 1)); }
+ & svg:is(.size-\[5px\], [class~='size-[calc(5px*var(--ui-space-scale,1))]']) { width: calc(5px * var(--ui-font-scale, 1)); height: calc(5px * var(--ui-font-scale, 1)); }
+ & svg:is(.size-\[6px\], [class~='size-[calc(6px*var(--ui-space-scale,1))]']) { width: calc(6px * var(--ui-font-scale, 1)); height: calc(6px * var(--ui-font-scale, 1)); }
+ & svg:is(.size-\[10px\], [class~='size-[calc(10px*var(--ui-space-scale,1))]']) { width: calc(10px * var(--ui-font-scale, 1)); height: calc(10px * var(--ui-font-scale, 1)); }
+ & svg:is(.size-\[11px\], [class~='size-[calc(11px*var(--ui-space-scale,1))]']) { width: calc(11px * var(--ui-font-scale, 1)); height: calc(11px * var(--ui-font-scale, 1)); }
+ & svg:is(.size-\[12px\], [class~='size-[calc(12px*var(--ui-space-scale,1))]']) { width: calc(12px * var(--ui-font-scale, 1)); height: calc(12px * var(--ui-font-scale, 1)); }
+ & svg:is(.size-\[13px\], [class~='size-[calc(13px*var(--ui-space-scale,1))]']) { width: calc(13px * var(--ui-font-scale, 1)); height: calc(13px * var(--ui-font-scale, 1)); }
+ & svg:is(.size-\[14px\], [class~='size-[calc(14px*var(--ui-space-scale,1))]']) { width: calc(14px * var(--ui-font-scale, 1)); height: calc(14px * var(--ui-font-scale, 1)); }
+ & svg:is(.size-\[15px\], [class~='size-[calc(15px*var(--ui-space-scale,1))]']) { width: calc(15px * var(--ui-font-scale, 1)); height: calc(15px * var(--ui-font-scale, 1)); }
+ & svg:is(.size-\[15\.5px\], [class~='size-[calc(15.5px*var(--ui-space-scale,1))]']) { width: calc(15.5px * var(--ui-font-scale, 1)); height: calc(15.5px * var(--ui-font-scale, 1)); }
+ & svg:is(.size-\[16px\], [class~='size-[calc(16px*var(--ui-space-scale,1))]']) { width: var(--ui-icon-size); height: var(--ui-icon-size); }
+ & svg:is(.size-\[17px\], [class~='size-[calc(17px*var(--ui-space-scale,1))]']) { width: var(--ui-icon-size); height: var(--ui-icon-size); }
+ & svg:is(.size-\[18px\], [class~='size-[calc(18px*var(--ui-space-scale,1))]']) { width: var(--ui-icon-size); height: var(--ui-icon-size); }
+ & svg:is(.size-\[18\.5px\], [class~='size-[calc(18.5px*var(--ui-space-scale,1))]']) { width: var(--ui-icon-size); height: var(--ui-icon-size); }
+ & svg:is(.size-\[20px\], [class~='size-[calc(20px*var(--ui-space-scale,1))]']) { width: var(--ui-icon-size); height: var(--ui-icon-size); }
+ & svg:is(.size-\[21px\], [class~='size-[calc(21px*var(--ui-space-scale,1))]']) { width: var(--ui-icon-size); height: var(--ui-icon-size); }
+ & svg:is(.size-\[22px\], [class~='size-[calc(22px*var(--ui-space-scale,1))]']) { width: var(--ui-icon-size); height: var(--ui-icon-size); }
/* Mic and send sit above the shared glyph size. Must follow size-[NN]. */
& svg.unsloth-dictate-icon {
width: calc(var(--ui-icon-size) * 1.2);
@@ -3918,11 +3930,11 @@ body.sidebar-row-dragging * {
height: calc(var(--ui-icon-size) * 1.2);
}
}
- & svg.size-\[36px\] { width: min(calc(36px * var(--ui-font-scale, 1)), calc(18px + 18px * var(--ui-font-scale, 1))); height: min(calc(36px * var(--ui-font-scale, 1)), calc(18px + 18px * var(--ui-font-scale, 1))); }
- & svg.w-3 { width: min(calc(0.75rem * var(--ui-font-scale, 1)), calc(0.375rem + 0.375rem * var(--ui-font-scale, 1))); }
- & svg.h-3 { height: min(calc(0.75rem * var(--ui-font-scale, 1)), calc(0.375rem + 0.375rem * var(--ui-font-scale, 1))); }
- & svg.w-3\.5 { width: min(calc(0.875rem * var(--ui-font-scale, 1)), calc(0.4375rem + 0.4375rem * var(--ui-font-scale, 1))); }
- & svg.h-3\.5 { height: min(calc(0.875rem * var(--ui-font-scale, 1)), calc(0.4375rem + 0.4375rem * var(--ui-font-scale, 1))); }
+ & svg:is(.size-\[36px\], [class~='size-[calc(36px*var(--ui-space-scale,1))]']) { width: calc(36px * var(--ui-font-scale, 1)); height: calc(36px * var(--ui-font-scale, 1)); }
+ & svg.w-3 { width: calc(0.75rem * var(--ui-font-scale, 1)); }
+ & svg.h-3 { height: calc(0.75rem * var(--ui-font-scale, 1)); }
+ & svg.w-3\.5 { width: calc(0.875rem * var(--ui-font-scale, 1)); }
+ & svg.h-3\.5 { height: calc(0.875rem * var(--ui-font-scale, 1)); }
& svg.w-4 { width: var(--ui-icon-size); }
& svg.h-4 { height: var(--ui-icon-size); }
& svg.w-5 { width: var(--ui-icon-size); }
diff --git a/studio/frontend/src/lib/layout-scale.ts b/studio/frontend/src/lib/layout-scale.ts
new file mode 100644
index 00000000000..047d1ed6a21
--- /dev/null
+++ b/studio/frontend/src/lib/layout-scale.ts
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+/**
+ * The browser interface scale as a factor on layout px, for widths held in JS.
+ * Always 1 on desktop, where webview zoom already scales every px. No imports,
+ * so width stores stay loadable without the app.
+ */
+let factor = 1;
+const listeners = new Set<() => void>();
+
+export function layoutScale(): number {
+ return factor;
+}
+
+export function setLayoutScale(next: number): void {
+ if (next === factor) return;
+ factor = next;
+ for (const listener of listeners) listener();
+}
+
+export function subscribeLayoutScale(listener: () => void): () => void {
+ listeners.add(listener);
+ return () => {
+ listeners.delete(listener);
+ };
+}
diff --git a/studio/frontend/tests/connected-model-row-actions.test.ts b/studio/frontend/tests/connected-model-row-actions.test.ts
index 8896eec859e..1758a974619 100644
--- a/studio/frontend/tests/connected-model-row-actions.test.ts
+++ b/studio/frontend/tests/connected-model-row-actions.test.ts
@@ -554,7 +554,7 @@ test("a row with no heading over it still names its connection", () => {
// own left edge is ~30px in and a tooltip opening that way ran off screen.
assert.match(
pickers,
- /<TooltipContent\s*side="right"\s*className="tooltip-compact max-w-\[15rem\] break-words"/,
+ /<TooltipContent\s*side="right"\s*className="tooltip-compact max-w-\[calc\(15rem\*var\(--ui-space-scale,1\)\)\] break-words"/,
);
});
diff --git a/studio/frontend/tests/find-in-page.test.ts b/studio/frontend/tests/find-in-page.test.ts
index 86ddb29e279..0ff4d64aed0 100644
--- a/studio/frontend/tests/find-in-page.test.ts
+++ b/studio/frontend/tests/find-in-page.test.ts
@@ -1499,8 +1499,8 @@ test("the bar stays out of a backgrounded scope, and off the document origin", a
// The counter grows from `1/2` to `1234/5000+` in a long chat. The pill must keep its nominal
// responsive width and let the query field yield that already-reserved room instead of growing.
// 22.25/28.25rem is exactly the previous short-counter width: fixed input + 12rem chrome.
- assert.match(surface[1], /(?:^|\s)w-\[22\.25rem\](?:\s|$)/);
- assert.match(surface[1], /(?:^|\s)sm:w-\[28\.25rem\](?:\s|$)/);
+ assert.match(surface[1], /(?:^|\s)w-\[calc\(22\.25rem\*var\(--ui-space-scale,1\)\)\](?:\s|$)/);
+ assert.match(surface[1], /(?:^|\s)sm:w-\[calc\(28\.25rem\*var\(--ui-space-scale,1\)\)\](?:\s|$)/);
// Either form: the field's classes are the point, not whether they go
// through cn().
const input = /<input[\s\S]*?className=\{?(?:cn\()?\s*"([^"]*)"/.exec(
diff --git a/studio/frontend/tests/interface-scale.test.ts b/studio/frontend/tests/interface-scale.test.ts
index 5a8646cd10e..ff6b4cd5d76 100644
--- a/studio/frontend/tests/interface-scale.test.ts
+++ b/studio/frontend/tests/interface-scale.test.ts
@@ -38,6 +38,7 @@ type InterfaceScaleModule = {
sanitizeInterfaceScale: (value: unknown) => number;
interfaceScaleToZoom: (scale: number) => number;
getAppliedInterfaceZoom: () => number;
+ webInterfaceScaleFactor: (scale: number) => number;
applyInterfaceScale: (scale: number) => Promise<void>;
applyInterfaceScaleBeforeFirstPaint: (
scale: number,
@@ -73,6 +74,7 @@ async function load(tauri: boolean) {
documentElement: {
style: {
setProperty: (name: string, value: string) => styles.set(name, value),
+ removeProperty: (name: string) => styles.delete(name),
},
},
});
@@ -266,6 +268,51 @@ test("browser scale never calls the native webview", async () => {
assert.deepEqual(control.zooms, []);
});
+test("browser scale resizes the UI through the tokens", async () => {
+ // The page cannot zoom itself: CSS zoom on the root overflows every
+ // viewport unit. It multiplies the font scale instead, which spacing and
+ // icons derive from.
+ const { mod, styles } = await load(false);
+ await mod.applyInterfaceScale(125);
+ assert.equal(styles.get("--ui-interface-scale"), "1.25");
+ assert.equal(mod.webInterfaceScaleFactor(125), 1.25);
+ // At 100% nothing is left behind, so the default document is unchanged.
+ await mod.applyInterfaceScale(100);
+ assert.equal(styles.has("--ui-interface-scale"), false);
+ // Never below the floor, same as the desktop zoom.
+ await mod.applyInterfaceScaleBeforeFirstPaint(10, 5_000);
+ assert.equal(styles.get("--ui-interface-scale"), "0.5");
+});
+
+test("desktop scale leaves the tokens to the webview zoom", async () => {
+ const { mod, styles } = await load(true);
+ assert.equal(mod.webInterfaceScaleFactor(150), 1);
+ await mod.applyInterfaceScale(150);
+ assert.equal(styles.has("--ui-interface-scale"), false);
+});
+
+test("the scale reaches the tokens and their JS twin", async () => {
+ const css = await readFile(
+ new URL("../src/index.css", import.meta.url),
+ "utf8",
+ );
+ assert.match(
+ css,
+ /--ui-font-scale: calc\(var\(--ui-font-size-scale, 0\.9375\) \* var\(--ui-interface-scale, 1\)\);/,
+ );
+ const hook = await readFile(
+ new URL("../src/hooks/use-ui-space-scale.ts", import.meta.url),
+ "utf8",
+ );
+ assert.match(hook, /webInterfaceScaleFactor\(interfaceScale\)/);
+ const snapshot = await readFile(
+ new URL("../public/reload-snapshot.js", import.meta.url),
+ "utf8",
+ );
+ assert.ok(snapshot.includes('"--ui-interface-scale"'));
+ assert.ok(snapshot.includes('"--ui-font-size-scale"'));
+});
+
test("desktop capability allows webview zoom", async () => {
const capabilities = JSON.parse(await readFile(CAPABILITIES, "utf8")) as {
permissions: unknown[];
@@ -289,10 +336,9 @@ test("startup, live changes, and both resets use the local scale", async () => {
provider,
/useInterfaceScaleStore\(\(s\) => s\.scale\)[\s\S]*applyInterfaceScale\(interfaceScale\)/,
);
- assert.match(
- tab,
- /isTauri && \([\s\S]*settings\.appearance\.custom\.interfaceScale\.label/,
- );
+ // Every build: the browser scales through the tokens, desktop through zoom.
+ assert.match(tab, /settings\.appearance\.custom\.interfaceScale\.label/);
+ assert.doesNotMatch(tab, /isTauri && \(/);
assert.match(controls, /resetAll\(\);\s*resetInterfaceScale\(\);/);
assert.match(general, /INTERFACE_SCALE_STORAGE_KEY/);
});
diff --git a/studio/frontend/tests/model-picker-partial-downloads.test.ts b/studio/frontend/tests/model-picker-partial-downloads.test.ts
index 33d033ce0f0..c1e7f63c1d1 100644
--- a/studio/frontend/tests/model-picker-partial-downloads.test.ts
+++ b/studio/frontend/tests/model-picker-partial-downloads.test.ts
@@ -74,7 +74,7 @@ test("a partial is marked the way the Hub marks one", () => {
const start = PICKERS.indexOf("function PartialBadge(");
assert.ok(start > 0, "the picker has a partial mark");
const badge = PICKERS.slice(start, PICKERS.indexOf("\n}", start));
- assert.match(badge, /size-\[5px\] rounded-full bg-status-warning/);
+ assert.match(badge, /size-\[calc\(5px\*var\(--ui-space-scale,1\)\)\] rounded-full bg-status-warning/);
assert.match(badge, /aria-label="Partial download"/);
assert.ok(
MODELS_TABLE.includes('aria-label="Partial download"') &&
diff --git a/studio/frontend/tests/research-activity-visuals.test.ts b/studio/frontend/tests/research-activity-visuals.test.ts
index ccc933bc75a..5cc39b6b4ac 100644
--- a/studio/frontend/tests/research-activity-visuals.test.ts
+++ b/studio/frontend/tests/research-activity-visuals.test.ts
@@ -41,7 +41,7 @@ test("timeline labels, icons, times, and disclosure controls share one center",
assert.match(trigger, /relative flex min-h-10 w-full items-center/);
assert.match(
trigger,
- /absolute -left-7 top-1\/2 flex size-\[15px\] -translate-y-1\/2/,
+ /absolute -left-7 top-1\/2 flex size-\[calc\(15px\*var\(--ui-space-scale,1\)\)\] -translate-y-1\/2/,
);
assert.doesNotMatch(trigger, /items-start|className="mt-0\.5 shrink-0/);
});
diff --git a/studio/frontend/tests/settings-search.test.ts b/studio/frontend/tests/settings-search.test.ts
index c413e4b01c4..0feb2892d68 100644
--- a/studio/frontend/tests/settings-search.test.ts
+++ b/studio/frontend/tests/settings-search.test.ts
@@ -27,12 +27,18 @@ test("browser update searches keep routing to About", () => {
assert.ok(index.about.includes(UPDATE_ENTRY));
});
-test("interface scale is searchable only on desktop", () => {
+test("interface scale is searchable on every build", () => {
+ // The browser build scales through the UI tokens, so the row renders there
+ // too and search has to find it.
const desktop = createSettingsSearchIndex({ desktop: true, closeToTray: true });
const browser = createSettingsSearchIndex({ desktop: false, closeToTray: false });
assert.ok(desktop.appearance.includes(INTERFACE_SCALE_ENTRY));
- assert.ok(!browser.appearance.includes(INTERFACE_SCALE_ENTRY));
+ assert.ok(browser.appearance.includes(INTERFACE_SCALE_ENTRY));
+ assert.equal(
+ desktop.appearance.filter((key) => key === INTERFACE_SCALE_ENTRY).length,
+ 1,
+ );
});
// The words a user types for this feature are not substrings of any of its
diff --git a/studio/frontend/tests/sidebar-action-rows-inert.test.ts b/studio/frontend/tests/sidebar-action-rows-inert.test.ts
index ff1abaddf1b..44369c61e56 100644
--- a/studio/frontend/tests/sidebar-action-rows-inert.test.ts
+++ b/studio/frontend/tests/sidebar-action-rows-inert.test.ts
@@ -69,10 +69,11 @@ test("navigation rows align while the profile footer ignores the scroll rail", a
// lose the rail's width, so New Chat adds it back and both end on one edge.
// The profile footer is unrelated to that list and must keep its full width
// when the scrollbar appears. Logical sides, since the rail moves under rtl.
+ // Both insets scale; only the measured rail stays fixed.
const source = APP_SIDEBAR;
assert.match(
source,
- /const rowPadding = usesDesktopTitlebar\s*\?\s*"ps-\[5px\] pe-\[calc\(var\(--sidebar-rail,0px\)\+5px\)\]"\s*:\s*"ps-1\.5 pe-\[calc\(var\(--sidebar-rail,0px\)\+6px\)\]"/,
+ /const rowPadding = usesDesktopTitlebar\s*\?\s*"ps-\[5px\] pe-\[calc\(var\(--sidebar-rail,0px\)\+5px\*var\(--ui-space-scale,1\)\)\]"\s*:\s*"ps-1\.5 pe-\[calc\(var\(--sidebar-rail,0px\)\+6px\*var\(--ui-space-scale,1\)\)\]"/,
);
assert.match(
source,
diff --git a/studio/frontend/tests/sidebar-width.test.ts b/studio/frontend/tests/sidebar-width.test.ts
index 93dd37686eb..3ffa5268d28 100644
--- a/studio/frontend/tests/sidebar-width.test.ts
+++ b/studio/frontend/tests/sidebar-width.test.ts
@@ -56,6 +56,21 @@ test("re-evaluates the cap per call, so a resize can re-clamp", () => {
assert.equal(clampSidebarWidth(SIDEBAR_WIDTH_MAX), SIDEBAR_WIDTH_MAX);
});
+test("a scaled browser caps against the window in layout px", async () => {
+ // The panel renders at width * scale, so its share of the window has to be
+ // taken from the window at that scale, as desktop webview zoom does.
+ const { setLayoutScale } = await import("../src/lib/layout-scale.ts");
+ stubWindow.innerWidth = 1440;
+ setLayoutScale(2);
+ try {
+ assert.equal(clampSidebarWidth(SIDEBAR_WIDTH_MAX), 288);
+ assert.equal(clampSidebarWidth(270), 270);
+ } finally {
+ setLayoutScale(1);
+ }
+ assert.equal(clampSidebarWidth(SIDEBAR_WIDTH_MAX), SIDEBAR_WIDTH_MAX);
+});
+
// The reset action promises to clear every stored preference, so a persisted
// panel width that is missing from the list survives the reload.
test("persisted panel widths are cleared by the preference reset", async () => {
diff --git a/studio/frontend/tests/train-configure-preview-column.test.ts b/studio/frontend/tests/train-configure-preview-column.test.ts
index 0f53976cebd..82f624e2876 100644
--- a/studio/frontend/tests/train-configure-preview-column.test.ts
+++ b/studio/frontend/tests/train-configure-preview-column.test.ts
@@ -37,7 +37,9 @@ const TWO_COLUMN_RULE =
// arbitrary variants such as @min-[40rem] are captured too, so an unresolvable tier throws rather than dropping out of the budget
const CONFIGURE_GAP = /@([^/\s"]+)\/train-configure:gap-([\d.]+)/g;
const TRAIN_SECTION_TIER = /@([^/\s"]+)\/train-section:/g;
-const PAGE_MAX_WIDTH = /max-w-\[(\d+)px\]/;
+// The cap scales with the UI font size like the padding beside it; the tiers
+// below are read at the default, where the multiplier is 1.
+const PAGE_MAX_WIDTH = /max-w-\[(?:calc\()?(\d+)px(?:\*var\(--ui-space-scale,1\)\))?\]/;
const PAGE_PADDING = /(?:^|\s)sm:px-(\d+)(?:\s|$)/;
const CARD_BORDER = /\.elevated-card\s*\{[^}]*?border:\s*(\d+)px/;
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 4fb761e5957..aa60e005c77 100644
--- a/studio/frontend/tests/ui-font-size-scales-spacing.test.ts
+++ b/studio/frontend/tests/ui-font-size-scales-spacing.test.ts
@@ -37,7 +37,10 @@ test("the spacing scale is the font-size preference, normalised at the default",
CSS,
/--ui-space-scale:\s*calc\(var\(--ui-font-scale, 1\) \/ 0\.9375\);/,
);
- assert.match(CSS, /--ui-font-scale:\s*0\.9375;/);
+ assert.match(
+ CSS,
+ /--ui-font-scale:\s*calc\(var\(--ui-font-size-scale, 0\.9375\) \* var\(--ui-interface-scale, 1\)\);/,
+ );
});
test("every tailwind spacing utility goes through it", () => {
@@ -239,3 +242,286 @@ test("the stylesheet's comments stay comments", () => {
"the spacing step is no longer a declaration of its own",
);
});
+
+test("no hand-set length above a hairline skips the scale", () => {
+ // A one-off w-[232px] beside scaled text and padding is the cramped row the
+ // preference exists to fix. Hairlines and 1-3px nudges stay put; so do the
+ // images, which stage content at their own size, the desktop titlebar, which
+ // belongs to the OS window, and the activity grid, whose cells JS measures.
+ const FIXED_BY_DESIGN = new Set([
+ "components/tauri/window-titlebar.tsx",
+ "components/assistant-ui/image.tsx",
+ "components/assistant-ui/search-image.tsx",
+ "components/assistant-ui/tool-ui-image-generation.tsx",
+ "features/profile/components/stats/token-activity-card.tsx",
+ ]);
+ const LENGTH =
+ /(?<=[\s"'`:!(\[])-?(?:size|w|h|min-w|min-h|max-w|max-h|basis|gap|gap-x|gap-y|space-x|space-y|p|px|py|pt|pb|pl|pr|ps|pe|m|mx|my|mt|mb|ml|mr|ms|me|top|bottom|left|right|inset|inset-x|inset-y|start|end|translate-x|translate-y)-\[(\d*\.?\d+)(px|rem)\]/g;
+ const bare = SOURCES.filter(
+ (file) => /\.tsx?$/.test(file) && !FIXED_BY_DESIGN.has(file),
+ ).flatMap((file) =>
+ [...readSrc(file).matchAll(LENGTH)]
+ .filter((m) => Number(m[1]) * (m[2] === "rem" ? 16 : 1) > 3)
+ .map((m) => `${file}: ${m[0]}`),
+ );
+ assert.deepEqual(bare, [], "these lengths ignore the UI font size");
+});
+
+test("icons grow at the rate of the text beside them", () => {
+ // A half-rate curve left a 20px label beside an 18px glyph in a row padded
+ // for 20px, so the icons read shrunken at every size above the default.
+ assert.match(CSS, /--ui-icon-size: calc\(1rem \* var\(--ui-font-scale, 1\)\);/);
+ assert.match(
+ CSS,
+ /--ui-icon-size-sm: calc\(0\.875rem \* var\(--ui-font-scale, 1\)\);/,
+ );
+ assert.doesNotMatch(
+ CSS,
+ /min\(calc\([\d.]+(?:px|rem) \* var\(--ui-font-scale/,
+ "an icon is still on the half-rate curve",
+ );
+ // The scoped icon rules match an arbitrary glyph size in both spellings,
+ // or the scaled class slips past them.
+ for (const px of ["15", "18"]) {
+ assert.ok(
+ CSS.includes(
+ `& svg:is(.size-\\[${px}px\\], [class~='size-[calc(${px}px*var(--ui-space-scale,1))]'])`,
+ ),
+ `size-[${px}px] is matched in only one spelling`,
+ );
+ }
+});
+
+test("named widths scale, container breakpoints do not", () => {
+ // max-w-md holds the same scaled text as the rest, so it grows with it.
+ for (const [name, rem] of [
+ ["xs", "20rem"],
+ ["md", "28rem"],
+ ["2xl", "42rem"],
+ ["7xl", "80rem"],
+ ]) {
+ assert.ok(
+ CSS.includes(`--container-${name}: calc(${rem} * var(--ui-space-scale, 1));`),
+ `--container-${name} ignores the UI font size`,
+ );
+ }
+ // Declared outside @theme, so Tailwind still bakes the literal into every
+ // @container query (a query cannot read a custom property).
+ const theme = CSS.slice(CSS.indexOf("@theme inline {"));
+ assert.doesNotMatch(
+ theme.slice(0, theme.indexOf("\n}")),
+ /--container-md:/,
+ );
+});
+
+test("the plain stylesheets' controls follow the scale", () => {
+ const HUB = readSrc("features/hub/hub.css");
+ for (const rule of [".hub-action-btn {", ".hub-run-action-btn {", ".hub-download-fab {"]) {
+ const at = HUB.indexOf(rule);
+ assert.notEqual(at, -1, `${rule} is gone`);
+ const body = HUB.slice(at, HUB.indexOf("}", at));
+ assert.match(
+ body,
+ /(?:height|width): calc\([\d.]+rem \* var\(--ui-space-scale, 1\)\)/,
+ `${rule} has a fixed size`,
+ );
+ }
+ assert.match(
+ CSS,
+ /\.panel-slider \[data-slot="slider-thumb"\] \{\s*width: calc\(0\.875rem \* var\(--ui-space-scale, 1\)\) !important;/,
+ );
+});
+
+test("a scaled minimum never outgrows its own cap", () => {
+ // CSS lets min win over max, so an uncapped scaled minimum breaks the cap:
+ // at 200% a 20rem editor minimum is 40rem against a 48dvh maximum.
+ for (const [file, cap] of [
+ ["features/chat/chat-settings-sheet.tsx", "48dvh"],
+ ["features/model-picker/components/chat-template-editor-dialog.tsx", "50dvh"],
+ ] as const) {
+ assert.ok(
+ readSrc(file).includes(
+ `min-h-[min(calc(20rem*var(--ui-space-scale,1)),${cap})] max-h-[${cap}]`,
+ ),
+ `${file} lets its minimum pass its cap`,
+ );
+ }
+ // Popovers and selects stop at 100vw-32px, so their minimums do too.
+ for (const [file, width] of [
+ ["features/settings/tabs/agents-tab.tsx", "16rem"],
+ ["features/hub/catalog/gguf-download-card.tsx", "300px"],
+ ["features/hub/catalog/local-on-device-card.tsx", "220px"],
+ ] as const) {
+ assert.ok(
+ readSrc(file).includes(
+ `min-w-[min(calc(${width}*var(--ui-space-scale,1)),calc(100vw-32px))]`,
+ ),
+ `${file} can outgrow a narrow screen`,
+ );
+ }
+});
+
+test("a scaled dialog keeps the viewport cap it replaces", () => {
+ // A call-site max-h drops DialogContent's own viewport cap, so it restates it.
+ const cap = "calc(100dvh-var(--studio-window-chrome-top,0px)-2rem)";
+ for (const file of [
+ "features/recipe-studio/dialogs/config-dialog.tsx",
+ "features/recipe-studio/dialogs/import-dialog.tsx",
+ "features/recipe-studio/dialogs/preview-dialog.tsx",
+ "features/recipe-studio/dialogs/processors-dialog.tsx",
+ ]) {
+ assert.ok(
+ readSrc(file).includes(`max-h-[min(calc(650px*var(--ui-space-scale,1)),${cap})]`),
+ `${file} can outgrow the viewport`,
+ );
+ }
+});
+
+test("the response details sheet scales its width, not only its cap", () => {
+ const sheet = readSrc("components/assistant-ui/message-response-details-sheet.tsx");
+ assert.ok(sheet.includes("w-[min(calc(28rem*var(--ui-space-scale,1)),100vw)]"));
+ assert.ok(sheet.includes("sm:max-w-[calc(28rem*var(--ui-space-scale,1))]"));
+});
+
+test("a sidebar row's inset scales on both sides", () => {
+ // Only the measured scrollbar rail stays fixed.
+ assert.ok(
+ SIDEBAR.includes(
+ '"ps-[calc(5px*var(--ui-space-scale,1))] pe-[calc(var(--sidebar-rail,0px)+5px*var(--ui-space-scale,1))]"',
+ ),
+ );
+ assert.ok(
+ SIDEBAR.includes('"ps-1.5 pe-[calc(var(--sidebar-rail,0px)+6px*var(--ui-space-scale,1))]"'),
+ );
+});
+
+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.
+ 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", "md"],
+ ] as const) {
+ const source = readSrc(file);
+ assert.ok(
+ source.includes(
+ `${split}:w-[min(calc(${width}*var(--ui-space-scale,1)),calc(100%-13rem))]`,
+ ),
+ `${file} rail can outgrow its split`,
+ );
+ if (split !== "md") {
+ assert.ok(
+ source.includes(
+ `grid-cols-[minmax(0,calc(${width}*var(--ui-space-scale,1)))_minmax(13rem,1fr)]`,
+ ),
+ `${file} header column drifts from its rail`,
+ );
+ }
+ }
+});
+
+test("the settings rail never takes more than half the dialog", () => {
+ assert.ok(
+ readSrc("features/settings/settings-dialog.tsx").includes(
+ "w-[min(calc(248px*var(--ui-space-scale,1)),50%)] shrink-0",
+ ),
+ );
+});
+
+test("a menu's height cap keeps Radix's available height", () => {
+ // A call-site max-h replaces the component's collision cap through cn.
+ const menu =
+ /<(DropdownMenuContent|DropdownMenuSubContent|SelectContent|ContextMenuContent|ContextMenuSubContent)\b([^>]*)>/g;
+ for (const file of SOURCES) {
+ for (const [, tag, props] of readSrc(file).matchAll(menu)) {
+ for (const [cap] of (props ?? "").matchAll(/max-h-\S+/g)) {
+ assert.match(
+ cap,
+ /var\(--radix-[a-z-]+-content-available-height\)/,
+ `${file} <${tag}> ${cap} can run offscreen`,
+ );
+ }
+ }
+ }
+});
+
+test("settings stacks its rail where the scaled dialog is too narrow for it", () => {
+ // max-sm ignored the scale: at 200% a 1000px window kept a 480px pane.
+ const dialog = readSrc("features/settings/settings-dialog.tsx");
+ assert.match(dialog, /const width = 608 \* useUiSpaceScale\(\);/);
+ assert.match(dialog, /`\(width < \$\{width \+ 32\}px\)`/);
+ assert.match(dialog, /return width > 960 \|\| narrow;/);
+ assert.match(dialog, /data-stacked=\{stacked \|\| undefined\}/);
+ // Only the full-screen dialog shell stays on the viewport breakpoint.
+ const shell = dialog.match(/max-sm:[^\s"]+/g) ?? [];
+ assert.deepEqual(shell.sort(), [
+ "max-sm:!max-w-none",
+ "max-sm:h-[calc(100dvh-var(--studio-window-chrome-top,0px))]",
+ "max-sm:rounded-none",
+ "max-sm:w-dvw",
+ ]);
+});
+
+test("composite settings controls shrink inside their row", () => {
+ // A fixed width's min-content blocks the row's max-w-full cap unless each
+ // wrapper can shrink.
+ assert.ok(
+ readSrc("features/settings/tabs/general-tab.tsx").includes(
+ '<div className="flex min-w-0 flex-col items-end gap-1.5">\n <div className="flex max-w-full items-center gap-2">\n <div className="relative w-[calc(260px*var(--ui-space-scale,1))] min-w-0">',
+ ),
+ );
+ assert.ok(
+ readSrc("features/settings/tabs/debugging-tab.tsx").includes(
+ '"flex max-w-full shrink-0 flex-wrap items-center justify-end gap-1"',
+ ),
+ );
+ // The GPU meter sits in a plain row, so it caps and wraps under the name.
+ const resources = readSrc("features/settings/tabs/resources-tab.tsx");
+ assert.ok(resources.includes("flex min-w-0 flex-wrap items-center justify-between"));
+ assert.ok(
+ resources.includes(
+ '"flex w-[min(calc(392px*var(--ui-space-scale,1)),100%)] shrink-0 flex-col',
+ ),
+ );
+});
+
+test("a scaled sheet width stops at the viewport", () => {
+ // Sheets overlay phones too: at 200% an 18rem sheet is 576px on a 375px screen.
+ const sheet = /<SheetContent\b([^>]*)>/g;
+ for (const file of SOURCES.filter((f) => f.endsWith(".tsx"))) {
+ for (const [, props] of readSrc(file).matchAll(sheet)) {
+ for (const [width] of (props ?? "").matchAll(/(?<![\w:-])w-\[[^\]\s"]*ui-space-scale[^\]\s"]*\]/g)) {
+ assert.match(width, /^w-\[min\(.*,100vw\)\]$/, `${file} ${width} can pass the viewport`);
+ }
+ }
+ }
+});
+
+test("resizable panels render their layout width at the browser scale", () => {
+ // Their contents scale, so a 280px shell at 200% clipped its own labels.
+ const sidebar = readSrc("components/ui/sidebar.tsx");
+ assert.equal(sidebar.match(/"--sidebar-width": `\$\{width \* widthScale\}px`/g)?.length, 2);
+ assert.ok(
+ readSrc("features/chat/chat-settings-sheet.tsx").includes(
+ '"--chat-settings-width": `${settingsWidth * settingsScale}px`',
+ ),
+ );
+ // The drag paints the same product and walks the pointer back to layout px.
+ const handle = readSrc("components/ui/panel-resize-handle.tsx");
+ assert.ok(handle.includes("paint(`${pendingRef.current * scaleRef.current}px`)"));
+ assert.ok(handle.includes("paint(`${committedRef.current * scaleRef.current}px`)"));
+ assert.ok(handle.includes("const next = drag.startWidth + delta / scaleRef.current"));
+ // Only the browser scale: desktop zoom already scales every px.
+ assert.ok(
+ readSrc("features/settings/stores/interface-scale-store.ts").includes(
+ "const zoom = interfaceScaleToZoom(scale);\n setLayoutScale(zoom);",
+ ),
+ );
+});
+
+test("the training start overlay never spills above its host", () => {
+ const overlay = readSrc("features/studio/training-start-overlay.tsx");
+ assert.ok(overlay.includes("absolute inset-0 z-30 flex flex-col items-center rounded-2xl"));
+ assert.ok(overlay.includes("pointer-events-auto relative my-auto flex"));
+});
diff --git a/studio/frontend/tests/update-banner-flex-priority.test.ts b/studio/frontend/tests/update-banner-flex-priority.test.ts
index afd80a50229..8cdb21b4d35 100644
--- a/studio/frontend/tests/update-banner-flex-priority.test.ts
+++ b/studio/frontend/tests/update-banner-flex-priority.test.ts
@@ -219,7 +219,7 @@ test("the llama.cpp card takes the desktop updater's floor only with its changel
// Only the conditional branch may carry a floor.
assert.doesNotMatch(classes(LLAMA, "pointer-events-auto flex "), /min-h-/);
assert.doesNotMatch(slot, /\bmin-h-0\b/);
- assert.ok(LLAMA.includes("max-w-[448px]"));
+ assert.ok(LLAMA.includes("max-w-[calc(448px*var(--ui-space-scale,1))]"));
});
test("the llama.cpp changelog uses the desktop update notes layout", () => {