Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: tidy the Skills dialog rows and fields (#12332)

Michael Han6b5ec6f3647b
diff --git a/studio/frontend/src/features/chat/components/chat-skills-dialog.tsx b/studio/frontend/src/features/chat/components/chat-skills-dialog.tsx
index bec4f2b5e59..77fcf0cbbee 100644
--- a/studio/frontend/src/features/chat/components/chat-skills-dialog.tsx
+++ b/studio/frontend/src/features/chat/components/chat-skills-dialog.tsx
@@ -31,7 +31,7 @@ import {
ArrowLeft01Icon,
ArrowRight01Icon,
PlusSignIcon,
- RefreshIcon,
+ Refresh01Icon,
Scroll01Icon,
Search01Icon,
} from "@hugeicons/core-free-icons";
@@ -41,6 +41,7 @@ import {
type ReactElement,
type ReactNode,
useEffect,
+ useId,
useMemo,
useRef,
useState,
@@ -382,13 +383,13 @@ export function ChatSkillsDialog({
<Button
type="button"
size="icon-sm"
- variant="outline"
+ variant="ghost"
disabled={loading}
onClick={refresh}
aria-label={t("skills.refresh")}
title={t("skills.refresh")}
>
- {loading ? <Spinner /> : <HugeiconsIcon icon={RefreshIcon} strokeWidth={2} />}
+ {loading ? <Spinner /> : <HugeiconsIcon icon={Refresh01Icon} strokeWidth={2} />}
</Button>
<Button type="button" size="sm" onClick={openNew}>
<HugeiconsIcon icon={PlusSignIcon} strokeWidth={2} />
@@ -406,9 +407,9 @@ export function ChatSkillsDialog({
sections
.filter((section) => section.skills.length > 0)
.map((section) => (
- <section key={section.source} className="space-y-2">
- <div className="flex items-baseline justify-between gap-3 px-1">
- <h3 className="text-xs font-medium text-muted-foreground">
+ <section key={section.source} className="space-y-3">
+ <div className="flex min-w-0 items-baseline gap-2 px-1">
+ <h3 className="shrink-0 text-xs font-medium text-muted-foreground">
{t(`skills.section${sectionSuffix(section.source)}`)}
</h3>
<p className="truncate text-ui-11 text-muted-foreground/70">
@@ -716,60 +717,74 @@ function SkillRow({
}): ReactElement {
const t = useT();
const usable = skill.valid && !skill.shadowed;
+ const descriptionId = useId();
+ // The details button covers the row; the switch sits above it, not inside it.
return (
<div
- role="button"
- tabIndex={0}
- aria-label={skill.name}
- onClick={onOpen}
- onKeyDown={(event) => {
- if (event.key === "Enter" || event.key === " ") {
- event.preventDefault();
- onOpen();
- }
- }}
className={cn(
- "group flex cursor-pointer items-center gap-3 rounded-xl border border-border/60 bg-muted/20 px-4 py-3 transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring dark:border-transparent dark:bg-[rgb(255_255_255_/_calc(0.06*var(--contrast-wash-gain,1)))]",
+ "group relative grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-10 gap-y-1.5 rounded-[14px] border border-border/60 bg-muted/20 px-5 py-4 transition-colors hover:bg-muted/50 dark:border-transparent dark:bg-[rgb(255_255_255_/_calc(0.06*var(--contrast-wash-gain,1)))]",
skill.shadowed && "opacity-60",
)}
>
- <div className="min-w-0 flex-1">
- <div className="flex flex-wrap items-center gap-2">
- <span className="truncate font-medium">{skill.name}</span>
- {skill.shadowed ? <Badge variant="secondary">{t("skills.shadowed")}</Badge> : null}
- {skill.linked ? <Badge variant="outline">{t("skills.linked")}</Badge> : null}
- {skill.valid ? null : <Badge variant="destructive">{t("skills.invalid")}</Badge>}
- </div>
- <p
- className={cn(
- "mt-0.5 line-clamp-2 text-sm",
- skill.valid ? "text-muted-foreground" : "text-destructive",
- )}
- >
- {skill.valid ? skill.description : skill.error}
- </p>
+ <button
+ type="button"
+ onClick={onOpen}
+ aria-label={skill.name}
+ aria-describedby={descriptionId}
+ title={(skill.valid ? skill.description : skill.error) ?? undefined}
+ className="absolute inset-0 cursor-pointer rounded-[14px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
+ />
+ <div className="flex min-w-0 flex-wrap items-center gap-2">
+ <span className="truncate font-medium text-ui-14">{skill.name}</span>
+ {skill.shadowed ? <Badge variant="secondary">{t("skills.shadowed")}</Badge> : null}
+ {skill.linked ? <Badge variant="outline">{t("skills.linked")}</Badge> : null}
+ {skill.valid ? null : <Badge variant="destructive">{t("skills.invalid")}</Badge>}
</div>
- <span
- className="shrink-0"
- onClick={(event) => event.stopPropagation()}
- onKeyDown={(event) => event.stopPropagation()}
+ {/* Lowercase text reads lower than its box, so the controls drop to its x-height. */}
+ <Switch
+ className="translate-y-[0.11em] text-ui-14"
+ checked={usable && skill.enabled}
+ disabled={!usable || changing}
+ aria-label={t(skill.enabled ? "skills.disable" : "skills.enable", { name: skill.name })}
+ onCheckedChange={onToggle}
+ />
+ <p
+ id={descriptionId}
+ className={cn(
+ "line-clamp-2 text-ui-13",
+ skill.valid ? "text-muted-foreground" : "text-destructive",
+ )}
>
- <Switch
- checked={usable && skill.enabled}
- disabled={!usable || changing}
- aria-label={t(skill.enabled ? "skills.disable" : "skills.enable", { name: skill.name })}
- onCheckedChange={onToggle}
+ {skill.valid ? skill.description : skill.error}
+ </p>
+ <span className="flex h-[1lh] translate-y-[0.1em] items-center self-start justify-self-center text-ui-13">
+ <HugeiconsIcon
+ icon={ArrowRight01Icon}
+ strokeWidth={2}
+ aria-hidden="true"
+ className="size-4 text-muted-foreground/50 transition-colors group-hover:text-foreground"
/>
</span>
- <HugeiconsIcon
- icon={ArrowRight01Icon}
- strokeWidth={2}
- className="size-4 shrink-0 text-muted-foreground/50 transition-colors group-hover:text-foreground"
- />
</div>
);
}
+// Fill and padding live on the wrapper so the scrollbar clears the rounded corners in every engine.
+// A label, so clicking the padding still focuses the field.
+function ScrollField({ htmlFor, children }: { htmlFor: string; children: ReactNode }): ReactElement {
+ return (
+ <label
+ htmlFor={htmlFor}
+ className="block cursor-text overflow-hidden rounded-xl border border-border bg-background py-3 pr-1.5 pl-3.5 transition-colors focus-within:border-ring dark:border-transparent dark:bg-[rgb(255_255_255_/_calc(0.06*var(--contrast-wash-gain,1)))] dark:focus-within:border-transparent dark:focus-within:bg-[rgb(255_255_255_/_calc(0.12*var(--contrast-wash-gain,1)))]"
+ >
+ {children}
+ </label>
+ );
+}
+
+const SCROLL_FIELD_TEXTAREA =
+ "min-h-0 resize-none rounded-none border-0 bg-transparent p-0 pr-2 focus-visible:bg-transparent dark:bg-transparent dark:focus-visible:bg-transparent";
+
function Field({
htmlFor,
label,
@@ -879,21 +894,24 @@ function Editor({
</span>
}
>
- <Textarea
- id={`${formId}-description`}
- value={description}
- rows={2}
- maxLength={1024}
- readOnly={readOnly}
- disabled={disabled}
- aria-label={t("skills.descriptionLabel")}
- placeholder={t("skills.descriptionPlaceholder")}
- onChange={(event) => onDescription(event.target.value)}
- className={cn(
- "max-h-[min(12rem,30vh)] min-h-[calc(4.5rem*var(--ui-space-scale,1))] overflow-y-auto leading-relaxed",
- readOnly && "text-muted-foreground",
- )}
- />
+ <ScrollField htmlFor={`${formId}-description`}>
+ <Textarea
+ id={`${formId}-description`}
+ value={description}
+ rows={2}
+ maxLength={1024}
+ readOnly={readOnly}
+ disabled={disabled}
+ aria-label={t("skills.descriptionLabel")}
+ placeholder={t("skills.descriptionPlaceholder")}
+ onChange={(event) => onDescription(event.target.value)}
+ className={cn(
+ SCROLL_FIELD_TEXTAREA,
+ "max-h-[min(12rem,30vh)] min-h-[calc(3rem*var(--ui-space-scale,1))] overflow-y-auto leading-relaxed",
+ readOnly && "text-muted-foreground",
+ )}
+ />
+ </ScrollField>
</Field>
<Field
htmlFor={`${formId}-instructions`}
@@ -905,21 +923,24 @@ function Editor({
</span>
}
>
- <Textarea
- id={`${formId}-instructions`}
- value={instructions}
- fieldSizing="fixed"
- readOnly={readOnly}
- disabled={disabled}
- spellCheck={false}
- aria-label={t("skills.instructionsLabel")}
- placeholder={t("skills.instructionsPlaceholder")}
- onChange={(event) => onInstructions(event.target.value)}
- className={cn(
- "h-[min(15rem,32dvh)] min-h-28 resize-y font-mono text-ui-13 leading-relaxed",
- readOnly && "text-muted-foreground",
- )}
- />
+ <ScrollField htmlFor={`${formId}-instructions`}>
+ <Textarea
+ id={`${formId}-instructions`}
+ value={instructions}
+ fieldSizing="fixed"
+ readOnly={readOnly}
+ disabled={disabled}
+ spellCheck={false}
+ aria-label={t("skills.instructionsLabel")}
+ placeholder={t("skills.instructionsPlaceholder")}
+ onChange={(event) => onInstructions(event.target.value)}
+ className={cn(
+ SCROLL_FIELD_TEXTAREA,
+ "h-[min(13.5rem,29dvh)] min-h-22 font-mono text-ui-12 leading-relaxed md:text-ui-12",
+ readOnly && "text-muted-foreground",
+ )}
+ />
+ </ScrollField>
</Field>
</form>
);