DokumentationSelect
Select
Eine Auswahl oder viele. Immer der passende Wert.
Erste Schritte
Paket installieren
Verwende React 19 und importiere das Paket-Stylesheet einmal in deinem globalen CSS. Die mitgelieferten Stile sind für Tailwind CSS 4 ausgelegt.
bun add @rentnerkev/select@import '@rentnerkev/select/tailwind.css';Combobox: mehrere Objekte und asynchrone Ergebnisse#
ComboboxProps<T> unterscheidet den Modus über multiple: true: value ist readonly T[], onValueChange erhält T[]. Der Einzelmodus behält T | null. Steuere searchValue separat und liefere eindeutige stabile getOptionKey-Werte; ausgewählte Objekte bleiben bei neuen asynchronen Ergebnisarrays und Objekten erhalten, auch wenn sie auf der aktuellen Seite fehlen. Die Standardgleichheit vergleicht Schlüssel. filterMode external zeigt deine übergebenen Ergebnisse; Laden, Debounce, Ladezustand, Abbruch und Anlegen übernimmt die Anwendung.
import { Combobox } from '@rentnerkev/select/combobox'
import { useState, type FormEvent } from 'react'
type Customer = { id: string; name: string; email: string }
export default function CustomerTeam({
results,
loading = false,
}: {
results: readonly Customer[]
loading?: boolean
}) {
const [selected, setSelected] = useState<readonly Customer[]>([])
const [query, setQuery] = useState('')
const [submitted, setSubmitted] = useState<string[]>([])
function handleSubmit(event: FormEvent<HTMLFormElement>) {
event.preventDefault()
setSubmitted(new FormData(event.currentTarget).getAll('customers').map(String))
}
return (
<form onSubmit={handleSubmit}>
<Combobox
multiple
clearable
name="customers"
label="Customer team"
value={selected}
onValueChange={setSelected}
searchValue={query}
onSearchValueChange={setQuery}
options={results}
loading={loading}
filterMode="external"
getOptionKey={(customer) => customer.id}
getOptionLabel={(customer) => customer.name}
getOptionDescription={(customer) => customer.email}
getFormValue={(customer) => customer.id}
/>
<button type="submit">Read selected IDs</button>
<output>{submitted.join(', ')}</output>
</form>
)
}Stabile Erstpositionierung und ShadowRoot-Portale#
CustomSelect und Combobox teilen sich Popupvermessung und Sichtbarkeitsfreigabe. Das aktuelle Popup bleibt verborgen, bis es mit den endgültigen Viewportgrenzen einschließlich Scrollbarbreite vermessen wurde; so blitzt es beim ersten Öffnen nach dem Neuladen nicht an alten Koordinaten auf. Scrollen, Viewportänderungen und ein ausgetauschtes Portal vermessen das Popup neu. ShadowRoot-Portale erhalten Tastaturfokus, feldweites Blur und das Schließen bei Außeninteraktion.
import { CustomSelect } from '@rentnerkev/select'
import { useState } from 'react'
export default function LanguageSelect() {
const [language, setLanguage] = useState('en')
return (
<div className="flex justify-end">
<CustomSelect
label="Language"
contentWidth="content"
value={language}
onValueChange={setLanguage}
options={[
{ value: 'en', label: 'English' },
{ value: 'de', label: 'Deutsch' },
]}
/>
</div>
)
}Gruppierte Select- und Combobox-Optionen#
Setze option.group am CustomSelect oder liefere einen Gruppennamen über Combobox.getOptionGroup. Gruppenüberschriften sind nicht auswählbar; Einträge ohne Gruppe bleiben verfügbar. Filterung, Tastaturnavigation, deaktivierte Einträge und Virtualisierung funktionieren über Gruppengrenzen hinweg. classNames.group und groupLabel gestalten die Darstellung.
import { useState } from 'react'
import { CustomSelect } from '@rentnerkev/select'
import { Combobox } from '@rentnerkev/select/combobox'
const roles = [
{ id: 'owner', name: 'Owner', group: 'Team' },
{ id: 'editor', name: 'Editor', group: 'Team' },
{ id: 'guest', name: 'Guest', group: 'Visitors' },
]
export default function GroupedChoices() {
const [role, setRole] = useState('editor')
const [customer, setCustomer] = useState<(typeof roles)[number] | null>(null)
const [query, setQuery] = useState('')
return (
<section className="grid gap-4">
<CustomSelect
label="Role"
options={roles.map(({ id, name, group }) => ({
value: id,
label: name,
group,
}))}
value={role}
onValueChange={setRole}
/>
<Combobox
label="Search roles"
options={roles}
value={customer}
onValueChange={setCustomer}
searchValue={query}
onSearchValueChange={setQuery}
getOptionKey={(option) => option.id}
getOptionLabel={(option) => option.name}
getOptionGroup={(option) => option.group}
/>
</section>
)
}Neue Combobox-Option anlegen#
onCreateOption ergänzt eine Zeile zum Anlegen, wenn die getrimmte Suche nicht leer ist und keine vorhandene Option dieselbe Beschriftung hat; Groß- und Kleinschreibung werden ignoriert. createOptionLabel gestaltet den Zeilentext. Der Callback erhält die getrimmte Suche; Erstellen, Speichern und Auswählen übernimmt deine Anwendung. Deaktivierte oder schreibgeschützte Felder können keine Einträge anlegen.
import { useState } from 'react'
import { Combobox } from '@rentnerkev/select/combobox'
type Tag = { id: string; label: string }
export default function CreateTag() {
const [options, setOptions] = useState<Tag[]>([
{ id: 'react', label: 'React' },
])
const [value, setValue] = useState<Tag | null>(null)
const [query, setQuery] = useState('')
function createOption(label: string) {
const option = { id: crypto.randomUUID(), label }
setOptions((current) => [...current, option])
setValue(option)
setQuery('')
}
return (
<Combobox
label="Tag"
options={options}
value={value}
onValueChange={setValue}
searchValue={query}
onSearchValueChange={setQuery}
getOptionKey={(option) => option.id}
getOptionLabel={(option) => option.label}
onCreateOption={createOption}
createOptionLabel={(label) => 'Create tag: ' + label}
/>
)
}Einzelne ausgewählte Einträge entfernen#
Setze removableSelectedItems an einem mehrfachen CustomSelect, um ausgewählte Beschriftungen ohne Öffnen des Popups zu entfernen. Standardmäßig ist die Option false. Hover oder Tastaturfokus zeigt eine rote Durchstreichung und einen lokalisierten Löschhinweis; Klick, Enter oder Leertaste entfernt nur diesen Wert. Deaktivierte Auswahlen bleiben erhalten. disabled, readOnly und eigenes renderValue unterdrücken die integrierten Löschbuttons.
import { useState } from 'react'
import { CustomSelect } from '@rentnerkev/select'
export default function RemoveSelectedRoles() {
const [values, setValues] = useState<string[]>(['editor', 'locked'])
return (
<CustomSelect
label="Roles"
name="roles"
multiple
clearable
removableSelectedItems
value={values}
onValueChange={setValues}
options={[
{ value: 'editor', label: 'Editor' },
{ value: 'reviewer', label: 'Reviewer' },
{ value: 'locked', label: 'Required role', disabled: true },
]}
messages={{
clickToRemove: 'Click to remove',
removeSelectedItem: (label) => 'Remove ' + label,
}}
/>
)
}Select 6.0: Migration zum nativen Popup#
Version 6.0.0 ersetzt Radix Select durch ein React-/DOM-Popup. Komponenten-Imports und Props bleiben unverändert. Das Popup ist nichtmodal: Tab und Shift+Tab schließen es und wechseln zu den umgebenden Bedienelementen; Außenklicks schließen es und aktivieren ihr Ziel. Escape und Einzelauswahl setzen den Fokus auf den Auslöser zurück. Optionen einschließlich renderOption-Inhalten werden nur geöffnet gemountet; Typeahead im geschlossenen Zustand verwendet option.label.
import { CustomSelect } from '@rentnerkev/select'
import { useState } from 'react'
export default function NativeSelect() {
const [value, setValue] = useState('standard')
return (
<CustomSelect
label="Delivery"
onValueChange={setValue}
options={[
{ value: 'standard', label: 'Standard' },
{ value: 'express', label: 'Express' },
]}
value={value}
/>
)
}Combobox: externe Suchergebnisse#
Neu in 5.2.0: Combobox<T> akzeptiert deine Fachobjekte mit stabilen eindeutigen getOptionKey und getOptionLabel. value und searchValue sind unabhängig: Tippen ändert nur die Suche, Auswählen nur den Wert. Aktualisiere beide im Auswahlhandler, wenn das Label die Suche ersetzen soll. filterMode ist standardmäßig external und zeigt übergebene Ergebnisse unverändert; local aktiviert Label-Filterung. Requests, Debounce und Abbruch übernimmt deine Anwendung. Die Auswahl bleibt bei Seitenwechseln der Ergebnisse bestehen. loading blendet alte Treffer aus; loadingText, emptyText und messages.loading passen Statusmeldungen an.
import { Combobox } from '@rentnerkev/select/combobox'
import { useState } from 'react'
type Customer = { id: string; name: string; email: string }
export default function CustomerSearch({
results,
loading = false,
}: {
results: readonly Customer[]
loading?: boolean
}) {
const [customer, setCustomer] = useState<Customer | null>(null)
const [query, setQuery] = useState('')
return (
<Combobox
clearable
filterMode="external"
getOptionDescription={(option) => option.email}
getOptionKey={(option) => option.id}
getOptionLabel={(option) => option.name}
getFormValue={(option) => option.id}
label="Customer"
loading={loading}
name="customerId"
onSearchValueChange={setQuery}
onValueChange={(next) => {
setCustomer(next)
setQuery(next?.name ?? '')
}}
options={results}
searchValue={query}
value={customer}
/>
)
}Text-Slots, Umbruch & Popupbreite#
Neu in 5.2.0: controlSize sm/md/lg setzt 36/44/48 px; ohne Angabe bleibt die bisherige Größe. textOverflow ist standardmäßig truncate oder wrap für lange Texte. Ein Trigger ohne feste Größe kann bei Umbruch wachsen; eine explizite Größe erhält die Höhe. contentWidth ist standardmäßig trigger oder content, mit der Triggerbreite als Minimum und dem Viewport als Maximum. Text-Slots gestalten optionLabel, optionDescription, optionIndicator, selectedLabel und selectedDescription ohne Nachfahrenselektoren. Slots ersetzen visuelle Vorgaben; verschachtelte Provider erben sie einzeln, ein leerer String entfernt eine Vorgabe. Combobox verwendet search für die Eingabe, ersatzweise trigger.
import { CustomSelect, SelectProvider } from '@rentnerkev/select'
import { useState } from 'react'
export default function Delivery() {
const [value, setValue] = useState('standard')
return (
<SelectProvider
contentWidth="content"
portalClassName="font-sans"
portalZIndex={12000}
textOverflow="wrap"
classNames={{
optionLabel: 'font-semibold',
selectedLabel: 'text-sky-700',
}}
>
<CustomSelect
label="Delivery"
onValueChange={setValue}
options={[
{
value: 'standard',
label: 'Standard delivery with shipment tracking',
subOption: 'Three business days',
},
{
value: 'express',
label: 'Express delivery',
subOption: 'Next business day',
},
]}
value={value}
/>
</SelectProvider>
)
}UI-freier Formularadapter#
getSelectFieldProps aus /form verbindet strukturelle Felder mit CustomSelect oder Combobox ohne React- oder Formularlaufzeit. Es liefert name, value, onValueChange, feldweites onBlur und error. Fehler erscheinen standardmäßig nach Berührung; errorVisibility akzeptiert touched, always oder never. getReadableSelectError akzeptiert Strings oder Objekte mit einer String-message; mapError behandelt andere Formen. Ein null-Fehler überlässt die Validierung ausdrücklich dem Formular. Rufe den Helfer im abonnierten Feld-Render auf; eine Combobox benötigt weiterhin separate searchValue-Handler.
import { CustomSelect } from '@rentnerkev/select'
import {
getReadableSelectError,
getSelectFieldProps,
} from '@rentnerkev/select/form'
import type { SelectFormField } from '@rentnerkev/select/form'
export default function RegionField({
field,
}: {
field: SelectFormField<string>
}) {
return (
<CustomSelect
{...getSelectFieldProps(field, {
errorVisibility: 'touched',
mapError: getReadableSelectError,
})}
label="Region"
options={[{ value: 'eu', label: 'Europe' }]}
/>
)
}Lokale KI-Helfer: Metadaten & Anleitungen#
Importiere den /ai-Einstieg in einem lokalen Node.js- oder Bun-Script. Diese synchronen, nur lesenden Helfer lesen das installierte Paket über node:fs, ohne seine UI zu importieren. getPackageInfo() liefert PackageInfo mit installierter Version, öffentlichen Exports und Peer-Abhängigkeiten. getPackageDocumentation() liefert ein PackageDocument mit path und content; der Standard ist usage, readme wählt README.md. Nur diese beiden mitgelieferten Dokumente sind erlaubt. Die Ergebnisse beschreiben deine installierte Version, die von dieser Website abweichen kann.
import { getPackageDocumentation, getPackageInfo } from '@rentnerkev/select/ai'
import type { PackageDocument, PackageInfo } from '@rentnerkev/select/ai'
const info: PackageInfo = getPackageInfo()
const usage: PackageDocument = getPackageDocumentation()
const readme = getPackageDocumentation('readme')
console.log(info.name, info.version, info.exports, info.peerDependencies)
console.log(usage.path, usage.content)
console.log(readme.path, readme.content)Lokale KI-Helfer: öffentliche Deklarationen#
getPackageApi() liefert PackageApi mit package, installierter version, gewählten subpaths und declarations als PackageDocument-Objekte. Es liest öffentliche typisierte Einstiege und ihre lokalen Deklarationsabhängigkeiten; /ai selbst ist ausgeschlossen. Mit subpath wie . oder ./types wählst du einen öffentlichen Einstieg. symbol prüft, ob dieser Einstieg den Namen exportiert; die Deklarationsdateien werden nicht auf dieses Symbol gekürzt. Unbekannte Subpfade, ungültige Namen und vom gewählten Einstieg nicht exportierte Namen lösen Fehler aus. Beliebige Dateipfade lassen sich nicht übergeben.
import { getPackageApi } from '@rentnerkev/select/ai'
import type { PackageApi } from '@rentnerkev/select/ai'
const api: PackageApi = getPackageApi()
const selected = getPackageApi({ subpath: '.', symbol: 'CustomSelect' })
console.log(api.package, api.version, api.subpaths)
for (const declaration of selected.declarations) {
console.log(declaration.path, declaration.content)
}Lokale KI-Helfer: Suche & Beispiele#
searchPackageDocumentation(query) durchsucht README.md und docs/usage.md mit einem getrimmten, wörtlichen Suchtext ohne Beachtung der Großschreibung. Es liefert PackageSearchMatch-Objekte mit path, einer ab eins gezählten line und passendem text; eine leere Suche liefert ein leeres Array. getPackageExamples() liefert alle eingezäunten Codeblöcke der installierten Anleitung als PackageExample mit language und code. Diese Helfer liefern Text für deine eigenen Tools; sie führen keine Beispiele aus und kontaktieren keinen KI-Dienst.
import { getPackageExamples, searchPackageDocumentation } from '@rentnerkev/select/ai'
import type { PackageExample, PackageSearchMatch } from '@rentnerkev/select/ai'
const matches: PackageSearchMatch[] = searchPackageDocumentation('CustomSelect')
const examples: PackageExample[] = getPackageExamples()
for (const match of matches) {
console.log(match.path, match.line, match.text)
}
for (const example of examples) {
console.log(example.language, example.code)
}CustomSelect & typisierte Optionen#
Übergib options mit value und label und steuere die Auswahl über value/onValueChange. TValue wird aus deinen Werten abgeleitet und kann String, Zahl oder Objekt sein. subOption ergänzt Hinweise; disabled verhindert die Auswahl einer Option. label, description, placeholder und icon beschreiben das Feld; fallbackOption benennt einen ausgewählten Wert, der in der Optionsliste fehlt.
import { useState } from 'react'
import { CustomSelect } from '@rentnerkev/select'
const options = [
{ value: 'tooltips', label: 'Tooltips', subOption: 'Helpful hints' },
{ value: 'toasts', label: 'Toasts' },
{ value: 'coming-soon', label: 'Coming soon', disabled: true },
]
export default function PackageSelect() {
const [value, setValue] = useState('')
return (
<CustomSelect
label="Package"
onValueChange={setValue}
options={options}
value={value}
/>
)
}Mehrfachauswahl & Grenzen#
Setze multiple und verwende ein Array von Werten. onValueChange liefert ein neues Array. minSelection und maxSelection beschreiben Auswahlgrenzen; maxSelection verhindert zusätzliche Werte oberhalb der Grenze. required und error binden die Prüfung ein. Deaktivierte Optionen können nicht gewählt werden.
import { useState } from 'react'
import { CustomSelect } from '@rentnerkev/select'
const options = ['Tooltips', 'Toasts', 'Inputs'].map((name) => ({
value: name,
label: name,
}))
export default function MultiplePackages() {
const [values, setValues] = useState<string[]>([])
return (
<CustomSelect
label="Packages"
maxSelection={2}
minSelection={1}
multiple
onValueChange={setValues}
options={options}
value={values}
/>
)
}Auswahl löschen & emptyValue#
Für eine direkt löschbare Einzelauswahl verwende clearable mit nullable State; Löschen liefert null über onValueChange. emptyValue erlaubt einen eigenen Leerwert, etwa einen leeren String. Der bisherige onClear-Callback bleibt für getrennte Löschlogik verfügbar. Mehrfachauswahl wird auf ein leeres Array zurückgesetzt.
import { useState } from 'react'
import { CustomSelect } from '@rentnerkev/select'
export default function ClearablePackage() {
const [value, setValue] = useState<string | null>(null)
return (
<CustomSelect
clearable
label="Package"
onValueChange={setValue}
options={[{ value: 'tooltips', label: 'Tooltips' }]}
value={value}
/>
)
}Suche & Tastaturnavigation#
searchable aktiviert das Suchfeld im Popup; false eignet sich für kurze feste Listen. Das Feld unterstützt Tastaturnavigation, Auswahl und Schließen. messages gestaltet Suchnamen, Suchplatzhalter und leere Ergebnisse. Ergänze einen zugänglichen Namen, auch wenn kein sichtbares Label vorhanden ist.
import { useState } from 'react'
import { CustomSelect } from '@rentnerkev/select'
export default function SearchablePackages() {
const [value, setValue] = useState('')
return (
<CustomSelect
label="Find a package"
messages={{
searchPlaceholder: 'Type a package name',
noResults: 'No matching package',
}}
onValueChange={setValue}
options={[
{ value: 'inputs', label: 'Inputs' },
{ value: 'calendar', label: 'Calendar' },
]}
searchable
value={value}
/>
)
}Objektwerte & Vergleich#
Vergleiche Objektwerte mit isOptionEqualToValue über stabile Schlüssel statt über ihre Identität. So bleibt die Auswahl beim erneuten Laden der Optionen korrekt. getFormValue serialisiert Objektwerte für native Formulare.
import { useState } from 'react'
import { CustomSelect } from '@rentnerkev/select'
type Package = { id: number; name: string }
const options = [{ value: { id: 1, name: 'Tooltips' }, label: 'Tooltips' }]
export default function ObjectSelect() {
const [value, setValue] = useState<Package | null>(null)
return (
<CustomSelect
clearable
getFormValue={(item) => String(item.id)}
isOptionEqualToValue={(option, selected) =>
option.id === selected.id
}
label="Package"
name="packageId"
onValueChange={setValue}
options={options}
value={value}
/>
)
}Eigene Darstellung der Optionen & Werte#
renderOption erhält die Option und ihren selected-/disabled-Zustand. renderValue erhält ein Array der gewählten Optionen, auch im Einzelmodus. Gib React-Inhalt für Badges oder Zusatzinformationen zurück; Tastatur- und Auswahlverhalten bleiben beim Feld.
import { useState } from 'react'
import { CustomSelect } from '@rentnerkev/select'
export default function RichOptions() {
const [value, setValue] = useState('')
return (
<CustomSelect
label="Package"
onValueChange={setValue}
options={[{ value: 'tooltips', label: 'Tooltips' }]}
renderOption={(option, state) => (
<span>
{state.selected ? '✓ ' : ''}
{option.label}
</span>
)}
renderValue={(selected) =>
selected.map((option) => option.label).join(', ')
}
value={value}
/>
)
}Native Formulare, Fokus & Feldzustände#
name erzeugt native Formularwerte; getFormValue wandelt eigene Werte in Strings um. Mehrfachfelder senden wiederholte Werte, die FormData.getAll ausliest. omitEmptyFormValue lässt eine leere Mehrfachauswahl weg. id, label, description, error, required und ARIA-Props beschreiben die Prüfung. disabled verhindert Bedienung; readOnly die Bearbeitung. triggerRef fokussiert den Button, onBlur erfasst das Verlassen des Feldes und nonce liefert bei Bedarf einen CSP-Nonce für Komponentenstile.
import { useState } from 'react'
import { CustomSelect } from '@rentnerkev/select'
export default function PackageForm() {
const [values, setValues] = useState<string[]>([])
return (
<form
onSubmit={(event) => {
event.preventDefault()
console.log(
new FormData(event.currentTarget).getAll('packages'),
)
}}
>
<CustomSelect
label="Packages"
multiple
name="packages"
omitEmptyFormValue
onValueChange={setValues}
options={[{ value: 'inputs', label: 'Inputs' }]}
value={values}
/>
<button type="submit">Save</button>
</form>
)
}SelectProvider#
Konfiguriere locale, messages, classNames, searchable und nonce für mehrere Selects. Einstellungen am einzelnen Feld überschreiben den nächsten Provider.
import { useState } from 'react'
import { CustomSelect, SelectProvider } from '@rentnerkev/select'
export default function SharedDefaults() {
const [value, setValue] = useState('')
return (
<SelectProvider locale="en" searchable={false}>
<CustomSelect
label="Package"
onValueChange={setValue}
options={[{ value: 'toasts', label: 'Toasts' }]}
value={value}
/>
</SelectProvider>
)
}isSingleValueEmpty()#
Der /value-Helfer erkennt einen leeren String, null und undefined als leere Einzelwerte. Er liefert einen booleschen Wert und grenzt den TypeScript-Typ ein.
import { isSingleValueEmpty } from '@rentnerkev/select/value'
export const hasSelection = !isSingleValueEmpty('tooltips')
export const isEmpty = isSingleValueEmpty(null)toggleSelectedValue()#
Schalte einen Wert in einem readonly Auswahlarray mit deiner Vergleichsfunktion um. Vorhandene Werte werden entfernt, neue angehängt. Beim Überschreiten von maxSelection liefert die Funktion null. Das ursprüngliche Array wird nicht verändert.
import { toggleSelectedValue } from '@rentnerkev/select/value'
export const next = toggleSelectedValue(
['tooltips'],
'toasts',
(option, value) => option === value,
2,
)Übersetzungen & resolveSelectMessages()#
selectMessageCatalog enthält en, de, es und fr. resolveSelectMessages kombiniert eigene Texte mit der Sprache. Die Texte behandeln Pflicht-/Mindest-/Maximalauswahl, Suche, leere Ergebnisse und Löschen. Die Nachrichten für minSelection und maxSelection sind Funktionen mit der Anzahl als Argument.
import { resolveSelectMessages, selectMessageCatalog } from '@rentnerkev/select'
export const messages = resolveSelectMessages('en', {
noResults: 'No package found',
maxSelection: (count) => 'Choose up to ' + count + ' packages',
clearSelection: selectMessageCatalog.en.clearSelection,
})Klassenbereiche & eigenes Design#
className gestaltet die äußere Komponente. classNames enthält root, trigger, content, search, viewport, option, empty, label, description und clear. Setze nur die Bereiche, die du ändern möchtest, und teile Standardwerte über SelectProvider. Importiere das Tailwind-Stylesheet einmal.
import { useState } from 'react'
import { CustomSelect } from '@rentnerkev/select'
import type { SelectClassNames } from '@rentnerkev/select/types'
const classNames: SelectClassNames = {
trigger: 'border-2 border-amber-700 bg-amber-50 text-stone-900',
content: 'bg-amber-50 text-stone-900',
label: 'font-bold',
}
export default function StyledSelect() {
const [value, setValue] = useState('')
return (
<CustomSelect
classNames={classNames}
label="Package"
onValueChange={setValue}
options={[{ value: 'calendar', label: 'Calendar' }]}
value={value}
/>
)
}Dokumentation für deine KI-Tools
Verbinde einen kompatiblen MCP-Client, um Paket-APIs, Anleitungen und Beispiele zu lesen. Öffentlich zugänglich, ohne Konto oder API-Schlüssel.
Der entfernte Zugriff ist optional: Trage diese öffentliche URL selbst in deinem MCP-Client ein. Die Verbindung nutzt Streamable HTTP; das Konfigurationsformat kann abweichen. Die lokalen /ai-Helfer lesen die installierte Paketversion in Node.js oder Bun und verbinden sich niemals automatisch mit diesem Server.
{
"mcpServers": {
"rentnerPackages": {
"url": "https://packages.rentner.dev/mcp"
}
}
}Tools: list_packages, read_package_docs, read_package_api, read_package_examples und search_package_docs.
TypeScript / v6.2.0
API & Typen
Veröffentlichte Signaturen, Props und Typen für diese Version. Klappe einen Eintrag auf, um Definition und verfügbare Importpfade zu sehen.
CustomSelectfunction
@rentnerkev/select@rentnerkev/select/select
export function CustomSelect<TValue = string>(props: LegacySingleSelectProps<TValue>): ReactElement
export function CustomSelect<TValue = string>(props: DirectClearableSingleSelectProps<TValue>): ReactElement
export function CustomSelect<TValue = string>(props: ConfiguredClearableSingleSelectProps<TValue>): ReactElement
export function CustomSelect<TValue = string>(props: DefaultSingleSelectProps<TValue>): ReactElement
export function CustomSelect<TValue = string>(props: MultipleSelectProps<TValue>): ReactElement
export function CustomSelect<TValue = string>(props: CustomSelectProps<TValue>): ReactElement
export function CustomSelect(props: CustomSelectProps<string>): ReactElementSelectProviderfunction
@rentnerkev/select
export function SelectProvider({ children, ...props }: SelectProviderProps): import("react").JSX.ElementresolveSelectMessagesfunction
@rentnerkev/select@rentnerkev/select/messages
export function resolveSelectMessages(locale?: SelectLocale, messages?: Partial<SelectMessages>): SelectMessagesselectMessageCatalogconst
@rentnerkev/select@rentnerkev/select/messages
export const selectMessageCatalog: Record<SelectLocale, SelectMessages>CustomSelectPropstype
@rentnerkev/select@rentnerkev/select/types
export type CustomSelectProps<TValue = string> = SingleSelectProps<TValue> | MultipleSelectProps<TValue>MultipleSelectPropstype
@rentnerkev/select@rentnerkev/select/types
export type MultipleSelectProps<TValue = string> = SharedCustomSelectProps<TValue> & ClearableSelectProps & {
value: ReadonlyArray<TValue>
onValueChange: (value: Array<TValue>) => void
multiple: true
/** Enable removal from the built-in closed selection labels. Defaults to false renderValue takes precedence. */
removableSelectedItems?: boolean
emptyValue?: never
omitEmptyFormValue?: boolean
minSelection?: number
maxSelection?: number
}
interface SharedCustomSelectProps<TValue> extends AriaAttributes, SelectCustomizationProps {
id?: string
name?: string
options: ReadonlyArray<Option<TValue>>
required?: boolean
label?: ReactNode
description?: ReactNode
error?: string | null
disabled?: boolean
readOnly?: boolean
triggerRef?: Ref<HTMLButtonElement>
onBlur?: FocusEventHandler<HTMLDivElement>
icon?: ReactNode
placeholder?: string
className?: string
classNames?: SelectClassNames
searchable?: boolean
nonce?: string
renderOption?: (option: Option<TValue>, state: SelectOptionState) => ReactNode
renderValue?: (options: ReadonlyArray<Option<TValue>>) => ReactNode
fallbackOption?: string
locale?: SelectLocale
messages?: Partial<SelectMessages>
isOptionEqualToValue?: (optionValue: TValue, value: TValue) => boolean
getFormValue?: (value: TValue) => string
}
type ClearableSelectProps = {
clearable: true
onClear?: () => void
} | {
clearable?: false
onClear?: never
}SelectClassNamesinterface
@rentnerkev/select@rentnerkev/select/types
export interface SelectClassNames {
root?: string
trigger?: string
content?: string
search?: string
viewport?: string
option?: string
group?: string
groupLabel?: string
createOption?: string
empty?: string
label?: string
description?: string
clear?: string
control?: string
error?: string
leading?: string
trailing?: string
optionLabel?: string
optionDescription?: string
optionIndicator?: string
selectedLabel?: string
selectedDescription?: string
selectedItems?: string
selectedItem?: string
}SelectOptionStateinterface
@rentnerkev/select@rentnerkev/select/types
export interface SelectOptionState {
selected: boolean
disabled: boolean
}SingleSelectPropstype
@rentnerkev/select@rentnerkev/select/types
export type SingleSelectProps<TValue = string> = LegacySingleSelectProps<TValue> | DirectClearableSingleSelectProps<TValue> | ConfiguredClearableSingleSelectProps<TValue> | DefaultSingleSelectProps<TValue>SelectProviderPropsinterface
@rentnerkev/select@rentnerkev/select/types
export interface SelectProviderProps extends SelectCustomizationProps {
children: ReactNode
locale?: SelectLocale
messages?: Partial<SelectMessages>
classNames?: SelectClassNames
searchable?: boolean
nonce?: string
}SelectVirtualizationOptionsinterface
@rentnerkev/select@rentnerkev/select/types
export interface SelectVirtualizationOptions {
estimateSize?: number
overscan?: number
}Optioninterface
@rentnerkev/select@rentnerkev/select/types
export interface Option<TValue = string> {
value: TValue
label: string
subOption?: string
group?: string
disabled?: boolean
}SelectLocaletype
@rentnerkev/select@rentnerkev/select/messages@rentnerkev/select/types
export type SelectLocale = 'de' | 'en' | 'es' | 'fr'SelectMessagesinterface
@rentnerkev/select@rentnerkev/select/messages@rentnerkev/select/types
export interface SelectMessages {
loading?: string
createOption?: (value: string) => string
clickToRemove?: string
removeSelectedItem?: (label: string) => string
required: string
minSelection: (count: number) => string
maxSelection: (count: number) => string
searchOptions: string
searchPlaceholder: string
noResults: string
noOptions: string
clearSelection: string
}Comboboxfunction
@rentnerkev/select@rentnerkev/select/combobox
export function Combobox<T>(props: SingleComboboxProps<T>): ReactElement
export function Combobox<T>(props: MultipleComboboxProps<T>): ReactElement
export function Combobox<T>(props: ComboboxProps<T>): ReactElementComboboxPropstype
@rentnerkev/select@rentnerkev/select/combobox@rentnerkev/select/combobox/types
export type ComboboxProps<T> = SingleComboboxProps<T> | MultipleComboboxProps<T>getSelectFieldPropsfunction
@rentnerkev/select@rentnerkev/select/form
export function getSelectFieldProps<T>(field: SelectFormField<T>, options?: SelectFormOptions): SelectFieldProps<T>getReadableSelectErrorfunction
@rentnerkev/select@rentnerkev/select/form
export function getReadableSelectError(error: unknown): string | undefinedSelectFormFieldinterface
@rentnerkev/select@rentnerkev/select/form
export interface SelectFormField<T> {
name: string
state: {
value: T
meta?: {
errors?: ReadonlyArray<unknown>
isTouched?: boolean
}
}
handleChange: (value: T) => void
handleBlur: () => void
}SelectFormOptionsinterface
@rentnerkev/select@rentnerkev/select/form
export interface SelectFormOptions {
errorVisibility?: 'touched' | 'always' | 'never'
mapError?: (error: unknown) => string | undefined
}SelectFieldPropsinterface
@rentnerkev/select@rentnerkev/select/form
export interface SelectFieldProps<T> {
name: string
value: T
onValueChange: (value: T) => void
onBlur: () => void
error: string | null
}SelectCustomizationPropsinterface
@rentnerkev/select@rentnerkev/select/types
export interface SelectCustomizationProps {
/** Auto by default: CustomSelect >= 250 options, Combobox >= 1000 true/options force on, false forces off. */
virtualized?: boolean | 'auto' | SelectVirtualizationOptions
controlSize?: 'sm' | 'md' | 'lg'
textOverflow?: 'truncate' | 'wrap'
contentWidth?: 'trigger' | 'content'
portalContainer?: Element | DocumentFragment | null
portalClassName?: string
portalZIndex?: number
}isSingleValueEmptyfunction
@rentnerkev/select/value
export function isSingleValueEmpty(value: unknown): value is '' | null | undefinedtoggleSelectedValuefunction
@rentnerkev/select/value
export function toggleSelectedValue<TValue>(selectedValues: ReadonlyArray<TValue>, nextValue: TValue, isEqual: SelectValueComparator<TValue>, maxSelection?: number): Array<TValue> | nullSelectValueComparatortype
@rentnerkev/select/value
export type SelectValueComparator<TValue> = (optionValue: TValue, value: TValue) => booleanLegacySingleSelectPropstype
@rentnerkev/select/types
export type LegacySingleSelectProps<TValue = string> = SingleSelectPropsBase<TValue> & {
clearable: true
onClear: () => void
emptyValue?: never
onValueChange: (value: TValue) => void
}
type SingleSelectPropsBase<TValue> = SharedCustomSelectProps<TValue> & {
value: TValue | null | undefined
multiple?: false
removableSelectedItems?: never
}
interface SharedCustomSelectProps<TValue> extends AriaAttributes, SelectCustomizationProps {
id?: string
name?: string
options: ReadonlyArray<Option<TValue>>
required?: boolean
label?: ReactNode
description?: ReactNode
error?: string | null
disabled?: boolean
readOnly?: boolean
triggerRef?: Ref<HTMLButtonElement>
onBlur?: FocusEventHandler<HTMLDivElement>
icon?: ReactNode
placeholder?: string
className?: string
classNames?: SelectClassNames
searchable?: boolean
nonce?: string
renderOption?: (option: Option<TValue>, state: SelectOptionState) => ReactNode
renderValue?: (options: ReadonlyArray<Option<TValue>>) => ReactNode
fallbackOption?: string
locale?: SelectLocale
messages?: Partial<SelectMessages>
isOptionEqualToValue?: (optionValue: TValue, value: TValue) => boolean
getFormValue?: (value: TValue) => string
}DirectClearableSingleSelectPropstype
@rentnerkev/select/types
export type DirectClearableSingleSelectProps<TValue = string> = SingleSelectPropsBase<TValue> & {
clearable: true
onClear?: never
emptyValue?: null
onValueChange: (value: TValue | null) => void
}
type SingleSelectPropsBase<TValue> = SharedCustomSelectProps<TValue> & {
value: TValue | null | undefined
multiple?: false
removableSelectedItems?: never
}
interface SharedCustomSelectProps<TValue> extends AriaAttributes, SelectCustomizationProps {
id?: string
name?: string
options: ReadonlyArray<Option<TValue>>
required?: boolean
label?: ReactNode
description?: ReactNode
error?: string | null
disabled?: boolean
readOnly?: boolean
triggerRef?: Ref<HTMLButtonElement>
onBlur?: FocusEventHandler<HTMLDivElement>
icon?: ReactNode
placeholder?: string
className?: string
classNames?: SelectClassNames
searchable?: boolean
nonce?: string
renderOption?: (option: Option<TValue>, state: SelectOptionState) => ReactNode
renderValue?: (options: ReadonlyArray<Option<TValue>>) => ReactNode
fallbackOption?: string
locale?: SelectLocale
messages?: Partial<SelectMessages>
isOptionEqualToValue?: (optionValue: TValue, value: TValue) => boolean
getFormValue?: (value: TValue) => string
}ConfiguredClearableSingleSelectPropstype
@rentnerkev/select/types
export type ConfiguredClearableSingleSelectProps<TValue = string> = SingleSelectPropsBase<TValue> & {
clearable: true
onClear?: never
emptyValue: TValue
onValueChange: (value: TValue) => void
}
type SingleSelectPropsBase<TValue> = SharedCustomSelectProps<TValue> & {
value: TValue | null | undefined
multiple?: false
removableSelectedItems?: never
}
interface SharedCustomSelectProps<TValue> extends AriaAttributes, SelectCustomizationProps {
id?: string
name?: string
options: ReadonlyArray<Option<TValue>>
required?: boolean
label?: ReactNode
description?: ReactNode
error?: string | null
disabled?: boolean
readOnly?: boolean
triggerRef?: Ref<HTMLButtonElement>
onBlur?: FocusEventHandler<HTMLDivElement>
icon?: ReactNode
placeholder?: string
className?: string
classNames?: SelectClassNames
searchable?: boolean
nonce?: string
renderOption?: (option: Option<TValue>, state: SelectOptionState) => ReactNode
renderValue?: (options: ReadonlyArray<Option<TValue>>) => ReactNode
fallbackOption?: string
locale?: SelectLocale
messages?: Partial<SelectMessages>
isOptionEqualToValue?: (optionValue: TValue, value: TValue) => boolean
getFormValue?: (value: TValue) => string
}DefaultSingleSelectPropstype
@rentnerkev/select/types
export type DefaultSingleSelectProps<TValue = string> = SingleSelectPropsBase<TValue> & {
clearable?: false
onClear?: never
emptyValue?: never
onValueChange: (value: TValue) => void
}
type SingleSelectPropsBase<TValue> = SharedCustomSelectProps<TValue> & {
value: TValue | null | undefined
multiple?: false
removableSelectedItems?: never
}
interface SharedCustomSelectProps<TValue> extends AriaAttributes, SelectCustomizationProps {
id?: string
name?: string
options: ReadonlyArray<Option<TValue>>
required?: boolean
label?: ReactNode
description?: ReactNode
error?: string | null
disabled?: boolean
readOnly?: boolean
triggerRef?: Ref<HTMLButtonElement>
onBlur?: FocusEventHandler<HTMLDivElement>
icon?: ReactNode
placeholder?: string
className?: string
classNames?: SelectClassNames
searchable?: boolean
nonce?: string
renderOption?: (option: Option<TValue>, state: SelectOptionState) => ReactNode
renderValue?: (options: ReadonlyArray<Option<TValue>>) => ReactNode
fallbackOption?: string
locale?: SelectLocale
messages?: Partial<SelectMessages>
isOptionEqualToValue?: (optionValue: TValue, value: TValue) => boolean
getFormValue?: (value: TValue) => string
}SelectDefaultstype
@rentnerkev/select/types
export type SelectDefaults = Omit<SelectProviderProps, 'children'>SelectOptionHandlersinterface
@rentnerkev/select/types
export interface SelectOptionHandlers<TValue> {
handleOptionPointerDown: (event?: PointerEvent<HTMLDivElement>) => void
handleOptionPointerUp?: (event: PointerEvent<HTMLDivElement>, value: string) => void
handleOptionPointerMove?: (event: PointerEvent<HTMLDivElement>) => void
handleOptionClick?: (event: MouseEvent<HTMLDivElement>, value: string) => void
handleOptionFocus: (value: TValue, event?: FocusEvent<HTMLDivElement>) => void
handleOptionBlur: (event: FocusEvent<HTMLDivElement>) => void
handleOptionKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void
}SelectOptionsPropsinterface
@rentnerkev/select/types
export interface SelectOptionsProps<TValue> {
entries: ReadonlyArray<OptionEntry<TValue>>
multiple: boolean
renderOption: SharedCustomSelectProps<TValue>['renderOption']
className: string | undefined
classNames: SelectClassNames
textOverflow: 'truncate' | 'wrap'
isSelected: (value: TValue) => boolean
isOptionDisabled: (option: Option<TValue>) => boolean
handler: SelectOptionHandlers<TValue>
}
interface SharedCustomSelectProps<TValue> extends AriaAttributes, SelectCustomizationProps {
id?: string
name?: string
options: ReadonlyArray<Option<TValue>>
required?: boolean
label?: ReactNode
description?: ReactNode
error?: string | null
disabled?: boolean
readOnly?: boolean
triggerRef?: Ref<HTMLButtonElement>
onBlur?: FocusEventHandler<HTMLDivElement>
icon?: ReactNode
placeholder?: string
className?: string
classNames?: SelectClassNames
searchable?: boolean
nonce?: string
renderOption?: (option: Option<TValue>, state: SelectOptionState) => ReactNode
renderValue?: (options: ReadonlyArray<Option<TValue>>) => ReactNode
fallbackOption?: string
locale?: SelectLocale
messages?: Partial<SelectMessages>
isOptionEqualToValue?: (optionValue: TValue, value: TValue) => boolean
getFormValue?: (value: TValue) => string
}CustomSelectLogicResultinterface
@rentnerkev/select/types
export interface CustomSelectLogicResult<TValue> {
state: SelectCustomizationProps & {
popupStyle: CSSProperties
popupId: string
portalTarget: Element | DocumentFragment | null
virtualOptionsModule: typeof import('../Components/VirtualSelectOptions.tsx') | null
virtualized: boolean | SelectVirtualizationOptions
textOverflow: 'truncate' | 'wrap'
contentWidth: 'trigger' | 'content'
name: string | undefined
required: boolean
disabled: boolean
readOnly: boolean
externalError: string | null | undefined
label: ReactNode
description: ReactNode
icon: ReactNode
placeholder: string | undefined
className: string | undefined
classNames: SelectClassNames
searchable: boolean
nonce: string | undefined
renderOption: SharedCustomSelectProps<TValue>['renderOption']
renderValue: SharedCustomSelectProps<TValue>['renderValue']
fallbackOption: string | undefined
multiple: boolean
omitEmptyFormValue: boolean
clearable: boolean
selectedValues: ReadonlyArray<TValue>
formEntries: ReadonlyArray<{
key: string
value: string
}>
ariaProps: AriaAttributes
ariaLabel: string | undefined
describedBy: string | undefined
labelledBy: string | undefined
showClear: boolean
showRemovableSelectedItems?: boolean
isOptionDisabled: (option: Option<TValue>) => boolean
selectedOptions: ReadonlyArray<Option<TValue>>
selectedLabel: string
messages: SelectMessages
triggerId: string
labelId: string
descriptionId: string
errorId: string
open: boolean
searchValue: string
optionEntries: ReadonlyArray<OptionEntry<TValue>>
filteredOptions: ReadonlyArray<OptionEntry<TValue>>
selectedEntries: ReadonlyArray<OptionEntry<TValue>>
selectedRadixValue: string
hasError: boolean
resolvedError: string | null
hasLeftIcon: boolean
isOptionEqualToValue: (optionValue: TValue, value: TValue) => boolean
isValueSelected: (value: TValue) => boolean
}
handler: {
option: SelectOptionHandlers<TValue>
handleVirtualClose: () => void
handleContentFocusCapture: (event: FocusEvent<HTMLDivElement>) => void
handleTriggerPointerDown: (event: PointerEvent<HTMLButtonElement>) => void
handleTriggerClick: () => void
handleTriggerKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void
handleSearchChange: (event: ChangeEvent<HTMLInputElement>) => void
handleSearchPointerDown: (event: PointerEvent<HTMLInputElement>) => void
handleSearchKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void
handleFieldBlur: (event: FocusEvent<HTMLDivElement>) => void
handleInvalid: (event: InvalidEvent<HTMLInputElement>) => void
handleValueChange: (value: string) => void
handleClear: () => void
handleRemoveSelectedItem?: (optionKey: string) => void
handleOpenChange: (open: boolean) => void
closeAfterOptionRemoval: () => void
handleContentKeyDownCapture: (event: KeyboardEvent<HTMLDivElement>) => void
}
refs: {
root: RefObject<HTMLDivElement | null>
content: RefObject<HTMLDivElement | null>
overlayContent: RefCallback<HTMLDivElement>
trigger: RefCallback<HTMLButtonElement>
searchInput: RefObject<HTMLInputElement | null>
validationInput: RefObject<HTMLInputElement | null>
scroll: RefObject<HTMLDivElement | null>
virtualNavigation: RefObject<SelectVirtualNavigation | null>
pendingVirtualNavigation: RefObject<Array<KeyboardEvent<HTMLDivElement>>>
}
}
interface SharedCustomSelectProps<TValue> extends AriaAttributes, SelectCustomizationProps {
id?: string
name?: string
options: ReadonlyArray<Option<TValue>>
required?: boolean
label?: ReactNode
description?: ReactNode
error?: string | null
disabled?: boolean
readOnly?: boolean
triggerRef?: Ref<HTMLButtonElement>
onBlur?: FocusEventHandler<HTMLDivElement>
icon?: ReactNode
placeholder?: string
className?: string
classNames?: SelectClassNames
searchable?: boolean
nonce?: string
renderOption?: (option: Option<TValue>, state: SelectOptionState) => ReactNode
renderValue?: (options: ReadonlyArray<Option<TValue>>) => ReactNode
fallbackOption?: string
locale?: SelectLocale
messages?: Partial<SelectMessages>
isOptionEqualToValue?: (optionValue: TValue, value: TValue) => boolean
getFormValue?: (value: TValue) => string
}InternalCustomSelectLogicResulttype
@rentnerkev/select/types
export type InternalCustomSelectLogicResult<TValue> = CustomSelectLogicResult<TValue> & {
handler: {
handleRemoveSelectedItem: (optionKey: string) => void
}
}SelectProviderLogicResultinterface
@rentnerkev/select/types
export interface SelectProviderLogicResult {
state: {
contextValue: SelectDefaults
}
}SelectValueOptionstype
@rentnerkev/select/types
export type SelectValueOptions<TValue> = Pick<SingleSelectProps<TValue>, SelectValueKeys> | Pick<MultipleSelectProps<TValue>, SelectValueKeys | 'maxSelection'>
type SelectValueKeys = 'value' | 'onValueChange' | 'multiple' | 'options' | 'emptyValue' | 'onClear' | 'getFormValue' | 'isOptionEqualToValue'SelectValuesResultinterface
@rentnerkev/select/types
export interface SelectValuesResult<TValue> {
state: {
selectedValues: ReadonlyArray<TValue>
formEntries: ReadonlyArray<{
key: string
value: string
}>
}
handler: {
handleSelectValue: (value: TValue) => void
handleClearValues: () => void
}
}SelectOptionIdentityResultinterface
@rentnerkev/select/types
export interface SelectOptionIdentityResult<TValue> {
state: {
optionEntries: ReadonlyArray<OptionEntry<TValue>>
}
}PackageInfointerface
@rentnerkev/select/ai
export interface PackageInfo {
name: string
version: string
description: string
license: string
homepage: string
repository: {
type: string
url: string
}
exports: Record<string, string | {
types?: string
import?: string
default?: string
}>
peerDependencies: Record<string, string>
}PackageDocumentinterface
@rentnerkev/select/ai
export interface PackageDocument {
path: string
content: string
}PackageApiinterface
@rentnerkev/select/ai
export interface PackageApi {
package: string
version: string
subpaths: Record<string, string>
declarations: PackageDocument[]
}PackageSearchMatchinterface
@rentnerkev/select/ai
export interface PackageSearchMatch {
path: string
line: number
text: string
}PackageExampleinterface
@rentnerkev/select/ai
export interface PackageExample {
language: string
code: string
}getPackageInfofunction
@rentnerkev/select/ai
export function getPackageInfo(): PackageInfogetPackageDocumentationfunction
@rentnerkev/select/ai
export function getPackageDocumentation(document?: 'readme' | 'usage'): PackageDocumentgetPackageApifunction
@rentnerkev/select/ai
export function getPackageApi(options?: {
subpath?: string
symbol?: string
}): PackageApisearchPackageDocumentationfunction
@rentnerkev/select/ai
export function searchPackageDocumentation(query: string): PackageSearchMatch[]getPackageExamplesfunction
@rentnerkev/select/ai
export function getPackageExamples(): PackageExample[]ComboboxBasePropsinterface
@rentnerkev/select/combobox/types
export interface ComboboxBaseProps<T> extends AriaAttributes, SelectCustomizationProps {
options: ReadonlyArray<T>
searchValue: string
onSearchValueChange: (value: string) => void
getOptionKey: (option: T) => string
getOptionLabel: (option: T) => string
getOptionGroup?: (option: T) => string | undefined
/** Receives a trimmed query the application owns creating and selecting the new option. */
onCreateOption?: (searchValue: string) => void
createOptionLabel?: (searchValue: string) => string
getOptionDescription?: (option: T) => ReactNode
isOptionDisabled?: (option: T) => boolean
isOptionEqualToValue?: (option: T, value: T) => boolean
renderOption?: (option: T, state: {
selected: boolean
active: boolean
disabled: boolean
}) => ReactNode
filterMode?: 'external' | 'local'
loading?: boolean
loadingText?: ReactNode
emptyText?: ReactNode
clearable?: boolean
id?: string
name?: string
getFormValue?: (value: T) => string
label?: ReactNode
description?: ReactNode
error?: string | null
required?: boolean
disabled?: boolean
readOnly?: boolean
placeholder?: string
inputRef?: Ref<HTMLInputElement>
onBlur?: (event: FocusEvent<HTMLDivElement>) => void
className?: string
classNames?: SelectClassNames
locale?: SelectLocale
messages?: Partial<SelectMessages>
}SingleComboboxPropsinterface
@rentnerkev/select/combobox/types
export interface SingleComboboxProps<T> extends ComboboxBaseProps<T> {
multiple?: false
value: T | null
onValueChange: (value: T | null) => void
}MultipleComboboxPropsinterface
@rentnerkev/select/combobox/types
export interface MultipleComboboxProps<T> extends ComboboxBaseProps<T> {
multiple: true
value: ReadonlyArray<T>
onValueChange: (value: T[]) => void
}ComboboxEntryinterface
@rentnerkev/select/combobox/types
export interface ComboboxEntry<T> {
option: T
key: string
id: string
label: string
group?: string
position?: number
description: ReactNode
disabled: boolean
selected: boolean
}ComboboxLogicResultinterface
@rentnerkev/select/combobox/types
export interface ComboboxLogicResult<T> {
state: {
virtualOptionsModule: typeof import('../Components/VirtualComboboxOptions.tsx') | null
inputId: string
listId: string
hasLabel: boolean
labelId: string
descriptionId: string
errorId: string
labelledBy: string | undefined
describedBy: string | undefined
open: boolean
activeId: string | undefined
activeEntry: ComboboxEntry<T> | undefined
activeIndex: number
navigationVersion: number
virtualization: boolean | SelectVirtualizationOptions
entries: ReadonlyArray<ComboboxEntry<T>>
messages: SelectMessages
classNames: SelectClassNames
controlSize: SelectCustomizationProps['controlSize']
textOverflow: 'truncate' | 'wrap'
portalContainer: Element | DocumentFragment | null | undefined
portalClassName: string | undefined
popupStyle: CSSProperties
multiple: boolean
selectedItems: ReadonlyArray<{
key: string
label: string
disabled: boolean
removeLabel: string
}>
formValues: ReadonlyArray<{
key: string
value: string
}>
emptySelection: boolean
formValue: string
hasError: boolean
error: string | null | undefined
loadingText: ReactNode
emptyText: ReactNode
showClear: boolean
canCreate?: boolean
createLabel?: string
createId?: string
createActive?: boolean
}
handler: {
handleChange: (event: ChangeEvent<HTMLInputElement>) => void
handleFocus: () => void
handleKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void
handleFieldBlur: (event: FocusEvent<HTMLDivElement>) => void
handleOptionSelect: (entry: ComboboxEntry<T>) => void
handleOptionActivate: (key: string) => void
handleKeepFocus: (event: MouseEvent<HTMLElement>) => void
handleClear: () => void
handleRemoveSelectedItem: (key: string) => void
handleInvalid: (event: InvalidEvent<HTMLInputElement>) => void
handleCreateOption?: () => void
handleCreateActivate?: () => void
}
refs: {
root: RefObject<HTMLDivElement | null>
content: RefObject<HTMLDivElement | null>
popupContent: RefCallback<HTMLDivElement>
validation: RefObject<HTMLInputElement | null>
input: RefCallback<HTMLInputElement>
}
}InternalComboboxLogicResulttype
@rentnerkev/select/combobox/types
export type InternalComboboxLogicResult<T> = ComboboxLogicResult<T> & {
state: {
entries: ReadonlyArray<ComboboxEntry<T> & {
position: number
}>
}
}ComboboxOptionPropsinterface
@rentnerkev/select/combobox/types
export interface ComboboxOptionProps<T> {
entry: ComboboxEntry<T>
state: Pick<ComboboxLogicResult<T>['state'], 'activeId' | 'classNames' | 'textOverflow'>
handler: Pick<ComboboxLogicResult<T>['handler'], 'handleKeepFocus' | 'handleOptionActivate' | 'handleOptionSelect'>
renderOption: ComboboxProps<T>['renderOption']
index?: number
setSize?: number
measureElement?: RefCallback<HTMLDivElement>
style?: CSSProperties
}VirtualComboboxOptionsPropsinterface
@rentnerkev/select/combobox/types
export interface VirtualComboboxOptionsProps<T> {
state: Pick<ComboboxLogicResult<T>['state'], 'multiple' | 'listId' | 'labelledBy' | 'entries' | 'activeId' | 'activeIndex' | 'navigationVersion' | 'virtualization' | 'classNames' | 'textOverflow' | 'popupStyle' | 'canCreate' | 'createId' | 'createLabel' | 'createActive'>
handler: ComboboxOptionProps<T>['handler'] & Pick<ComboboxLogicResult<T>['handler'], 'handleCreateOption' | 'handleCreateActivate'>
renderOption: ComboboxProps<T>['renderOption']
loading?: boolean
ariaLabel: string
}ComboboxCreateOptionPropsinterface
@rentnerkev/select/combobox/types
export interface ComboboxCreateOptionProps {
state: Pick<ComboboxLogicResult<unknown>['state'], 'createId' | 'createLabel' | 'createActive' | 'classNames' | 'entries'>
handler: Pick<ComboboxLogicResult<unknown>['handler'], 'handleCreateOption' | 'handleCreateActivate' | 'handleKeepFocus'>
}VirtualComboboxOptionsLogicResultinterface
@rentnerkev/select/combobox/types
export interface VirtualComboboxOptionsLogicResult<T> {
state: {
rows: ReadonlyArray<{
item: VirtualItem
entry: ComboboxEntry<T>
}>
totalSize: number
height: number
}
refs: {
viewport: RefObject<HTMLDivElement | null>
}
virtualizer: ReactVirtualizer<HTMLElement, HTMLElement>
}