ModelPicker

A model from a catalogue of any size: searchable, grouped by provider, recent models on top. The start of a comparison column's header.

View source
import { ModelPicker } from "@logicplanes/kaeso-ui/playground";

Props

  • allLabel
    string

    Single only: a first option for no model in particular, such as "All models"; choosing it reports an empty string.

  • appearance
    "ghost" | "default"

    A quiet button (ghost) or a filled one (default).

  • aria-label
    string

    What the picker is for ("Model" by default): it names the list and its popover, and the button, named by the model it shows, reads it as its description.

  • defaultValue
    string | string[] | null

    The chosen model, or models with multiple, on first render.

  • description
    ReactNode

    One sentence of help under the label.

  • disabled
    boolean

    Turns it off: it can't be used, and it looks dimmed.

  • fullWidth
    boolean

    Fills the container.

  • groupByProvider
    boolean

    Groups the list by provider (true by default when there are several).

  • invalid
    boolean

    Shows it as invalid; pair it with a message that says what to fix.

  • label
    ReactNode

    The visible label.

  • layout
    "horizontal" | "vertical"

    The label above the control (vertical) or beside it (horizontal).

  • multiple
    boolean

    Allows choosing several models; value is then a list.

  • onOpenChange
    ((open: boolean) => void)

    Called when the list opens or closes.

  • onValueChange
    ((value: string) => void) | ((value: string[]) => void)

    Called with the chosen model, or the list of models with multiple.

  • open
    boolean

    Whether the list is open, when you control it.

  • optional
    boolean

    Adds “Optional” to the label, for forms where most fields are required.

  • options
    ModelPickerOption[]

    The models: value, provider, id, name, capabilities, context window, a formatted price, a short note such as why it is disabled, and whether it is deprecated.

  • placeholder
    string

    Text shown while there is no value.

  • providers
    ModelPickerProvider[]

    The providers' names and whether each is connected; connected providers come first.

  • recent
    readonly string[]

    Values of recently used models, shown first while the search is empty.

  • required
    boolean

    Marks it as required in a form.

  • size
    "md" | "sm"

    The button's height.

  • value
    string | string[] | null

    The chosen model, or models with multiple, when you control it.