Web 0.2.0
Quick answers for short turns.
- Defaultlight7.93 : 1AA 4.5dark9.07 : 1AA 4.5
- KeyboardEnterSpaceArrowDownArrowUpEscapeTabShift+Tab
- measured on 0.2.0
npx shadcn@latest add @maeso/model-selector- Size
- 69.0 kB gzipmeasured on 0.2.0
- First install
- Add the registry once
Usage
Supply the available models and current choice. Apply a selection only when the host can use that model.
Accessibility
Label the selection and keep model names distinct. Explain unavailable choices rather than relying on dimmed text alone.
When to use
Use when the user controls model selection. Omit it when the host fixes the model.
Install
Add this registry to your project's components.json once, before the first install. Keep your existing settings and other registries.
{
"registries": {
"@maeso": "http://127.0.0.1:4321/r/{name}.json"
}
}Then install the registry's default theme once, and import its sheet in the CSS entry that imports Tailwind. It paints every item from this registry.
npx shadcn@latest add @maeso/maeso@import "./styles/theme.web.css";npx shadcn@latest add @maeso/model-selectorProps
ModelSelector
| Prop | Type | Required | Description |
|---|---|---|---|
| defaultValue | string | undefined | no | |
| label | string | undefined | no | The field's own name. |
| models | readonly ModelChoice[] | undefined | no | |
| onChange | ((id: string) => void) | undefined | no | |
| style | CSSProperties | undefined | no | |
| value | string | undefined | no |
Proof
Contrast
measured on 0.2.0
| State | Foreground | Background | Ratio | Floor |
|---|---|---|---|---|
| default | rgb(67 77 86) | rgb(248 245 240) | 7.93 | AA 4.5 |
| default (dark) | rgb(181 182 182) | rgb(7 21 34) | 9.07 | AA 4.5 |
Keyboard
measured on 0.2.0
| Key | Action |
|---|---|
| Enter | Open list and commit focused model |
| Space | Open list at selected model |
| ArrowDown | Focus next model |
| ArrowUp | Focus previous model |
| Escape | Dismiss list without changing model and restore focus |
| Tab | Exit selector |
| Shift+Tab | Return to selector |
Size
68960 gzip bytes · measured on 0.2.0
Example
import { ModelSelector } from "@/components/ui/_kit/chat/model-selector/ModelSelector";
const Example = () => (
<div className="w-full max-w-105">
<ModelSelector
defaultValue="fast"
models={[
{ id: "deep", label: "Deep", detail: "Slower, deeper answers." },
{ id: "fast", label: "Fast", detail: "Quick answers for short turns." },
]}
/>
</div>
);
export default Example;not on native yet