Saltar al contenido
El Muestrario

componente · @solu30/ui-kit/input

Combobox

El componente, montado

Cargando el espécimen…

Cargando el chunk del paquete instalado…

De dónde se importa

import { Combobox } from '@solu30/ui-kit/input'

Props

15 props declaradas en los tipos de la versión instalada.
PropRequeridaTipoQué hace
optionsComboboxOption[]Available options.
valueopcionalstringCurrently selected value (matches `ComboboxOption.value`).
onChange(value: string) => voidCallback when an existing option is selected.
onCreateopcional(label: string) => void | Promise<void>When provided, enables creatable mode: if the typed text has no exact (case-insensitive) match among `options`, a "Crear «texto»" row appears at the end of the list and calls this with the trimmed typed label.
placeholderopcionalstringPlaceholder shown on the closed trigger when nothing is selected.
searchPlaceholderopcionalstringPlaceholder for the search input inside the popup.
createLabelopcionalstringLabel prefix for the create row. Default: "Crear".
labelopcionalstringLabel above the trigger.
erroropcionalstringError message — renders below the trigger and marks it invalid.
disabledopcionalbooleanDisables the trigger entirely.
loadingopcionalbooleanShows a spinner on the trigger and disables interaction (e.g. while `onCreate` is in flight upstream).
clearableopcionalbooleanShows a clear ("x") affordance when a value is selected.
onClearopcional() => voidCalled when the clear affordance is activated.
noResultsTextopcionalstringText shown when there are no matches and creation isn't available/eligible.
classNameopcionalstringExtra classes on the root wrapper.

Ejemplo del paquete

<Combobox
label="Puesto"
options={puestos.map((p) => ({ value: p.id, label: p.nombre }))}
value={puestoId}
onChange={setPuestoId}
onCreate={async (nombre) => {
const created = await createPuesto({ nombre })
setPuestoId(created.id)
}}
placeholder="Seleccionar puesto..."
searchPlaceholder="Buscar puesto..."
/>

Del @example del JSDoc de @solu30/ui-kit, sin editar. Cuatro de los 69 ejemplos del paquete traen pegada la firma cruda del .d.ts —el mismo defecto del extractor que se come las descripciones—, y por eso la caja tiene tope de alto: el ejemplo de verdad suele estar al final.