# Model Control (/docs/agent-ui/components/model-control)

Use a model control in a [composer](./composer.mdx) when people choose both the model and its effort, and you'd rather show one button than a [Model Selector](./model-selector.mdx) beside [Reasoning Effort](./reasoning-effort.mdx). It's a [Settings Menu](./settings-menu.mdx) with two sections of its own: a button reading "Claude Opus 5.5 · Medium" that opens one menu listing the models, then the effort levels, then any choices and toggles you add. Changing either takes one press after opening.

<Example caption="Press Claude Opus 5.5 · Medium and choose GPT-6.1 Terra; the menu stays open, Effort checks the level it uses and dims the ones Terra doesn't support. Choose More models to list another model.">
  <ModelControlExample />

  ```tsx tab="React"
  "use client";
  import type { EffortLevel, ModelOption, SettingsEntry, SettingsValues } from "@kind-ui/agent-ui";
  import { type ReactElement, useState } from "react";
  import { ModelControl } from "@/components/ui/model-control";
  import { AnthropicLogo, MicrosoftLogo, OpenAILogo } from "../model-selector/logos";

  const models: ModelOption<ReactElement>[] = [
    { id: "claude-opus-5.5", name: "Claude Opus 5.5", group: "Anthropic", icon: <AnthropicLogo /> },
    { id: "claude-sonnet-5.5", name: "Claude Sonnet 5.5", group: "Anthropic", icon: <AnthropicLogo /> },
    { id: "gpt-6.1-sol", name: "GPT-6.1 Sol", group: "OpenAI", icon: <OpenAILogo /> },
    {
      id: "gpt-6.1-terra",
      name: "GPT-6.1 Terra",
      group: "OpenAI",
      icon: <OpenAILogo />,
      efforts: ["low", "medium"],
    },
    {
      id: "mai-code-2-flash",
      name: "MAI Code 2 Flash",
      group: "Microsoft",
      icon: <MicrosoftLogo />,
      efforts: [],
    },
  ];

  const moreModels: ModelOption<ReactElement>[] = [
    { id: "mai-code-2", name: "MAI Code 2", group: "Microsoft", icon: <MicrosoftLogo /> },
  ];

  const levels: EffortLevel[] = [
    { value: "low", label: "Low" },
    { value: "medium", label: "Medium" },
    { value: "high", label: "High" },
    { value: "xhigh", label: "Extra High" },
    { value: "max", label: "Max" },
  ];

  const settings: SettingsEntry<ReactElement>[] = [
    { type: "toggle", id: "fast", label: "Fast mode" },
    {
      type: "choice",
      id: "context",
      label: "Context window",
      options: [
        { value: "200k", label: "200K" },
        { value: "1m", label: "1M" },
      ],
    },
  ];

  const actions = [{ id: "more", label: "More models" }];

  export default function ModelControlExample() {
    const [model, setModel] = useState<string | null>("claude-opus-5.5");
    const [effort, setEffort] = useState("medium");
    const [values, setValues] = useState<SettingsValues>({ fast: false, context: "1m" });
    const [showAll, setShowAll] = useState(false);

    return (
      <ModelControl
        models={showAll ? [...models, ...moreModels] : models}
        model={model}
        onModelChange={setModel}
        levels={levels}
        effort={effort}
        onEffortChange={setEffort}
        settings={settings}
        values={values}
        onValuesChange={setValues}
        actions={showAll ? undefined : actions}
        onAction={showAll ? undefined : () => setShowAll(true)}
      />
    );
  }
  ```

  ```vue tab="Vue"
  <script setup lang="ts">
  import type { EffortLevel, SettingsValues } from "@kind-ui/agent-ui";
  import { computed, h, ref, shallowRef } from "vue";
  import { ModelControl } from "@/components/ui/vue/model-control";

  // Logos from Lobe Icons (@lobehub/icons-static-svg 1.103.0, MIT), see THIRD_PARTY_NOTICES.md.
  const mark = (d: string) =>
    h("svg", { viewBox: "0 0 24 24", fill: "currentColor", "fill-rule": "evenodd", "aria-hidden": "true" }, [
      h("path", { d }),
    ]);
  const anthropicLogo = () =>
    mark(
      "M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z",
    );
  const openaiLogo = () =>
    mark(
      "M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z",
    );
  const microsoftLogo = () =>
    h("svg", { viewBox: "0 0 24 24", "aria-hidden": "true" }, [
      h("path", { d: "M11.49 2H2v9.492h9.492V2h-.002z", fill: "#F25022" }),
      h("path", { d: "M22 2h-9.492v9.492H22V2z", fill: "#7FBA00" }),
      h("path", { d: "M11.49 12.508H2V22h9.492v-9.492h-.002z", fill: "#00A4EF" }),
      h("path", { d: "M22 12.508h-9.492V22H22v-9.492z", fill: "#FFB900" }),
    ]);

  const models = [
    { id: "claude-opus-5.5", name: "Claude Opus 5.5", group: "Anthropic", icon: anthropicLogo() },
    { id: "claude-sonnet-5.5", name: "Claude Sonnet 5.5", group: "Anthropic", icon: anthropicLogo() },
    { id: "gpt-6.1-sol", name: "GPT-6.1 Sol", group: "OpenAI", icon: openaiLogo() },
    {
      id: "gpt-6.1-terra",
      name: "GPT-6.1 Terra",
      group: "OpenAI",
      icon: openaiLogo(),
      efforts: ["low", "medium"],
    },
    {
      id: "mai-code-2-flash",
      name: "MAI Code 2 Flash",
      group: "Microsoft",
      icon: microsoftLogo(),
      efforts: [],
    },
  ];

  const moreModels = [{ id: "mai-code-2", name: "MAI Code 2", group: "Microsoft", icon: microsoftLogo() }];

  const levels: EffortLevel[] = [
    { value: "low", label: "Low" },
    { value: "medium", label: "Medium" },
    { value: "high", label: "High" },
    { value: "xhigh", label: "Extra High" },
    { value: "max", label: "Max" },
  ];

  const settings = [
    { type: "toggle" as const, id: "fast", label: "Fast mode" },
    {
      type: "choice" as const,
      id: "context",
      label: "Context window",
      options: [
        { value: "200k", label: "200K" },
        { value: "1m", label: "1M" },
      ],
    },
  ];

  const actions = [{ id: "more", label: "More models" }];

  const model = ref<string | null>("claude-opus-5.5");
  const effort = ref("medium");
  const values = shallowRef<SettingsValues>({ fast: false, context: "1m" });
  const showAll = ref(false);
  const shown = computed(() => (showAll.value ? [...models, ...moreModels] : models));
  </script>

  <template>
    <ModelControl
      :models="shown"
      v-model:model="model"
      :levels="levels"
      v-model:effort="effort"
      :settings="settings"
      v-model:values="values"
      :actions="showAll ? undefined : actions"
      :on-action="showAll ? undefined : () => (showAll = true)"
    />
  </template>
  ```

  ```svelte tab="Svelte"
  <script lang="ts">
    import type { EffortLevel, SettingsValues } from "@kind-ui/agent-ui";
    import {
      ModelControl,
      type ModelControlModel,
    } from "@/components/ui/svelte/model-control/index.js";
    import type { SettingsMenuSetting } from "@/components/ui/svelte/settings-menu/index.js";
    import { AnthropicLogo, MicrosoftLogo, OpenAILogo } from "../model-selector/logos.svelte";

    const models: ModelControlModel[] = [
      { id: "claude-opus-5.5", name: "Claude Opus 5.5", group: "Anthropic", icon: AnthropicLogo },
      { id: "claude-sonnet-5.5", name: "Claude Sonnet 5.5", group: "Anthropic", icon: AnthropicLogo },
      { id: "gpt-6.1-sol", name: "GPT-6.1 Sol", group: "OpenAI", icon: OpenAILogo },
      { id: "gpt-6.1-terra", name: "GPT-6.1 Terra", group: "OpenAI", icon: OpenAILogo, efforts: ["low", "medium"] },
      { id: "mai-code-2-flash", name: "MAI Code 2 Flash", group: "Microsoft", icon: MicrosoftLogo, efforts: [] },
    ];

    const moreModels: ModelControlModel[] = [
      { id: "mai-code-2", name: "MAI Code 2", group: "Microsoft", icon: MicrosoftLogo },
    ];

    const levels: EffortLevel[] = [
      { value: "low", label: "Low" },
      { value: "medium", label: "Medium" },
      { value: "high", label: "High" },
      { value: "xhigh", label: "Extra High" },
      { value: "max", label: "Max" },
    ];

    const settings: SettingsMenuSetting[] = [
      { type: "toggle", id: "fast", label: "Fast mode" },
      {
        type: "choice",
        id: "context",
        label: "Context window",
        options: [
          { value: "200k", label: "200K" },
          { value: "1m", label: "1M" },
        ],
      },
    ];

    const actions = [{ id: "more", label: "More models" }];

    let model: string | null = $state("claude-opus-5.5");
    let effort = $state("medium");
    let values: SettingsValues = $state.raw({ fast: false, context: "1m" });
    let showAll = $state(false);
  </script>

  <ModelControl
    models={showAll ? [...models, ...moreModels] : models}
    bind:model
    {levels}
    bind:effort
    {settings}
    bind:values
    actions={showAll ? undefined : actions}
    onAction={showAll ? undefined : () => (showAll = true)}
  />
  ```

  ```tsx tab="Solid"
  import type { EffortLevel, ModelOption, SettingsEntry, SettingsValues } from "@kind-ui/agent-ui";
  import type { JSX } from "@solidjs/web";
  import { createSignal } from "solid-js";
  import { ModelControl } from "@/components/ui/solid/model-control";

  // Logos from Lobe Icons (@lobehub/icons-static-svg 1.103.0, MIT), see THIRD_PARTY_NOTICES.md.
  function AnthropicLogo() {
    return (
      <svg viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true">
        <path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z" />
      </svg>
    );
  }

  function OpenAILogo() {
    return (
      <svg viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true">
        <path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z" />
      </svg>
    );
  }

  function MicrosoftLogo() {
    return (
      <svg viewBox="0 0 24 24" aria-hidden="true">
        <path d="M11.49 2H2v9.492h9.492V2h-.002z" fill="#F25022" />
        <path d="M22 2h-9.492v9.492H22V2z" fill="#7FBA00" />
        <path d="M11.49 12.508H2V22h9.492v-9.492h-.002z" fill="#00A4EF" />
        <path d="M22 12.508h-9.492V22H22v-9.492z" fill="#FFB900" />
      </svg>
    );
  }

  // An icon is a function, so the trigger and the menu each draw their own copy.
  const models: ModelOption<() => JSX.Element>[] = [
    { id: "claude-opus-5.5", name: "Claude Opus 5.5", group: "Anthropic", icon: AnthropicLogo },
    { id: "claude-sonnet-5.5", name: "Claude Sonnet 5.5", group: "Anthropic", icon: AnthropicLogo },
    { id: "gpt-6.1-sol", name: "GPT-6.1 Sol", group: "OpenAI", icon: OpenAILogo },
    {
      id: "gpt-6.1-terra",
      name: "GPT-6.1 Terra",
      group: "OpenAI",
      icon: OpenAILogo,
      efforts: ["low", "medium"],
    },
    { id: "mai-code-2-flash", name: "MAI Code 2 Flash", group: "Microsoft", icon: MicrosoftLogo, efforts: [] },
  ];

  const moreModels: ModelOption<() => JSX.Element>[] = [
    { id: "mai-code-2", name: "MAI Code 2", group: "Microsoft", icon: MicrosoftLogo },
  ];

  const levels: EffortLevel[] = [
    { value: "low", label: "Low" },
    { value: "medium", label: "Medium" },
    { value: "high", label: "High" },
    { value: "xhigh", label: "Extra High" },
    { value: "max", label: "Max" },
  ];

  const settings: SettingsEntry<JSX.Element>[] = [
    { type: "toggle", id: "fast", label: "Fast mode" },
    {
      type: "choice",
      id: "context",
      label: "Context window",
      options: [
        { value: "200k", label: "200K" },
        { value: "1m", label: "1M" },
      ],
    },
  ];

  const actions = [{ id: "more", label: "More models" }];

  export default function ModelControlExample() {
    const [model, setModel] = createSignal<string | null>("claude-opus-5.5");
    const [effort, setEffort] = createSignal("medium");
    const [values, setValues] = createSignal<SettingsValues>({ fast: false, context: "1m" });
    const [showAll, setShowAll] = createSignal(false);

    return (
      <ModelControl
        models={showAll() ? [...models, ...moreModels] : models}
        model={model()}
        onModelChange={setModel}
        levels={levels}
        effort={effort()}
        onEffortChange={setEffort}
        settings={settings}
        values={values()}
        onValuesChange={setValues}
        actions={showAll() ? undefined : actions}
        onAction={showAll() ? undefined : () => setShowAll(true)}
      />
    );
  }
  ```
</Example>

## Installation [#installation]

```bash tab="React"
npx shadcn@latest add @kind-ui/model-control
```

```bash tab="Web Components"
npx shadcn@latest add @kind-ui/model-control-web
```

```bash tab="Vue"
npx shadcn@latest add @kind-ui/model-control-vue
```

```bash tab="Svelte"
npx shadcn@latest add @kind-ui/model-control-svelte
```

```bash tab="Solid"
npx shadcn@latest add @kind-ui/model-control-solid
```

## Composition [#composition]

```text
ModelControl
├── ModelControlTrigger
└── ModelControlContent
    └── SettingsMenuRows
```

`ModelControl` is a group named by its `label`, the model and the effort, around UI SDK's Menu. `ModelControlTrigger` is UI SDK's `MenuTrigger`, a button with the model's icon and name, a "·" and the effort, unless you pass children; they can be a function of `{ model, effort }`. `ModelControlContent` is UI SDK's `MenuContent`, and draws its rows with Settings Menu's `SettingsMenuRows` unless you pass children. `ModelControl` renders the trigger and content when you pass no children.

## Usage [#usage]

### Models [#models]

Pass `models`, each with an `id` and a `name`. A model's `group` lists it under that label in the menu, its `icon` shows before its name there and on the button, and `disabled` dims it so it can't be chosen. In React, an icon is an image URL or an element, like an inline `<svg>`. Icons are hidden from assistive technology, so the name names the row.

Pass `model` and `onModelChange` to control the model, or `defaultModel` to start with one. Choosing a model keeps the menu open, as a choice in a Settings Menu does, so the effort levels below already show the level the new model uses. `onModelChange` gets the model's `id` with the reason `item-press`. Call `details.cancel()` to keep the old model.

### Effort [#effort]

Pass `levels`, in order from least to most effort, each a `value` and a `label`. Without levels there's no Effort section. Pass `effort` and `onEffortChange` to control the level, or `defaultEffort` to start with one; it's the middle level by default.

A model's `efforts` names the level values it supports. Without it, a model supports every level, and with `[]` it supports none and the button shows no effort. Levels a model doesn't support show dimmed and can't be chosen. When the chosen model doesn't support the effort, it falls back to the highest level it supports at or below it: the button shows that level, and `onEffortChange` reports it with the reason `model-change`. An uncontrolled effort starts on the level the starting model uses.

```tsx
const models = [
  { id: "gpt-6.1-sol", name: "GPT-6.1 Sol" },
  { id: "gpt-6.1-terra", name: "GPT-6.1 Terra", efforts: ["low", "medium"] },
];
```

The Model Control doesn't send anything. When your app sends a request, `modelEffort(levels, model, effort)` from `@kind-ui/agent-ui/core` returns the level that model uses, or `null` when it has none.

The button keeps its width when the effort changes, since every level's label shares one place and only the chosen one shows. It's named by the `label`, the model and the effort, like "Model, Claude Opus 5.5, Medium effort", or "Model, Claude Opus 5.5" without an effort. `modelLabel` and `effortLabel` head the two sections, "Model" and "Effort" by default; models with a `group` are listed under their group's label instead. `effortLabel` also ends the button's name in lowercase.

### Actions [#actions]

Pass `actions` and `onAction` to add items after the models, like **More models**. They show only while `onAction` is set. Choosing one closes the menu, and `onAction` gets its `id` with the reason `item-press`; call `details.cancel()` to keep the menu open.

### Settings [#settings]

Pass `settings` to add rows, as in a [Settings Menu](./settings-menu.mdx): they come after the models and effort levels, choices first, each in its own submenu, then toggles. Their values work the same way, through `values`, `defaultValues` and `onValuesChange`, whose `details.id` names the setting that changed. The ids `model` and `effort` are reserved, so a setting can't use them.

### Opening [#opening]

Pass `open` and `onOpenChange` to control whether the menu is open, or `defaultOpen` to start open. `onOpenChange` gets UI SDK Menu's reason, like `trigger-press` or `escape-key`. Set `disabled` to keep the button from opening the menu; it also closes an open one.

### Keyboard [#keyboard]

The button is one Tab stop. Enter, Space or Down Arrow opens the menu, and the arrow keys move between models, levels and your rows. Enter or Space chooses a model or level and keeps the menu open, and Space flips a toggle. Right Arrow opens one of your choices' submenus, and Left Arrow or Escape closes only that submenu. Dimmed models and levels can be focused, as the menu pattern asks, but not chosen. Escape closes the menu, with focus back on the button.

### Presentation and Motion [#presentation-and-motion]

The menu opens as a popover below the button. With `presentation="auto"`, the default, it's a bottom sheet on small touch screens instead; pass `"popover"` or `"sheet"` to choose one. The popover rises and fades in. Under `prefers-reduced-motion`, or with `motion="reduced"`, it only fades, over 120 ms, and with `motion="none"` it opens at once.

## API Reference [#api-reference]

### ModelControlOptions

| Prop              | Type                                                                                              | Description                                                                                                                                                                                                                                                                               |
| ----------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `label?`          | `string \| undefined`                                                                             | Names the trigger. Each menu has its own default. Names the trigger, with the chosen model and effort after it ("Model, GPT-5, High effort"). Default: `"Model"`                                                                                                                          |
| `open?`           | `boolean \| undefined`                                                                            | Whether the menu is open. Passing it controls it: change it in `onOpenChange`.                                                                                                                                                                                                            |
| `defaultOpen?`    | `boolean \| undefined`                                                                            | Whether the menu is open at first, when `open` isn't passed. Default: `false`                                                                                                                                                                                                             |
| `onOpenChange?`   | `((open: boolean, details: ChangeDetails<MenuOpenChangeReason>) => void) \| undefined`            | Called when the menu opens or closes, with UI SDK Menu's reason.                                                                                                                                                                                                                          |
| `presentation?`   | `"auto" \| "popover" \| "sheet"`                                                                  | How the menu presents. `"auto"` is a bottom sheet on small touch screens and a popover elsewhere. Default: `"auto"`                                                                                                                                                                       |
| `disabled?`       | `boolean \| undefined`                                                                            | Whether the trigger can't open the menu. Default: `false`                                                                                                                                                                                                                                 |
| `motion?`         | `"auto" \| "none" \| "reduced"`                                                                   | How the menu opens and closes. `"auto"` follows `prefers-reduced-motion`. Default: `"auto"`                                                                                                                                                                                               |
| `settings?`       | `SettingsEntry<unknown>[] \| undefined`                                                           | The rows, in order: a `toggle` is a switch that keeps the menu open, a `choice` a submenu of its `options` showing the current one. Every `id` is unique. The primitive passes each `icon` through to the render layer untouched. Default: `[]`                                           |
| `values?`         | `SettingsValues \| undefined`                                                                     | The values by setting `id`. Passing it controls them: change them in `onValuesChange`.                                                                                                                                                                                                    |
| `defaultValues?`  | `SettingsValues \| undefined`                                                                     | The values at first, when `values` isn't passed. A toggle without one is off; a choice without one shows none. Default: `{}`                                                                                                                                                              |
| `onValuesChange?` | `((values: SettingsValues, details: SettingsMenuChangeDetails) => void) \| undefined`             | Called once per setting a person or an `api` call changes, with every value and the setting's `id` in `details`.                                                                                                                                                                          |
| `models?`         | `ModelOption<unknown>[] \| undefined`                                                             | The models, listed in the menu under their `group`s with their icons. A model's `efforts` names the effort levels it supports; the others show dimmed and are skipped. Default: `[]`                                                                                                      |
| `model?`          | `string \| null \| undefined`                                                                     | The chosen model's `id`. Passing it controls it: change it in `onModelChange`.                                                                                                                                                                                                            |
| `defaultModel?`   | `string \| null \| undefined`                                                                     | The chosen model's `id` at first, when `model` isn't passed. Default: `null`                                                                                                                                                                                                              |
| `onModelChange?`  | `((model: string, details: ChangeDetails<ModelControlChangeReason>) => void) \| undefined`        | Called when a person or `setModel` chooses a model.                                                                                                                                                                                                                                       |
| `levels?`         | `EffortLevel[] \| undefined`                                                                      | The effort levels, from least to most effort, listed in the menu after the models. Without any, there's no Effort section; the levels the chosen model doesn't support show dimmed. Default: `[]`                                                                                         |
| `effort?`         | `string \| undefined`                                                                             | The chosen effort level's `value`. Passing it controls it: change it in `onEffortChange`. One the chosen model doesn't support reads as the highest level it supports at or below it.                                                                                                     |
| `defaultEffort?`  | `string \| undefined`                                                                             | The chosen effort level's `value` at first, when `effort` isn't passed. Default: `the middle level`                                                                                                                                                                                       |
| `onEffortChange?` | `((effort: string, details: ChangeDetails<ModelControlEffortChangeReason>) => void) \| undefined` | Called when a person or `setEffort` chooses an effort level, or when the chosen model, `models` or `levels` change so the effort falls back to a level the model supports (`"model-change"`). Cancelling a fallback keeps `effort`, but the trigger still shows the level the model uses. |
| `actions?`        | `PickerAction<unknown>[] \| undefined`                                                            | Items after the models, like "More models", shown while `onAction` is set. Default: `[]`                                                                                                                                                                                                  |
| `onAction?`       | `((id: string, details: ChangeDetails<ModelControlChangeReason>) => void) \| undefined`           | Called with an action's `id` when a person or `run` runs it. Cancel it to keep the menu open.                                                                                                                                                                                             |
| `modelLabel?`     | `string \| undefined`                                                                             | Names the Model row. Default: `"Model"`                                                                                                                                                                                                                                                   |
| `effortLabel?`    | `string \| undefined`                                                                             | Names the Effort row, and the effort in the trigger's name. Default: `"Effort"`                                                                                                                                                                                                           |

Vue, Svelte and Solid take the same props. Controlled props and callbacks are spelled as each framework expects:

| React                      | Vue                                | Svelte                          | Solid                      |
| -------------------------- | ---------------------------------- | ------------------------------- | -------------------------- |
| `open`, `onOpenChange`     | `v-model:open`, `@open-change`     | `bind:open`, `onOpenChange`     | `open`, `onOpenChange`     |
| `values`, `onValuesChange` | `v-model:values`, `@values-change` | `bind:values`, `onValuesChange` | `values`, `onValuesChange` |
| `model`, `onModelChange`   | `v-model:model`, `@model-change`   | `bind:model`, `onModelChange`   | `model`, `onModelChange`   |
| `effort`, `onEffortChange` | `v-model:effort`, `@effort-change` | `bind:effort`, `onEffortChange` | `effort`, `onEffortChange` |
| `onAction`                 | `@action`                          | `onAction`                      | `onAction`                 |

### Agent [#agent]

An agent connected with `createAgent` finds the model control by its name, like "Model, Claude Opus 5.5, Medium effort", and reads `open`, `values`, `model` and `effort`. It lists every row by `id`, with the models, levels and action ids. `setModel` takes a model's `id`, and `setEffort` a level's `value`; it refuses an unknown level or one the model doesn't support, and it's offered only while the model has levels. `setValue` takes any choice row's `id`, `model` and `effort` included, and one of its values, and `toggle` takes a toggle's `id`. `run` takes an action's `id`, offered while there are actions and `onAction`. They change things whether the menu is open or closed. `open` is offered while the menu is closed and enabled, and `close` while it's open. None needs a person to confirm.

### ModelControlAgentActions

| Prop        | Type                                                    | Description                                                                                                                                                                                                                                           |
| ----------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `open`      | `(() => boolean) \| undefined`                          | Opens the menu. Offered only while it's closed and enabled. Returns whether the change was accepted.                                                                                                                                                  |
| `close`     | `(() => boolean) \| undefined`                          | Closes the menu. Offered only while it's open. Returns whether the change was accepted.                                                                                                                                                               |
| `toggle`    | `((id: string, on?: boolean) => boolean) \| undefined`  | Turns a toggle on or off by its `id`, or flips it without `on`. Offered only while the menu is enabled and holds a toggle. Returns whether the change was accepted: `false` for an id that isn't a toggle, or one the owner cancelled.                |
| `setValue`  | `((id: string, value: string) => boolean) \| undefined` | Chooses a choice setting's option by their `id` and `value`. Offered only while the menu is enabled and holds a choice. Returns whether the change was accepted: `false` for an unknown id, an unknown or disabled value, or one the owner cancelled. |
| `setModel`  | `((model: string) => boolean) \| undefined`             | Chooses a model by its `id`. Offered only while enabled. Returns `false` for an unknown or disabled model, or a refused change.                                                                                                                       |
| `setEffort` | `((level: string) => boolean) \| undefined`             | Chooses an effort level by its `value`. Offered only while enabled and the chosen model has effort levels. Returns `false` for an unknown level, one the model doesn't support, or a refused change.                                                  |
| `run`       | `((id: string) => boolean) \| undefined`                | Runs one of the `actions` by its `id`. Offered only while `onAction` is set and the menu is enabled.                                                                                                                                                  |

<Caption>
  Runs in React, Vue, Svelte, Solid and Web Components. On `<kind-model-control>`, set `models`, `levels`, `actions`, `settings`, `defaultModel` and `defaultValues` as properties; `model`, `effort` and `values` are live properties. Set `default-effort`, `label`, `model-label`, `effort-label` and `presentation` as attributes, and listen for `modelchange`, `effortchange`, `valueschange`, with the setting as `event.detail.id`, and `openchange`. Add the `can-run` attribute to listen for `modelaction`. A model's `icon` is an image URL or an Element. The element fills in its button and menu when it has no children.
</Caption>
