Overlays & feedback / Popovers

Model Picker Popover

Dark menu with search field and count, highlighted Auto row with checkmark, mono model names with provider icons and dot-meter cost indicators.

Rebuilt from silico.ai in the Moonlit Atelier style.

npx shadcn@latest add https://yoink-app.fly.dev/r/moonlit-atelier/blocks/model-picker-menu.json

Looks exactly like silico.ai: brings its fonts and colours, namespaced so your own theme stays untouched.

Usage

Props: placeholder, autoLabel, autoHint, models ({name, dots 0–4, hue}), total. It fades and rises in on scroll, supports filtering via the search field, and rows highlight on hover.

components/model-picker-menu.tsx
import { useEffect, useRef, useState } from "react";

type Model = { name: string; dots: number; hue: string };

type Props = {
  title?: string;
  placeholder?: string;
  autoLabel?: string;
  autoHint?: string;
  models?: Model[];
  total?: number;
};

const defaultModels: Model[] = [
  { name: "aurora-mini-2.1", dots: 2, hue: "#e8845a" },
  { name: "aurora-large-2.1", dots: 4, hue: "#e8845a" },
  { name: "kestrel-7.0-pro", dots: 3, hue: "#4fb89a" },
  { name: "lumen-3-flash", dots: 3, hue: "#6a8cf0" },
  { name: "northwind-r2-0420", dots: 1, hue: "#7a7ff0" },
];

export default function ModelPickerPopover({
  placeholder = "Search models…",
  autoLabel = "Auto (best quality)",
  autoHint = "The assistant picks the best model",
  models = defaultModels,
  total = 307,
}: Props) {
  const ref = useRef<HTMLDivElement>(null);
  const [shown, setShown] = useState(false);
  const [selected, setSelected] = useState(-1);
  const [query, setQuery] = useState("");

  useEffect(() => {
    const el = ref.current;
    if (!el) return;
    const io = new IntersectionObserver(
      ([e]) => {
        if (e.isIntersecting) {
          setShown(true);
          io.disconnect();
        }
      },
      { threshold: 0.2 }
    );
    io.observe(el);
    return () => io.disconnect();
  }, []);

  const list = models
    .map((m, i) => ({ m, i }))
    .filter(({ m }) => m.name.includes(query.toLowerCase()));

  return (
    <div className="flex min-h-[460px] w-full items-center justify-center bg-canvas p-6 font-sans">
      <div
        ref={ref}
        className={`w-full max-w-[390px] rounded-xl border border-hairline bg-canvas-warm p-1 shadow-float-window transition-[opacity,transform] duration-[280ms] ease-linear motion-reduce:transition-none ${
          shown ? "translate-y-0 scale-100 opacity-100" : "translate-y-[6px] scale-[0.98] opacity-0"
        }`}
      >
        <div className="flex items-center gap-2 border-b border-hairline px-3 py-2.5">
          <svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.4" className="text-muted" aria-hidden="true">
            <circle cx="7" cy="7" r="5" />
            <path d="m11 11 3 3" strokeLinecap="round" />
          </svg>
          <input
            value={query}
            onChange={(e) => setQuery(e.target.value)}
            placeholder={placeholder}
            aria-label="Search models"
            className="min-w-0 flex-1 bg-transparent text-caption text-primary placeholder:text-muted focus:outline-none"
          />
          <span className="font-mono text-caption text-muted">{total}</span>
        </div>
        <ul role="listbox" className="mt-1 flex flex-col">
          <li
            role="option"
            aria-selected={selected === -1}
          >
            <button
              onClick={() => setSelected(-1)}
              className="flex w-full items-center justify-between rounded-md bg-surface-raised px-2.5 py-2 text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-hairline-strong"
            >
              <span>
                <span className="block text-caption text-primary">{autoLabel}</span>
                <span className="block text-[12px] text-muted">{autoHint}</span>
              </span>
              {selected === -1 && (
                <svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.6" className="text-secondary" aria-hidden="true">
                  <path d="m3 8 3.5 3.5L13 5" strokeLinecap="round" strokeLinejoin="round" />
                </svg>
              )}
            </button>
          </li>
          {list.map(({ m, i }) => (
            <li key={m.name} role="option" aria-selected={selected === i}>
              <button
                onClick={() => setSelected(i)}
                className="flex w-full items-center gap-3 rounded-md px-2.5 py-2 text-left transition-colors duration-ui-hover ease-ui-hover hover:bg-surface-raised focus-visible:bg-surface-raised focus-visible:outline-none"
              >
                <svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
                  <circle cx="8" cy="8" r="3" fill={m.hue} />
                  {[0, 45, 90, 135, 180, 225, 270, 315].map((a) => (
                    <line key={a} x1="8" y1="1.5" x2="8" y2="4" stroke={m.hue} strokeWidth="1.4" strokeLinecap="round" transform={`rotate(${a} 8 8)`} />
                  ))}
                </svg>
                <span className="flex-1 truncate font-mono text-caption text-secondary">{m.name}</span>
                <span className="flex gap-[3px]" aria-label={`Cost ${m.dots} of 4`}>
                  {[0, 1, 2, 3].map((d) => (
                    <span key={d} className={`h-1 w-1 rounded-pill ${d < m.dots ? "bg-primary" : "bg-faint"}`} />
                  ))}
                </span>
              </button>
            </li>
          ))}
        </ul>
      </div>
    </div>
  );
}

Quality checks

Automated, in a real browser · 4d ago
—

More from Moonlit Atelier

The whole style →

Inline Update Strip

Changelog

Hairline Capability Grid

Lists

Painted Landscape Hero

Heroes

Transparent Minimal Nav Bar

Headers & nav bars

Dark Prompt Composer

Prompt & chat inputs

Perspective Floating App Window

Media & mockups