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: round the right corners of scrollable tool result and thinking panes (#11409)

Michael Han175c07050e0e
diff --git a/studio/frontend/src/components/assistant-ui/attachment.tsx b/studio/frontend/src/components/assistant-ui/attachment.tsx
index f35d32cd254..47299ae79ef 100644
--- a/studio/frontend/src/components/assistant-ui/attachment.tsx
+++ b/studio/frontend/src/components/assistant-ui/attachment.tsx
@@ -52,6 +52,7 @@ import {
useRef,
useState,
} from "react";
+import { ScrollPane } from "./scroll-pane";
const AttachmentThumb: FC = () => {
const src = useAttachmentImageSrc();
@@ -155,9 +156,12 @@ const PastedTextPreviewDialog: FC<
<DialogTrigger asChild={true}>{children}</DialogTrigger>
<DialogContent className="aui-pasted-text-dialog flex max-h-[88dvh] w-[min(68rem,94vw)] max-w-none flex-col gap-3 overflow-hidden">
<DialogTitle className="truncate pr-8 text-sm">{name}</DialogTitle>
- <pre className="aui-pasted-text-dialog-body max-h-[72dvh] overflow-auto whitespace-pre-wrap break-words rounded-lg border bg-muted/40 p-3 text-left font-mono text-xs leading-relaxed">
+ <ScrollPane
+ className="aui-pasted-text-dialog-body rounded-lg border bg-muted/40 p-3"
+ scrollerClassName="max-h-[72dvh] overflow-auto whitespace-pre-wrap break-words text-left font-mono text-xs leading-relaxed"
+ >
{preview?.text ?? "Loading…"}
- </pre>
+ </ScrollPane>
{preview && preview.remaining > 0 ? (
<p className="text-muted-foreground text-xs">
{`First ${PASTED_TEXT_PREVIEW_MAX_CHARS.toLocaleString()} characters shown. ${preview.remaining.toLocaleString()} more were sent with the message.`}
diff --git a/studio/frontend/src/components/assistant-ui/composer-draft-preview.tsx b/studio/frontend/src/components/assistant-ui/composer-draft-preview.tsx
index 2f9a9d78dc8..0115e356458 100644
--- a/studio/frontend/src/components/assistant-ui/composer-draft-preview.tsx
+++ b/studio/frontend/src/components/assistant-ui/composer-draft-preview.tsx
@@ -25,8 +25,11 @@ export function ComposerDraftPreview({ text }: { text: string }) {
return (
<section
aria-label={t("composerSettings.preview")}
- className="mb-3 max-h-48 min-w-0 overflow-auto rounded-xl border border-border/60 bg-muted/20 p-3 text-sm"
+ className="mb-3 min-w-0 rounded-xl border border-border/60 bg-muted/20 p-3 text-sm"
>
+ {/* Scroller inset by the section's padding: a scrollbar flush with a rounded
+ edge squares the corners on its side. See ScrollPane. */}
+ <div className="max-h-48 min-w-0 overflow-auto">
<div className="mb-2 text-xs text-muted-foreground">
{t("composerSettings.preview")}
</div>
@@ -39,6 +42,7 @@ export function ComposerDraftPreview({ text }: { text: string }) {
>
{draft}
</Streamdown>
+ </div>
</section>
);
}
diff --git a/studio/frontend/src/components/assistant-ui/reasoning.tsx b/studio/frontend/src/components/assistant-ui/reasoning.tsx
index c0f1c7692b8..906deb2f79c 100644
--- a/studio/frontend/src/components/assistant-ui/reasoning.tsx
+++ b/studio/frontend/src/components/assistant-ui/reasoning.tsx
@@ -82,6 +82,7 @@ import {
useState,
} from "react";
import { useShallow } from "zustand/react/shallow";
+import { ScrollPane } from "./scroll-pane";
const ANIMATION_DURATION = 200;
const AUTO_SCROLL_THRESHOLD_PX = 24;
@@ -483,9 +484,12 @@ function OversizedReasoningCode({ source }: { source: string }) {
Showing part of an oversized code block. Copy reasoning preserves the
full source.
</p>
- <pre className="max-w-full overflow-x-auto whitespace-pre-wrap break-words rounded-md bg-muted/40 p-3 font-mono text-xs">
+ <ScrollPane
+ className="max-w-full rounded-md bg-muted/40 p-3"
+ scrollerClassName="overflow-x-auto whitespace-pre-wrap break-words font-mono text-xs"
+ >
{source}
- </pre>
+ </ScrollPane>
</div>
);
}
diff --git a/studio/frontend/src/components/assistant-ui/scroll-pane.tsx b/studio/frontend/src/components/assistant-ui/scroll-pane.tsx
new file mode 100644
index 00000000000..bb1d197b246
--- /dev/null
+++ b/studio/frontend/src/components/assistant-ui/scroll-pane.tsx
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import { cn } from "@/lib/utils";
+import type { ComponentProps, ReactNode } from "react";
+
+/**
+ * A capped, scrollable pane with rounded corners: tool results, thinking traces,
+ * pasted text.
+ *
+ * The wrapper paints the background and the scroller sits inside its padding. That split
+ * is the point. A space-reserving scrollbar (the app sets `scrollbar-width: thin`, so
+ * ~11px) is painted outside the element's border-radius clip, so a rounded scroller
+ * renders square on the scrollbar's side: right corners for a vertical bar, bottom for a
+ * horizontal one.
+ *
+ * Clipping it does not help. `clip-path`, `contain: paint`, an opaque `mask-image` and an
+ * `overflow: hidden` parent were all tried in the thread and all left the corners square,
+ * since a composited scroller's scrollbar escapes an ancestor's rounded clip too. Only
+ * insetting the scrollbar away from the corners works.
+ *
+ * So padding belongs on `className`, never on `scrollerClassName`, or the scrollbar is
+ * flush again. The max-height caps the scroller, so outer height is that plus padding.
+ */
+export function ScrollPane({
+ className,
+ scrollerClassName,
+ children,
+ ...props
+}: {
+ /** Wrapper: background, radius, border, margins, and the padding that insets the scrollbar. */
+ className?: string;
+ /** Scroller: max-height, overflow, and typography. No padding and no background here. */
+ scrollerClassName?: string;
+ children: ReactNode;
+} & Omit<ComponentProps<"div">, "className" | "children">) {
+ return (
+ <div className={cn("min-w-0", className)} {...props}>
+ <pre className={cn("min-w-0", scrollerClassName)}>{children}</pre>
+ </div>
+ );
+}
diff --git a/studio/frontend/src/components/assistant-ui/tool-ui-code-execution.tsx b/studio/frontend/src/components/assistant-ui/tool-ui-code-execution.tsx
index 91f0b26997e..cf770ae7626 100644
--- a/studio/frontend/src/components/assistant-ui/tool-ui-code-execution.tsx
+++ b/studio/frontend/src/components/assistant-ui/tool-ui-code-execution.tsx
@@ -24,6 +24,7 @@ import {
ToolFallbackTrigger,
} from "./tool-fallback";
import { useToolActivityOpen } from "./use-tool-activity-open";
+import { ScrollPane } from "./scroll-pane";
/**
* Renders synthetic `_toolEvent` chunks from `_stream_anthropic` for the
@@ -123,9 +124,12 @@ export function CodeExecutionResultOutput({ result }: { result: unknown }) {
<div className="flex justify-end">
<CopyBtn text={resultText} />
</div>
- <pre className="mt-1 max-h-64 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/50 p-2 text-xs">
+ <ScrollPane
+ className="mt-1 rounded bg-muted/50 p-2"
+ scrollerClassName="max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs"
+ >
{displayedResult}
- </pre>
+ </ScrollPane>
</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 d72f31b6b43..3c949322ba8 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
@@ -28,6 +28,7 @@ import { useToolActivityOpen } from "./use-tool-activity-open";
import { useDocumentPreviewStore } from "@/features/rag/components/preview-store";
import { type Citation, parseCitations } from "./citation-utils";
+import { ScrollPane } from "./scroll-pane";
export function CitationBadge({
citation,
@@ -138,9 +139,12 @@ const KnowledgeBaseToolUIImpl: ToolCallMessagePartComponent = ({
{docCount === 1 ? "" : "s"}. See Document Sources below.
</div>
) : resultText ? (
- <pre className="max-h-40 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/50 p-2 text-xs">
+ <ScrollPane
+ className="rounded bg-muted/50 p-2"
+ scrollerClassName="max-h-40 overflow-auto whitespace-pre-wrap break-words text-xs"
+ >
{resultText}
- </pre>
+ </ScrollPane>
) : (
<div className="text-sm text-muted-foreground">No matching passages.</div>
)}
diff --git a/studio/frontend/src/components/assistant-ui/tool-ui-read-skill.tsx b/studio/frontend/src/components/assistant-ui/tool-ui-read-skill.tsx
index c119065bd5b..d3d6586a2c4 100644
--- a/studio/frontend/src/components/assistant-ui/tool-ui-read-skill.tsx
+++ b/studio/frontend/src/components/assistant-ui/tool-ui-read-skill.tsx
@@ -17,6 +17,7 @@ import {
ToolFallbackTrigger,
} from "./tool-fallback";
import { useToolActivityOpen } from "./use-tool-activity-open";
+import { ScrollPane } from "./scroll-pane";
const ReadSkillToolUIImpl: ToolCallMessagePartComponent = ({
args,
@@ -58,9 +59,12 @@ const ReadSkillToolUIImpl: ToolCallMessagePartComponent = ({
<span>Reading {name}&hellip;</span>
</div>
) : resultText ? (
- <pre className="max-h-64 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/50 p-2 text-xs">
+ <ScrollPane
+ className="rounded bg-muted/50 p-2"
+ scrollerClassName="max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs"
+ >
{resultText}
- </pre>
+ </ScrollPane>
) : (
<div className="text-sm text-muted-foreground">
Loaded {resource}.
diff --git a/studio/frontend/src/components/assistant-ui/tool-ui-web-search.tsx b/studio/frontend/src/components/assistant-ui/tool-ui-web-search.tsx
index 00ccdab0035..e57d6c91189 100644
--- a/studio/frontend/src/components/assistant-ui/tool-ui-web-search.tsx
+++ b/studio/frontend/src/components/assistant-ui/tool-ui-web-search.tsx
@@ -29,6 +29,7 @@ import {
ToolFallbackTrigger,
} from "./tool-fallback";
import { useToolActivityOpen } from "./use-tool-activity-open";
+import { ScrollPane } from "./scroll-pane";
interface ParsedSource {
title: string;
@@ -247,9 +248,12 @@ const WebSearchToolUIImpl: ToolCallMessagePartComponent = ({
))}
</div>
{resultText && (
- <pre className="max-h-40 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/50 p-2 text-xs">
+ <ScrollPane
+ className="rounded bg-muted/50 p-2"
+ scrollerClassName="max-h-40 overflow-auto whitespace-pre-wrap break-words text-xs"
+ >
{resultText}
- </pre>
+ </ScrollPane>
)}
</div>
) : sources.length > 0 ? (
@@ -284,9 +288,12 @@ const WebSearchToolUIImpl: ToolCallMessagePartComponent = ({
)}
</div>
) : resultText ? (
- <pre className="max-h-40 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/50 p-2 text-xs">
+ <ScrollPane
+ className="rounded bg-muted/50 p-2"
+ scrollerClassName="max-h-40 overflow-auto whitespace-pre-wrap break-words text-xs"
+ >
{resultText}
- </pre>
+ </ScrollPane>
) : null}
</div>
)}