For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
FrakmentFrakment

Model Selector

A composer with model and effort pickers for chat and agent surfaces.

model-selector-demo.tsx
"use client";

import { ArrowUpIcon, ChevronDownIcon, PlusIcon } from "lucide-react";
import * as React from "react";

import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuGroup,
  DropdownMenuLabel,
  DropdownMenuRadioGroup,
  DropdownMenuRadioItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
  InputGroup,
  InputGroupAddon,
  InputGroupButton,
  InputGroupTextarea,
} from "@/components/ui/input-group";

const providers = [
  {
    models: [
      { id: "gpt-5", name: "GPT-5" },
      { id: "gpt-5-mini", name: "GPT-5 mini" },
    ],
    name: "OpenAI",
  },
  {
    models: [
      { id: "claude-sonnet-4-5", name: "Claude Sonnet 4.5" },
      { id: "claude-haiku-4-5", name: "Claude Haiku 4.5" },
    ],
    name: "Anthropic",
  },
];

const models = providers.flatMap((provider) => provider.models);

const efforts = [
  { id: "low", name: "Low" },
  { id: "medium", name: "Medium" },
  { id: "high", name: "High" },
];

export function ModelSelectorDemo() {
  const [text, setText] = React.useState("");
  const [model, setModel] = React.useState(models[0].id);
  const [effort, setEffort] = React.useState(efforts[1].id);
  const formRef = React.useRef<HTMLFormElement>(null);
  const currentModel = models.find((item) => item.id === model) ?? models[0];
  const currentEffort =
    efforts.find((item) => item.id === effort) ?? efforts[1];
  const canSend = text.trim().length > 0;

  function onSubmit(event: React.FormEvent<HTMLFormElement>) {
    event.preventDefault();
    if (!canSend) {
      return;
    }
    setText("");
  }

  return (
    <div className="mx-auto w-full max-w-lg py-6">
      <form onSubmit={onSubmit} ref={formRef}>
        <InputGroup>
          <InputGroupTextarea
            className="p-3"
            onChange={(event) => setText(event.target.value)}
            onKeyDown={(event) => {
              if (event.key === "Enter" && !event.shiftKey) {
                event.preventDefault();
                formRef.current?.requestSubmit();
              }
            }}
            placeholder="Ask the agent to change your code..."
            value={text}
          />
          <InputGroupAddon align="block-end">
            <InputGroupButton
              aria-label="Attach"
              className="rounded-full"
              size="icon-sm"
              type="button"
              variant="outline"
            >
              <PlusIcon />
            </InputGroupButton>
            <DropdownMenu>
              <DropdownMenuTrigger
                aria-label={`Model: ${currentModel.name}`}
                as={InputGroupButton}
                className="ml-auto"
                size="sm"
                variant="outline"
              >
                {currentModel.name}
                <ChevronDownIcon />
              </DropdownMenuTrigger>
              <DropdownMenuContent align="start" className="w-48">
                <DropdownMenuRadioGroup onValueChange={setModel} value={model}>
                  {providers.map((provider, index) => (
                    <React.Fragment key={provider.name}>
                      {index > 0 && <DropdownMenuSeparator />}
                      <DropdownMenuGroup>
                        <DropdownMenuLabel>{provider.name}</DropdownMenuLabel>
                        {provider.models.map((item) => (
                          <DropdownMenuRadioItem key={item.id} value={item.id}>
                            {item.name}
                          </DropdownMenuRadioItem>
                        ))}
                      </DropdownMenuGroup>
                    </React.Fragment>
                  ))}
                </DropdownMenuRadioGroup>
              </DropdownMenuContent>
            </DropdownMenu>
            <DropdownMenu>
              <DropdownMenuTrigger
                aria-label={`Effort: ${currentEffort.name}`}
                as={InputGroupButton}
                size="sm"
                variant="outline"
              >
                <span className="text-muted-foreground">Effort</span>
                {currentEffort.name}
                <ChevronDownIcon />
              </DropdownMenuTrigger>
              <DropdownMenuContent align="start" className="w-36">
                <DropdownMenuGroup>
                  <DropdownMenuLabel>Effort</DropdownMenuLabel>
                  <DropdownMenuRadioGroup
                    onValueChange={setEffort}
                    value={effort}
                  >
                    {efforts.map((item) => (
                      <DropdownMenuRadioItem key={item.id} value={item.id}>
                        {item.name}
                      </DropdownMenuRadioItem>
                    ))}
                  </DropdownMenuRadioGroup>
                </DropdownMenuGroup>
              </DropdownMenuContent>
            </DropdownMenu>
            <InputGroupButton
              aria-label="Send"
              className="rounded-full"
              disabled={!canSend}
              size="icon-sm"
              type="submit"
              variant="default"
            >
              <ArrowUpIcon />
            </InputGroupButton>
          </InputGroupAddon>
        </InputGroup>
      </form>
    </div>
  );
}

Model Selector is a composer with two dropdowns for picking the model and the reasoning effort. It composes InputGroup, DropdownMenu, and Button so the pickers sit inside the same bordered surface as the textarea and the send action.

Model Selector is a composition, not a primitive. Install the three primitives it uses, then wire it the same way the demo does.

Installation

Usage

model-selector.tsx
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupTextarea } from "@/components/ui/input-group";
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuGroup,
  DropdownMenuLabel,
  DropdownMenuRadioGroup,
  DropdownMenuRadioItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
 
<InputGroup>
  <InputGroupTextarea value={text} onChange={...} />
  <InputGroupAddon align="block-end">
    <DropdownMenu>
      <DropdownMenuTrigger asChild>
        <InputGroupButton size="sm" variant="outline">
          {currentModel.name}
        </InputGroupButton>
      </DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuRadioGroup value={model} onValueChange={setModel}>
          <DropdownMenuRadioItem value="gpt-5">GPT-5</DropdownMenuRadioItem>
        </DropdownMenuRadioGroup>
      </DropdownMenuContent>
    </DropdownMenu>
    <InputGroupButton type="submit" disabled={!canSend}>
      <ArrowUpIcon />
    </InputGroupButton>
  </InputGroupAddon>
</InputGroup>

Anatomy

model-selector.tsx
<InputGroup>
  <InputGroupTextarea />
  <InputGroupAddon align="block-end">
    <InputGroupButton type="button" aria-label="Attach"><PlusIcon /></InputGroupButton>
    <DropdownMenu>
      <DropdownMenuTrigger asChild>
        <InputGroupButton size="sm" variant="outline">{model}</InputGroupButton>
      </DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuRadioGroup>...</DropdownMenuRadioGroup>
      </DropdownMenuContent>
    </DropdownMenu>
    <DropdownMenu>
      <DropdownMenuTrigger asChild>
        <InputGroupButton size="sm" variant="outline">{effort}</InputGroupButton>
      </DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuRadioGroup>...</DropdownMenuRadioGroup>
      </DropdownMenuContent>
    </DropdownMenu>
    <InputGroupButton type="submit" aria-label="Send"><ArrowUpIcon /></InputGroupButton>
  </InputGroupAddon>
</InputGroup>
  • InputGroup — bordered surface holding the textarea and the addon.
  • InputGroupTextarea — the composer input. Enter sends, Shift+Enter inserts a newline.
  • InputGroupAddon align="block-end" — bottom row of actions.
  • DropdownMenuTrigger asChild — renders an InputGroupButton as the trigger.
  • DropdownMenuRadioGroup — one active item per group.
  • InputGroupButton type="submit" — the send action, disabled when the textarea is empty.

Grouped models

Show each provider as a DropdownMenuGroup with a DropdownMenuLabel heading. The separator between groups comes from DropdownMenuSeparator:

tsx
<DropdownMenuRadioGroup onValueChange={setModel} value={model}>
  {providers.map((provider, index) => (
    <React.Fragment key={provider.name}>
      {index > 0 && <DropdownMenuSeparator />}
      <DropdownMenuGroup>
        <DropdownMenuLabel>{provider.name}</DropdownMenuLabel>
        {provider.models.map((item) => (
          <DropdownMenuRadioItem key={item.id} value={item.id}>
            {item.name}
          </DropdownMenuRadioItem>
        ))}
      </DropdownMenuGroup>
    </React.Fragment>
  ))}
</DropdownMenuRadioGroup>

Best Practices

  • Always show the current model. The trigger label is the value, so users see it without opening the menu.
  • Group by provider. Models across providers differ in capability and cost; the group heading tells the user which family they are picking.
  • Disable Send when empty. disabled={!canSend} prevents accidental empty submissions.
  • Attach is not Send. Use a separate icon-only button with type="button" for attachments so Enter doesn't submit the file picker.
  • Effort is a second dropdown. Do not fold effort into the model name; users change it independently.

Accessibility

  • Both DropdownMenuTrigger instances use asChild so the trigger is a real InputGroupButton (a button element) with an aria-label describing its value.
  • DropdownMenuRadioGroup exposes role="radiogroup" per group and role="menuitemradio" per item; arrow keys move the selection.
  • The Send button has aria-label="Send" and is disabled when the composer is empty.
  • The attach button has aria-label="Attach" and is type="button" so it never submits the form.

Next

  • Chat — full streaming chat surface.
  • Input Group — composer with inline addons.
  • Dropdown Menu — menu with grouped radio items.