A model picker for AI composers, with provider groups, search, model details, and per-model effort levels.
import {ModelSelector} from "@heroui-pro/react";
<ModelSelector models={models}>
<ModelSelector.Trigger />
<ModelSelector.Popover>
<ModelSelector.Search /> {/* Optional */}
<ModelSelector.List>
<ModelSelector.Group title="Anthropic">
<ModelSelector.Item model={opus} />
</ModelSelector.Group>
</ModelSelector.List>
<ModelSelector.Effort /> {/* Optional */}
<ModelSelector.Detail /> {/* Optional */}
</ModelSelector.Popover>
</ModelSelector>;Give each model its own efforts, and set tone to "max" or "ultra" on levels that use more of the usage limit.
Switching to a model without the current level uses its defaultEffort, and switching back restores the user's level, including when you change a controlled value. A model with fewer than two efforts hides the slider.
Add ModelSelector.Search to filter by model and provider name; without it, the list has no search. ModelSelector.Item children show after the model name, such as a price. Other popover children, such as a pricing note, sit between the list and the effort slider.
ModelSelector.Effort children replace the "Faster" and "Smarter" row, and {null} removes it. ModelSelector.Detail takes a function that returns the card content, with the built-in body as defaultChildren.
<ModelSelector.Effort>{null}</ModelSelector.Effort>
<ModelSelector.Detail>
{({defaultChildren, model}) => (
<>
{defaultChildren}
<p>{prices[model.id]}</p>
</>
)}
</ModelSelector.Detail>Control the model with value and onChange, and the level with effort and onEffortChange.
HeroUI follows the BEM methodology to ensure component variants and states are reusable and easy to customize.
The Model Selector component uses these CSS classes:
.model-selector: Root.model-selector__trigger: Trigger button.model-selector__trigger-icon / .model-selector__trigger-name / .model-selector__trigger-indicator: Logo, short name, and chevron.model-selector__popover: Popover.model-selector__title: Text above the list.model-selector__search: ModelSelector.Search, a HeroUI SearchField with the secondary variant.model-selector__list: Scrolling list, rendered as a HeroUI ScrollShadow that fades its edges.model-selector__group / .model-selector__group-title: Provider group and its sticky title.model-selector__item: Model row.model-selector__item-icon / .model-selector__item-name: Row logo and name; the badge is a HeroUI Chip and the check a ListBox.ItemIndicator.model-selector__item-meta: ModelSelector.Item children after the name, such as a price.model-selector__empty / .model-selector__empty-title / .model-selector__empty-hint: Empty search result, its title, and hint.model-selector__effort: Effort section, a HeroUI Slider.model-selector__effort-header: Label and value row.model-selector__effort-label / .model-selector__effort-value: "Effort" label and current level name.model-selector__effort-body: Track and its ends.model-selector__effort-ends: "Faster" and "Smarter" ends under the slider.model-selector__effort-track / .model-selector__effort-fill / .model-selector__effort-thumb / .model-selector__effort-ticks: Slider.Track, Slider.Fill, Slider.Thumb, and Slider.Steps.model-selector__effort-rail: The thumb's travel range inside the track; the fill reaches past it to the track's ends.model-selector__effort-sheen: Light band over the fill on Max, dimmer on Ultra.model-selector__effort-glow: Ultra glow around the track and halo behind the thumb.model-selector__effort-sparks / .model-selector__effort-spark: Ultra particle layers (inside the fill, and above and below the track) and each particle.model-selector__effort-hint: Level description row under the slider.model-selector__effort-hint-content / .model-selector__effort-hint-body: Collapsing clip, and the icon and text inside it.model-selector__effort-hint-icon: Info icon in the hint.model-selector__effort-hint-stack / .model-selector__effort-hint-text: Stacked descriptions and each description.model-selector__detail: Detail card beside the list.model-selector__detail-body: Card content, replaced for each model.model-selector__detail-header / .model-selector__detail-title / .model-selector__detail-icon: Name and description block, logo and name row, and logo.model-selector__detail-name / .model-selector__detail-description: Card name and description.model-selector__detail-dot / .model-selector__detail-context: Rating dot and context window line.model-selector__detail-ratings / .model-selector__detail-rating / .model-selector__detail-dots: Ratings section, each rating row, and its dots[data-hovered="true"] on .model-selector__trigger and .model-selector__item (fill only)[aria-expanded="true"] on .model-selector__trigger (pressed fill without the scale, and flipped chevron)[data-focus-visible="true"] on .model-selector__trigger (ring), .model-selector__item (inset ring), and .model-selector__effort-thumb (Slider ring)[data-dragging="true"] on .model-selector__effort-thumb[data-disabled] on .model-selector and .model-selector__effort[data-selected="true"] on .model-selector__item: Selected model[data-searchable] on .model-selector__list: ModelSelector.Search is composed[data-visible] on .model-selector__detail: The card shows a model[data-glide] on .model-selector__detail: The card moves from one row to the next instead of fading in[data-side="end|start|none"] on .model-selector__detail: The side with room for the card[data-filled] on .model-selector__detail-dot: Dot counted in the rating[data-effort] on .model-selector__effort: Current level id[data-tone="max|ultra"] on .model-selector__effort: Level tone[data-empty] on .model-selector__effort-hint: The current level has no description, so the row is collapsed and hidden from screen readers[data-active] on .model-selector__effort-hint-text: The current level's description[data-filled="true"] on .slider__step inside .model-selector__effort-ticks: Tick at or before the thumb[data-layer="inner|outer"] on .model-selector__effort-sparks: Particles inside the fill, or around the track; the glow and sparks show and move only while [data-tone="ultra"] is on an enabled slider[data-star] on .model-selector__effort-spark: The particle is a four-point starMotion, on .model-selector and .model-selector__popover:
--model-selector-duration: Chevron, check, card, and color transitions (default: 150ms)--model-selector-exit-duration: Card exit (default: 100ms)--model-selector-crossfade-duration: Detail card content swap and the effort color change under reduced motion (default: 120ms)--model-selector-ease: Easing for these transitions (default: cubic-bezier(0.23, 1, 0.32, 1))The popover opens and closes with the HeroUI Select motion, and the popover and detail card use the theme's --overlay-shadow. Under prefers-reduced-motion: reduce, the popover and card only fade, the slider jumps between levels, and the Max sheen and every Ultra particle are removed; Max and Ultra keep their static gradients, and Ultra its glow.
Layout:
--model-selector-name-max-width: Trigger name width before it truncates (default: 160px)--model-selector-popover-width: Popover width (default: calc(var(--spacing) * 60))--model-selector-list-max-height: List height before it scrolls, and its fixed height with search (default: 7.5 rows and two group titles, calc(var(--spacing) * (9 * 7.5 + 7.5 * 2 + 1)))--model-selector-popover-radius / --model-selector-popover-padding: Popover corner radius and padding (default: calc(var(--radius) * 2) / calc(var(--spacing) * 1.5))--model-selector-row-radius: Row and search field radius, concentric with the popover (default: max(0px, var(--model-selector-popover-radius) - var(--model-selector-popover-padding)))--model-selector-detail-width: Detail card width (default: calc(var(--spacing) * 48))--model-selector-detail-gap: Space between the popover and the detail card (default: calc(var(--spacing) * 2))--model-selector-detail-nudge: Lifts the card above the row top, so its title lines up with the row (default: 5px)--model-selector-detail-margin: Space the card keeps from the viewport edges; a taller card scrolls (default: calc(var(--spacing) * 2))--model-selector-dot-size / --model-selector-dot-gap: Rating dots in the detail card (default: calc(var(--spacing) * 1.5) / calc(var(--spacing) * 0.75))Effort, on .model-selector__effort:
--model-selector-effort-height: Track height (default: calc(var(--spacing) * 4))--model-selector-effort-radius: Track and fill radius (default: calc(var(--radius) * 0.75))--model-selector-effort-inset: Space around the thumb inside the track (default: calc(var(--spacing) * 0.5))--model-selector-effort-thumb-width: Thumb width (default: calc(var(--spacing) * 2.5))--model-selector-effort-thumb-radius: Thumb radius, concentric with the track (default: max(0px, var(--model-selector-effort-radius) - var(--model-selector-effort-inset)))--model-selector-effort-hit-size: Pointer target height (default: calc(var(--spacing) * 6))--model-selector-effort-tick-width / --model-selector-effort-tick-height: Level ticks (default: 2px / 4px)--model-selector-effort-step-duration: Step between levels, and the hint row opening and swapping with it (default: 200ms)--model-selector-effort-sheen-duration: Max sheen loop, a pass then a rest (default: 8s)--model-selector-effort-sheen-color / --model-selector-effort-sheen-strength: Sheen band color and peak (default: var(--model-selector-effort-on-accent) at 18%; the pale spark color on dark themes, 34% in glass)--model-selector-effort-sheen-ultra-opacity: Sheen strength on Ultra relative to Max (default: 0.25)--model-selector-effort-accent / --model-selector-effort-on-accent: Max and Ultra fill color, and the thumb, tick, and in-fill particle color on it (default: var(--accent) / var(--accent-foreground))--model-selector-effort-glow / --model-selector-effort-thumb-glow: Ultra's soft glow around the track, and the halo behind the thumb (default: the accent at 30% / 22%, 45% / 32% on dark themes)--model-selector-effort-glow-spread: How far the glow reaches past the track; it fades out over twice this (default: var(--model-selector-effort-spark-reach-end))--model-selector-effort-glow-duration: Glow breathing loop (default: 10s)--model-selector-effort-glow-rest: Glow opacity at the low point of each breath (default: 0.75)--model-selector-effort-glow-enter-scale: Glow scale as Ultra fades it in (default: 0.96)--model-selector-effort-spark-color: Ultra particle color around the track (default: the accent, deeper on light themes and paler on dark themes)--model-selector-effort-star-color / --model-selector-effort-star-center: Ultra star fill and its center (default: the accent; paler with a near-white center on dark themes)--model-selector-effort-spark-size / --model-selector-effort-glint-size / --model-selector-effort-star-size: Particle, in-fill star, and outer star boxes; the glow is baked into the box (default: 4px / 7px / 9px; 2px particles in brutalism)--model-selector-effort-spark-speed / --model-selector-effort-spark-drift: How far particles in the fill and around the track travel each second (default: 3.5px / 1.2px)--model-selector-effort-spark-rise: How far particles around the track drift away from it (default: 2px)--model-selector-effort-spark-floor: Particle peak opacity at the track's start; it rises to full toward the thumb end (default: 0.45)--model-selector-effort-spark-reach-start / --model-selector-effort-spark-reach-end: Particle band above and below the track (default: calc(var(--spacing) * 2.5) / calc(var(--spacing) * 1.5), the space to the header and to the ends row)On dark themes the glow, sheen, and sparks use mix-blend-mode: plus-lighter, so they add light. To remove the Ultra sparks, set .model-selector__effort-sparks to display: none, or pass showOuterSparks={false} to drop only the ones around the track. The glow's halo sits at the track's end, so give the ultra tone to the last level.
Extends HeroUI Select props, except selection, placeholder, and field styling props.
Pass your own models; the component ships no catalog or logos. With no children, ModelSelector renders the Anatomy layout without ModelSelector.Search and groups models by provider. Items must come from models, since the trigger, effort, and detail read the selected model from it.
| Prop | Type | Default | Description |
|---|---|---|---|
models | ModelSelectorModel[] | - | Models to pick from, in display order |
value | string | - | Selected model id |
defaultValue | string | First enabled model | Initial model id when uncontrolled |
onChange | (value: string) => void | - | Called when the user picks a model |
effort | string | - | Selected effort level id |
defaultEffort | string | Model's defaultEffort | Initial level id when uncontrolled |
onEffortChange | (effort: string) => void | - | Called for each slider step, and when the level falls back because the model lacks it |
labels | Partial<ModelSelectorLabels> | - | Replaces the visible copy, for example to localize it |
aria-label | string | labels.trigger | Names the trigger before the model name; overrides labels.trigger |
isDisabled | boolean | false | Disables the trigger |
children | ReactNode | Trigger and popover | ModelSelector.Trigger and ModelSelector.Popover |
ModelSelectorLabels is {trigger, title, searchPlaceholder, emptyTitle, emptyHint, effort, faster, smarter, intelligence, speed, rating, contextWindow}, where trigger (default "Model") names the trigger before the model name, and emptyTitle(query) and rating(value, max) are functions.
Extends HeroUI Button props, with variant="ghost" and size="md" by default. Children replace the logo, name, and chevron. It reads the label and the full model name, such as "Model, Claude Opus 5.5". Inside PromptInput, the default trigger fits the toolbar of the default layout; in the compact and inline layouts, pass size="sm".
Extends HeroUI Select.Popover props, with placement="top end". Renders the list, effort, and detail parts when empty, without search. It keeps the side it opened on, so the effort hint row shrinks the list instead of flipping the popover.
Extends HeroUI SearchField props, except value, defaultValue, and onChange, since the popover owns the query. Place it inside ModelSelector.Popover, usually before the list. It filters by model and provider names, shows the empty state for a query with no match, and clears the query each time the popover closes. A search with no match is announced, since focus stays in the search field.
| Prop | Type | Default | Description |
|---|---|---|---|
autoFocus | boolean | true | Focuses the field when the popover opens |
variant | "primary" | "secondary" | "secondary" | Field style |
fullWidth | boolean | true | Fills the popover width |
children | ReactNode | Icon, input, clear button | Replaces the field group |
The placeholder and accessible name come from labels.searchPlaceholder.
Extends HeroUI ListBox props.
| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | "Models" | Text above the list; null removes it |
children | ReactNode | - | Groups and items; groups by provider when empty |
Extends HeroUI ListBox.Section props. title renders a sticky heading.
Extends HeroUI ListBox.Item props. Takes the model to render. children show after the name, such as a price. Each row describes its model to screen readers: the badge, description, ratings, context window ("1 million context window"), and any item children. Logos and the detail card are hidden from them.
Extends HeroUI Slider props, except value, defaultValue, minValue, maxValue, step, orientation, formatOptions, onChange, and onChangeEnd, since the levels drive the slider. Renders nothing for a model with fewer than two levels. The slider reads the level and its description as its value on every step.
| Prop | Type | Default | Description |
|---|---|---|---|
showOuterSparks | boolean | true | Shows Ultra's particles and stars outside the track |
children | ReactNode | "Faster" and "Smarter" | Replaces the row under the track, which describes the slider; null removes it |
Supports native div props. Shows the hovered or keyboard-focused model beside the list, on the side with room. The card stays open while the pointer is on it, so it can be read or zoomed.
| Prop | Type | Default | Description |
|---|---|---|---|
children | (values: {model: ModelSelectorModel; defaultChildren: ReactNode}) => ReactNode | Built-in body | Card content for a model; return null to keep the card hidden for it |
defaultChildren is the built-in name, description, ratings, and context window, or null for a model with none of them.
| Field | Type | Description |
|---|---|---|
id | string | Unique id |
name | string | Full name, shown in the list and detail card |
shortName | string | Name in the trigger, such as "Opus 5.5" |
provider | string | Groups the list |
icon | ReactNode | 16px logo |
badge | string | Short label after the name, such as "New" |
description | string | One line for the detail card |
intelligence | number | Rating from 1 to 5 |
speed | number | Rating from 1 to 5 |
contextWindow | number | Tokens, shown in compact notation such as "1M" |
efforts | ModelSelectorEffortLevel[] | Levels from lowest to highest; fewer than two hides the slider |
defaultEffort | string | Level used when the current level is not in efforts |
isDisabled | boolean | Shows the model but blocks picking it |
ModelSelectorEffortLevel is {id, label, description?, tone?}, where description is the usage note under the slider and tone is "max" or "ultra".
| Key | Action |
|---|---|
| Enter, Space, Down Arrow | On the trigger, open the popover and focus the selected row, or the search field when ModelSelector.Search is placed |
| Typing | Filters the list with ModelSelector.Search; without it, jumps to a model |
| Up Arrow, Down Arrow | Move through the rows; with search, focus stays in the field |
| Tab | Moves from the list to the effort slider |
| Arrow keys, Home, End | On the effort slider, step one level or jump to the ends; every step applies at once |
| Escape | Closes the popover and returns focus to the trigger |
labels.trigger or aria-label to change "Model" in the trigger's spoken name. Keep shortName part of name, so the visible text stays within the spoken name.description with the slider's reading in mind. A description that names the level is read as written ("Ultra uses your limit fastest."); any other follows the label ("Max, Uses your limit faster."), so the level name is read once.ModelSelector.Effort children that replace them, describe the slider. Passing {null} leaves the slider with no description.Resources