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.

1.3 KB
Raw Blame
// 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 { ReactNode } from "react";
import { PICKER_OPTION_FOCUS_VISIBLE_CLASS } from "./picker-focus";

export function SelectablePickerItem({
  active,
  onSelect,
  children,
  className,
  values,
}: {
  active?: boolean;
  onSelect: () => void;
  children: ReactNode;
  className?: string;
  values?: readonly string[];
}) {
  return (
    <button
      type="button"
      data-picker-option="true"
      data-picker-values={values ? JSON.stringify(values) : undefined}
      aria-pressed={active ?? false}
      onClick={onSelect}
      className={cn(
        "flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-left text-ui-12p5 transition-colors hover:bg-[color-mix(in_oklab,var(--foreground)_calc(5%*var(--contrast-wash-gain,1)),transparent)] focus-visible:bg-[color-mix(in_oklab,var(--foreground)_calc(5%*var(--contrast-wash-gain,1)),transparent)]",
        PICKER_OPTION_FOCUS_VISIBLE_CLASS,
        active && "bg-[color-mix(in_oklab,var(--foreground)_calc(6%*var(--contrast-wash-gain,1)),transparent)]",
        className,
      )}
    >
      {children}
    </button>
  );
}