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: audio field titles stop focusing their field, quieter Optional tags (#15651)

Michael Han224faa2e569d
diff --git a/studio/frontend/src/features/audio/audio-options-fields.tsx b/studio/frontend/src/features/audio/audio-options-fields.tsx
index 567e65a1198..ce044d71e2c 100644
--- a/studio/frontend/src/features/audio/audio-options-fields.tsx
+++ b/studio/frontend/src/features/audio/audio-options-fields.tsx
@@ -22,6 +22,7 @@ import {
audioVoiceLabel,
coerceAudioOptionValue,
} from "./audio-options";
+import { FieldLabel } from "./components/field";
function OptionHint({ text }: { text?: string | null }) {
return text ? (
@@ -54,7 +55,7 @@ export function AudioOptionFields({
if (spec.type === "bool") {
return (
<div key={spec.name} className="grid gap-1.5">
- <label
+ <FieldLabel
htmlFor={id}
className="flex items-center justify-between gap-3 text-ui-13 font-medium text-foreground"
>
@@ -65,7 +66,7 @@ export function AudioOptionFields({
disabled={disabled}
onCheckedChange={(checked) => onChange(spec.name, checked)}
/>
- </label>
+ </FieldLabel>
<OptionHint text={spec.description} />
</div>
);
@@ -91,9 +92,9 @@ export function AudioOptionFields({
if (spec.type === "enum") {
return (
<div key={spec.name} className="grid gap-1.5">
- <label className="text-ui-13 font-medium text-foreground" htmlFor={id}>
+ <FieldLabel className="text-ui-13 font-medium text-foreground" htmlFor={id}>
{label}
- </label>
+ </FieldLabel>
<Select
value={typeof value === "string" ? value : undefined}
onValueChange={(next) => onChange(spec.name, next)}
@@ -117,9 +118,9 @@ export function AudioOptionFields({
const numeric = spec.type === "int" || spec.type === "float";
return (
<div key={spec.name} className="grid gap-1.5">
- <label className="text-ui-13 font-medium text-foreground" htmlFor={id}>
+ <FieldLabel className="text-ui-13 font-medium text-foreground" htmlFor={id}>
{label}
- </label>
+ </FieldLabel>
<Input
id={id}
type={numeric ? "number" : "text"}
diff --git a/studio/frontend/src/features/audio/components/field.tsx b/studio/frontend/src/features/audio/components/field.tsx
index 2c08bcee6af..d28d477f20d 100644
--- a/studio/frontend/src/features/audio/components/field.tsx
+++ b/studio/frontend/src/features/audio/components/field.tsx
@@ -1,27 +1,66 @@
// 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 type { ReactNode } from "react";
+import { cn } from "@/lib/utils";
+import type { MouseEvent, ReactNode } from "react";
+
+const CONTROL = "button, input, select, textarea, a[href], [role='switch']";
+
+/** `htmlFor` still names the control; a click on the title text is cancelled, one on a nested control is not. */
+export function FieldLabel({
+ htmlFor,
+ className,
+ children,
+}: {
+ htmlFor: string;
+ className?: string;
+ children: ReactNode;
+}) {
+ const onClick = (event: MouseEvent<HTMLLabelElement>) => {
+ if (!(event.target as Element).closest(CONTROL)) event.preventDefault();
+ };
+ return (
+ // biome-ignore lint/a11y/useKeyWithClickEvents: the handler only cancels the label's own activation.
+ <label
+ htmlFor={htmlFor}
+ onClick={onClick}
+ className={cn("cursor-default!", className)}
+ >
+ {children}
+ </label>
+ );
+}
+
+export function FieldTag({ children }: { children: ReactNode }) {
+ return (
+ <span className="ml-1.5 text-ui-11p5 font-normal text-muted-foreground/70">
+ {children}
+ </span>
+ );
+}
export function Field({
label,
+ optional = false,
hint,
htmlFor,
children,
}: {
label: string;
+ optional?: boolean;
hint?: string;
htmlFor: string;
children: ReactNode;
}) {
return (
<div className="grid gap-1.5">
- <label
+ <FieldLabel
className="text-ui-13 font-medium text-foreground"
htmlFor={htmlFor}
>
{label}
- </label>
+ {optional ? <FieldTag>Optional</FieldTag> : null}
+ </FieldLabel>
{children}
{hint ? (
<p className="text-ui-11p5 leading-snug text-muted-foreground">
diff --git a/studio/frontend/src/features/audio/components/language-select.tsx b/studio/frontend/src/features/audio/components/language-select.tsx
index da2f86a42cf..79dd69c15e2 100644
--- a/studio/frontend/src/features/audio/components/language-select.tsx
+++ b/studio/frontend/src/features/audio/components/language-select.tsx
@@ -9,6 +9,7 @@ import {
SelectValue,
} from "@/components/ui/select";
import { QWEN3_LANGUAGE_NAMES } from "../clone-policy";
+import { FieldLabel } from "./field";
// Radix Select cannot hold an empty value, so "no language" travels as this.
const AUTO = "__auto__";
@@ -34,9 +35,12 @@ export function LanguageSelect({
if (value && !names.includes(value)) names.push(value);
return (
<div className="grid gap-1.5">
- <label className="text-ui-13 font-medium text-foreground" htmlFor={id}>
+ <FieldLabel
+ className="text-ui-13 font-medium text-foreground"
+ htmlFor={id}
+ >
{label}
- </label>
+ </FieldLabel>
<Select
value={value || AUTO}
onValueChange={(next) => onChange(next === AUTO ? "" : next)}
diff --git a/studio/frontend/src/features/audio/components/lyrics-editor.tsx b/studio/frontend/src/features/audio/components/lyrics-editor.tsx
index c3a711ac417..933eb200c2a 100644
--- a/studio/frontend/src/features/audio/components/lyrics-editor.tsx
+++ b/studio/frontend/src/features/audio/components/lyrics-editor.tsx
@@ -14,10 +14,12 @@ import { HugeiconsIcon } from "@hugeicons/react";
import { useRef } from "react";
import { insertSectionTag, sectionTags } from "../music/music-policy";
import type { MusicModeRule } from "../music/music-types";
+import { FieldLabel, FieldTag } from "./field";
export function LyricsEditor({
id,
label,
+ optional = false,
value,
onChange,
sectionCase,
@@ -27,6 +29,7 @@ export function LyricsEditor({
}: {
id: string;
label: string;
+ optional?: boolean;
value: string;
onChange: (next: string) => void;
sectionCase: MusicModeRule["section_case"];
@@ -54,9 +57,13 @@ export function LyricsEditor({
return (
<div className="grid gap-1.5">
<div className="flex min-w-0 items-center justify-between gap-2">
- <label htmlFor={id} className="text-ui-13 font-medium text-foreground">
+ <FieldLabel
+ htmlFor={id}
+ className="text-ui-13 font-medium text-foreground"
+ >
{label}
- </label>
+ {optional ? <FieldTag>Optional</FieldTag> : null}
+ </FieldLabel>
<DropdownMenu>
<DropdownMenuTrigger asChild={true}>
<Button
diff --git a/studio/frontend/src/features/audio/components/music-edit-inputs.tsx b/studio/frontend/src/features/audio/components/music-edit-inputs.tsx
index e6fac55043b..70c82164f04 100644
--- a/studio/frontend/src/features/audio/components/music-edit-inputs.tsx
+++ b/studio/frontend/src/features/audio/components/music-edit-inputs.tsx
@@ -33,6 +33,7 @@ import {
import { Waveform } from "./waveform";
import { secondsBeyondEnd } from "./waveform-range";
import { WaveformRangeSelect } from "./waveform-range-select";
+import { FieldLabel } from "./field";
export { musicEditProblem } from "../music/music-edit-rules";
@@ -232,14 +233,14 @@ export function MusicEditInputs({
{action ? (
<div className="grid gap-1.5">
- <label
+ <FieldLabel
htmlFor={PROMPT_ID}
className="text-ui-13 font-medium text-foreground"
>
{editUsesStrength(action)
? "What should it sound like?"
: "What should the new part sound like?"}
- </label>
+ </FieldLabel>
<Textarea
id={PROMPT_ID}
value={draft.prompt}
diff --git a/studio/frontend/src/features/audio/components/transcript-diff-editor.tsx b/studio/frontend/src/features/audio/components/transcript-diff-editor.tsx
index d58a8938476..5d5d3155916 100644
--- a/studio/frontend/src/features/audio/components/transcript-diff-editor.tsx
+++ b/studio/frontend/src/features/audio/components/transcript-diff-editor.tsx
@@ -7,6 +7,7 @@ import { Textarea } from "@/components/ui/textarea";
import { type Ref, useMemo } from "react";
import { EDIT_DIFF_MAX_WORDS, countChanges, diffSegments } from "../edit-diff";
import { EDIT_COPY } from "../edit-policy";
+import { FieldLabel } from "./field";
export function TranscriptDiffEditor({
value,
@@ -41,12 +42,12 @@ export function TranscriptDiffEditor({
return (
<div className="grid gap-1.5" data-tour={dataTour}>
<div className="flex min-w-0 flex-wrap items-center justify-between gap-x-2 gap-y-1">
- <label
+ <FieldLabel
htmlFor={id}
className="whitespace-nowrap text-ui-13 font-medium text-foreground"
>
{EDIT_COPY.changesLabel}
- </label>
+ </FieldLabel>
<div className="flex shrink-0 items-center gap-1.5">
{changes === null ? (
<Badge variant="outline">Too long</Badge>
diff --git a/studio/frontend/src/features/audio/components/transcript-view.tsx b/studio/frontend/src/features/audio/components/transcript-view.tsx
index d96154e1cbb..b4f2ec4ce3a 100644
--- a/studio/frontend/src/features/audio/components/transcript-view.tsx
+++ b/studio/frontend/src/features/audio/components/transcript-view.tsx
@@ -36,6 +36,7 @@ import {
sanitizeSpeakerName,
speakerLabel,
} from "../transcript-model";
+import { FieldLabel } from "./field";
import { Waveform, type WaveformControl } from "./waveform";
import { decodePeaks } from "./waveform-decode";
@@ -131,9 +132,9 @@ function SpeakerChip({
</button>
</PopoverTrigger>
<PopoverContent align="start" className="w-64 gap-2 p-3">
- <label htmlFor={inputId} className="text-ui-13 font-medium">
+ <FieldLabel htmlFor={inputId} className="text-ui-13 font-medium">
Name
- </label>
+ </FieldLabel>
<Input
id={inputId}
value={draft}
diff --git a/studio/frontend/src/features/audio/pages/clone-page.tsx b/studio/frontend/src/features/audio/pages/clone-page.tsx
index cbc084e4bce..2d9e2432ffb 100644
--- a/studio/frontend/src/features/audio/pages/clone-page.tsx
+++ b/studio/frontend/src/features/audio/pages/clone-page.tsx
@@ -15,6 +15,7 @@ import {
AudioHistoryProvider,
AudioSourceInput,
} from "../components/audio-source-input";
+import { FieldLabel, FieldTag } from "../components/field";
import { LanguageSelect } from "../components/language-select";
import { SaveVoiceDialog } from "../components/save-voice-dialog";
import {
@@ -79,15 +80,15 @@ function CloneInputs({
{transcriptField === "hidden" ? null : (
<div className="grid gap-1.5" data-tour="audio-clone-transcript">
<div className="flex items-center justify-between gap-2">
- <label
+ <FieldLabel
htmlFor={CLONE_REFERENCE_TEXT_FIELD_ID}
className="text-ui-13 font-medium text-foreground"
>
What's said in the clip
- <span className="ml-1.5 font-normal text-muted-foreground">
+ <FieldTag>
{transcriptField === "required" ? "Required" : "Optional"}
- </span>
- </label>
+ </FieldTag>
+ </FieldLabel>
<Button
type="button"
variant="ghost"
@@ -140,12 +141,12 @@ function CloneInputs({
className="grid min-w-0 grid-cols-[minmax(0,1fr)] gap-1.5"
data-tour="audio-clone-text"
>
- <label
+ <FieldLabel
htmlFor={CLONE_TEXT_FIELD_ID}
className="text-ui-13 font-medium text-foreground"
>
Text to speak
- </label>
+ </FieldLabel>
<Textarea
data-type-to-activate="prompt"
id={CLONE_TEXT_FIELD_ID}
diff --git a/studio/frontend/src/features/audio/pages/convert-page.tsx b/studio/frontend/src/features/audio/pages/convert-page.tsx
index 12e6ccb2167..06cc7cb8eac 100644
--- a/studio/frontend/src/features/audio/pages/convert-page.tsx
+++ b/studio/frontend/src/features/audio/pages/convert-page.tsx
@@ -21,7 +21,7 @@ import { type AudioGalleryClip, fetchAudioBlob } from "../api";
import { audioModelLabel } from "../audio-workspace-utils";
import { sourceFileUrl } from "../audio-run-request";
import { ABCompare } from "../components/convert-ab-compare";
-import { Field } from "../components/field";
+import { Field, FieldLabel, FieldTag } from "../components/field";
import {
AudioHistoryProvider,
AudioSourceInput,
@@ -147,7 +147,7 @@ function ConvertInputs({
{pitchSupport.show ? (
<div className="grid gap-1.5">
{pitchSupport.auto ? (
- <label
+ <FieldLabel
htmlFor="convert-pitch-auto"
className="flex items-center justify-between gap-3 text-ui-13 font-medium text-foreground"
>
@@ -158,7 +158,7 @@ function ConvertInputs({
disabled={disabled}
onCheckedChange={store.setPitchAuto}
/>
- </label>
+ </FieldLabel>
) : null}
{pitchSupport.auto &&
convert.pitchAuto &&
@@ -208,15 +208,15 @@ function SourceTextField({
return (
<div className="grid gap-1.5">
<div className="flex items-center justify-between gap-2">
- <label
+ <FieldLabel
htmlFor={CONVERT_SOURCE_TEXT_FIELD_ID}
className="text-ui-13 font-medium text-foreground"
>
What's said in the recording
- <span className="ml-1.5 font-normal text-muted-foreground">
+ <FieldTag>
Required
- </span>
- </label>
+ </FieldTag>
+ </FieldLabel>
<Button
type="button"
variant="ghost"
diff --git a/studio/frontend/src/features/audio/pages/edit-page.tsx b/studio/frontend/src/features/audio/pages/edit-page.tsx
index 5508beaf507..20dc35a13b2 100644
--- a/studio/frontend/src/features/audio/pages/edit-page.tsx
+++ b/studio/frontend/src/features/audio/pages/edit-page.tsx
@@ -16,6 +16,7 @@ import {
AudioHistoryProvider,
AudioSourceInput,
} from "../components/audio-source-input";
+import { FieldLabel, FieldTag } from "../components/field";
import { TranscriptDiffEditor } from "../components/transcript-diff-editor";
import { EDIT_COPY } from "../edit-policy";
import {
@@ -86,17 +87,13 @@ function EditInputs({
<div className="grid gap-1.5" data-tour="audio-edit-transcript">
<div className="flex items-center justify-between gap-2">
- <label
+ <FieldLabel
htmlFor={EDIT_TRANSCRIPT_FIELD_ID}
className="text-ui-13 font-medium text-foreground"
>
{EDIT_COPY.transcriptLabel}
- {mode === "delivery" ? (
- <span className="ml-1.5 font-normal text-muted-foreground">
- Optional
- </span>
- ) : null}
- </label>
+ {mode === "delivery" ? <FieldTag>Optional</FieldTag> : null}
+ </FieldLabel>
<Button
type="button"
variant="ghost"
diff --git a/studio/frontend/src/features/audio/pages/music-page.tsx b/studio/frontend/src/features/audio/pages/music-page.tsx
index 512b085055a..4dcdc52f0bc 100644
--- a/studio/frontend/src/features/audio/pages/music-page.tsx
+++ b/studio/frontend/src/features/audio/pages/music-page.tsx
@@ -9,7 +9,7 @@ import { PillTabs } from "@/features/model-picker/components/model-selector/pill
import type { ComponentProps } from "react";
import type { AudioGalleryClip } from "../api";
import { AudioHistoryProvider } from "../components/audio-source-input";
-import { Field } from "../components/field";
+import { Field, FieldLabel } from "../components/field";
import { LyricsEditor } from "../components/lyrics-editor";
import { MusicEditInputs } from "../components/music-edit-inputs";
import type { MusicGeneration } from "../hooks/use-music-generation";
@@ -172,11 +172,8 @@ function SongInputs({
<>
<div className="grid min-w-0 grid-cols-[minmax(0,1fr)] gap-1.5">
<Field
- label={
- rule.description === "required"
- ? "Description"
- : "Description (optional)"
- }
+ label="Description"
+ optional={rule.description !== "required"}
htmlFor={MUSIC_DESCRIPTION_FIELD_ID}
>
<Textarea
@@ -212,7 +209,7 @@ function SongInputs({
</div>
{instrumental.shown ? (
<div className="grid gap-1">
- <label
+ <FieldLabel
htmlFor="music-instrumental"
className="flex items-center justify-between gap-3 text-ui-13 font-medium text-foreground"
>
@@ -225,7 +222,7 @@ function SongInputs({
patch("song", { instrumental: checked })
}
/>
- </label>
+ </FieldLabel>
<p className="text-ui-11p5 leading-snug text-muted-foreground">
{instrumental.reason ?? "No vocals; the lyrics are kept for later."}
</p>
@@ -235,7 +232,8 @@ function SongInputs({
<div className="grid gap-1.5">
<LyricsEditor
id={MUSIC_LYRICS_FIELD_ID}
- label={rule.lyrics === "required" ? "Lyrics" : "Lyrics (optional)"}
+ label="Lyrics"
+ optional={rule.lyrics !== "required"}
value={lyrics}
onChange={setLyrics}
sectionCase={rule.section_case}
diff --git a/studio/frontend/src/features/audio/pages/transcribe-page.tsx b/studio/frontend/src/features/audio/pages/transcribe-page.tsx
index 20873df59ae..9a7ab9d0d63 100644
--- a/studio/frontend/src/features/audio/pages/transcribe-page.tsx
+++ b/studio/frontend/src/features/audio/pages/transcribe-page.tsx
@@ -33,7 +33,7 @@ import {
type AudioSourceInputHandle,
} from "../components/audio-source-input";
import { SendToItems } from "../components/clip-card";
-import { Field } from "../components/field";
+import { Field, FieldLabel } from "../components/field";
import { TranscriptView } from "../components/transcript-view";
import {
TranscriptExportItems,
@@ -80,7 +80,7 @@ function SwitchRow({
const id = `transcribe-${name}`;
return (
<div className="grid gap-1.5">
- <label
+ <FieldLabel
htmlFor={id}
className="flex items-center justify-between gap-3 text-ui-13 font-medium text-foreground"
>
@@ -103,7 +103,7 @@ function SwitchRow({
aria-describedby={`${id}-hint`}
/>
)}
- </label>
+ </FieldLabel>
<p
id={`${id}-hint`}
className="text-ui-11p5 leading-snug text-muted-foreground"
diff --git a/studio/frontend/src/features/audio/tools/clone-panels.tsx b/studio/frontend/src/features/audio/tools/clone-panels.tsx
index 86a3adf38e5..5e8f30f7761 100644
--- a/studio/frontend/src/features/audio/tools/clone-panels.tsx
+++ b/studio/frontend/src/features/audio/tools/clone-panels.tsx
@@ -15,7 +15,7 @@ import { PillTabs } from "@/features/model-picker/components/model-selector/pill
import type { ReactNode } from "react";
import { INDEX_TTS2_EMOTIONS } from "../clone-policy";
import { AudioSourceInput } from "../components/audio-source-input";
-import { Field } from "../components/field";
+import { Field, FieldLabel } from "../components/field";
import {
type CosyVoiceMode,
type CosyVoiceModeValue,
@@ -62,7 +62,7 @@ const qwen3TimbrePanel: AudioToolPanel<TimbreOnlyValue> = {
...qwen3TimbreLogic,
Component: ({ value, onChange, disabled }) => (
<div className="grid gap-1.5">
- <label
+ <FieldLabel
htmlFor="clone-timbre-only"
className="flex items-center justify-between gap-3 text-ui-13 font-medium text-foreground"
>
@@ -73,7 +73,7 @@ const qwen3TimbrePanel: AudioToolPanel<TimbreOnlyValue> = {
disabled={disabled}
onCheckedChange={(timbreOnly) => onChange({ timbreOnly })}
/>
- </label>
+ </FieldLabel>
<p className="text-ui-11p5 leading-snug text-muted-foreground">
Copies the sound of the voice without the clip's words, so no transcript
is needed. Usually a little less close to the original.
@@ -267,12 +267,12 @@ const f5SpeedDialectPanel: AudioToolPanel<SpeedDialectValue> = {
/>
{specs.some((spec) => spec.name === "dialect") ? (
<div className="grid gap-1.5">
- <label
+ <FieldLabel
htmlFor="clone-dialect"
className="text-ui-13 font-medium text-foreground"
>
Dialect
- </label>
+ </FieldLabel>
<Select
value={value.dialect}
onValueChange={(dialect) => onChange({ ...value, dialect })}
diff --git a/studio/frontend/src/features/audio/tools/convert-panels.tsx b/studio/frontend/src/features/audio/tools/convert-panels.tsx
index 6c247fd9591..8d1dd5486ac 100644
--- a/studio/frontend/src/features/audio/tools/convert-panels.tsx
+++ b/studio/frontend/src/features/audio/tools/convert-panels.tsx
@@ -15,6 +15,7 @@ import { ChevronDownStandardIcon } from "@/lib/chevron-icons";
import { cn } from "@/lib/utils";
import { HugeiconsIcon } from "@hugeicons/react";
import type { ReactNode } from "react";
+import { FieldLabel } from "../components/field";
import {
CHATTERBOX_CONVERT_GUIDANCE_RANGE,
CHATTERBOX_CONVERT_STEPS_RANGE,
@@ -102,12 +103,12 @@ export const seedVcPanel: AudioToolPanel<SeedVcValue> = {
>
{singing ? null : (
<div className="grid gap-1.5">
- <label
+ <FieldLabel
htmlFor="convert-seed-vc-engine"
className="text-ui-13 font-medium text-foreground"
>
Engine
- </label>
+ </FieldLabel>
<Select
value={value.engine}
onValueChange={(engine) =>
@@ -196,7 +197,7 @@ export const seedVcPanel: AudioToolPanel<SeedVcValue> = {
/>
{v2 ? (
<div className="grid gap-1.5">
- <label
+ <FieldLabel
htmlFor="convert-seed-vc-anonymize"
className="flex items-center justify-between gap-3 text-ui-13 font-medium text-foreground"
>
@@ -209,7 +210,7 @@ export const seedVcPanel: AudioToolPanel<SeedVcValue> = {
onChange({ ...value, anonymize })
}
/>
- </label>
+ </FieldLabel>
<p className="text-ui-11p5 leading-snug text-muted-foreground">
Makes the voice hard to recognise instead of copying the target.
</p>
diff --git a/studio/frontend/src/features/audio/tools/music-panels.tsx b/studio/frontend/src/features/audio/tools/music-panels.tsx
index 3a3b03c350d..5bf9d742976 100644
--- a/studio/frontend/src/features/audio/tools/music-panels.tsx
+++ b/studio/frontend/src/features/audio/tools/music-panels.tsx
@@ -12,7 +12,7 @@ import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea";
import { ParamSlider } from "@/features/chat";
import { PillTabs } from "@/features/model-picker/components/model-selector/pill-tabs";
-import { Field } from "../components/field";
+import { Field, FieldLabel } from "../components/field";
import { PanelSection } from "./clone-panels";
import {
ACE_STEP_BPM,
@@ -76,7 +76,7 @@ export const aceStepMusicalPanel: AudioToolPanel<AceStepMusicalValue> = {
hint="Optional. Anything left on Auto is chosen by the model."
>
<div className="grid gap-1.5">
- <label
+ <FieldLabel
htmlFor="music-bpm-auto"
className="flex items-center justify-between gap-3 text-ui-13 font-medium text-foreground"
>
@@ -89,7 +89,7 @@ export const aceStepMusicalPanel: AudioToolPanel<AceStepMusicalValue> = {
onChange({ ...value, bpm: on ? ACE_STEP_BPM.default : null })
}
/>
- </label>
+ </FieldLabel>
{value.bpm !== null ? (
<ParamSlider
label="BPM"
diff --git a/studio/frontend/src/features/audio/tools/separate-panels.tsx b/studio/frontend/src/features/audio/tools/separate-panels.tsx
index ffa93bd813e..f3612a3e84b 100644
--- a/studio/frontend/src/features/audio/tools/separate-panels.tsx
+++ b/studio/frontend/src/features/audio/tools/separate-panels.tsx
@@ -2,6 +2,7 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import { Switch } from "@/components/ui/switch";
+import { FieldLabel } from "../components/field";
import { type OverlapValue, roformerOverlapLogic } from "../separate-policy";
import type { AudioToolPanel } from "./types";
@@ -9,7 +10,7 @@ export const roformerOverlapPanel: AudioToolPanel<OverlapValue> = {
...roformerOverlapLogic,
Component: ({ value, onChange, disabled }) => (
<div className="grid gap-1.5">
- <label
+ <FieldLabel
htmlFor="separate-overlap"
className="flex items-center justify-between gap-3 text-ui-13 font-medium text-foreground"
>
@@ -20,7 +21,7 @@ export const roformerOverlapPanel: AudioToolPanel<OverlapValue> = {
disabled={disabled}
onCheckedChange={(overlap) => onChange({ overlap })}
/>
- </label>
+ </FieldLabel>
<p className="text-ui-11p5 leading-snug text-muted-foreground">
Runs the model over overlapping windows and blends them. Off is about
three times faster. Changing it reloads the model, which takes a few
diff --git a/studio/frontend/src/features/audio/tools/speak-panels.tsx b/studio/frontend/src/features/audio/tools/speak-panels.tsx
index cf33e51826e..16335f83b9e 100644
--- a/studio/frontend/src/features/audio/tools/speak-panels.tsx
+++ b/studio/frontend/src/features/audio/tools/speak-panels.tsx
@@ -12,6 +12,7 @@ import { PillTabs } from "@/features/model-picker/components/model-selector/pill
import type { AudioOptionSpec } from "../audio-options";
import { AudioOptionFields } from "../audio-options-fields";
import { formatVibeVoiceScript } from "../clone-policy";
+import { FieldLabel } from "../components/field";
import { VoicePicker } from "../components/voice-picker";
import {
SUPERTONIC_LANGUAGES,
@@ -124,12 +125,12 @@ const supertonicLanguagePanel: AudioToolPanel<string> = {
...supertonicLanguageLogic,
Component: ({ value, onChange, disabled }) => (
<div className="grid gap-1.5">
- <label
+ <FieldLabel
className="text-ui-13 font-medium text-foreground"
htmlFor="supertonic-language"
>
Language
- </label>
+ </FieldLabel>
<Select
value={value || DEFAULT_LANGUAGE}
onValueChange={(next) =>
diff --git a/studio/frontend/tests/audio-field-titles.test.ts b/studio/frontend/tests/audio-field-titles.test.ts
new file mode 100644
index 00000000000..38e1b7530d7
--- /dev/null
+++ b/studio/frontend/tests/audio-field-titles.test.ts
@@ -0,0 +1,54 @@
+// 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 assert from "node:assert/strict";
+import { readFileSync, readdirSync, statSync } from "node:fs";
+import { join } from "node:path";
+import test from "node:test";
+import { fileURLToPath } from "node:url";
+
+import { readSrc } from "./helpers/kit.ts";
+
+const AUDIO_DIR = fileURLToPath(
+ new URL("../src/features/audio/", import.meta.url),
+);
+
+function tsxFiles(dir: string): string[] {
+ return readdirSync(dir).flatMap((name) => {
+ const path = join(dir, name);
+ if (statSync(path).isDirectory()) return tsxFiles(path);
+ return path.endsWith(".tsx") ? [path] : [];
+ });
+}
+
+test("audio field titles go through FieldLabel, so clicking one does not focus or toggle its control", () => {
+ const field = readSrc("features/audio/components/field.tsx");
+ assert.match(
+ field,
+ /if \(!\(event\.target as Element\)\.closest\(CONTROL\)\) event\.preventDefault\(\);/,
+ );
+ assert.match(field, /"cursor-default!"/);
+ for (const file of tsxFiles(AUDIO_DIR)) {
+ // Windows paths use backslashes.
+ if (file.replaceAll("\\", "/").endsWith("components/field.tsx")) continue;
+ assert.doesNotMatch(readFileSync(file, "utf8"), /<label\b/, file);
+ }
+});
+
+test("audio Optional and Required tags are grey, smaller and unbracketed", () => {
+ const field = readSrc("features/audio/components/field.tsx");
+ assert.match(
+ field,
+ /<span className="ml-1\.5 text-ui-11p5 font-normal text-muted-foreground\/70">/,
+ );
+ for (const file of tsxFiles(AUDIO_DIR)) {
+ assert.doesNotMatch(
+ readFileSync(file, "utf8"),
+ /\((optional|Optional)\)/,
+ file,
+ );
+ }
+ const music = readSrc("features/audio/pages/music-page.tsx");
+ assert.match(music, /optional=\{rule\.description !== "required"\}/);
+ assert.match(music, /optional=\{rule\.lyrics !== "required"\}/);
+});