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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
// 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, Ref } from "react";
import { cn } from "@/lib/utils";
function SectionHeading({ title, badge }: { title: string; badge?: ReactNode }) {
return (
<h2
className={cn(
"settings-heading text-base font-semibold font-heading",
badge && "flex items-center gap-2",
)}
>
{title}
{badge}
</h2>
);
}
export function SettingsSection({
title,
description,
children,
ref,
hideHeading = false,
action,
actionAlign,
danger = false,
badge,
}: {
title: string;
badge?: ReactNode;
/** Control shown beside the heading, e.g. Refresh. */
action?: ReactNode;
/** Align an action’s top edge with the heading’s visible text. */
actionAlign?: "text";
hideHeading?: boolean;
/** Danger zone: a divider above the heading sets it apart from the sections before it. */
danger?: boolean;
description?: ReactNode;
children: ReactNode;
ref?: Ref<HTMLElement>;
}) {
return (
<section
ref={ref}
data-settings-label={title}
className={cn(
"flex flex-col",
danger && "border-t border-border/60 pt-6",
)}
>
{hideHeading ? null : (
<div className="mb-1 flex flex-col gap-0.5">
{action ? (
<div
className={cn(
"flex justify-between gap-3",
description || actionAlign === "text" ? "items-start" : "items-center",
)}
>
<SectionHeading title={title} badge={badge} />
{description || actionAlign === "text" ? (
// Top edge on the h2's cap top (text-base at leading 1.5; Hellix: 0.372em).
<div
className={cn(
"mt-[calc(var(--text-base)*0.372)]",
actionAlign === "text" ? "min-w-0 flex-1" : "shrink-0",
)}
>
{action}
</div>
) : (
action
)}
</div>
) : (
<SectionHeading title={title} badge={badge} />
)}
{description ? (
<p className="text-xs text-muted-foreground leading-relaxed">
{description}
</p>
) : null}
</div>
)}
<div className="flex flex-col">{children}</div>
</section>
);
}
export function SettingsGroupDivider() {
return <div className="my-1 border-t border-border/60" />;
}