componente · @solu30/ui-kit/input
Combobox
Selector con búsqueda que además permite crear una opción nueva con el texto que se tipeó.
19 sitios de import en 4 de 15 verticales — un archivo que la importa cuenta una vez, monte una instancia o veinte.
- cmp-packages
- gestorsalon
- luigi
- raquetea
El componente, montado
Cargando el espécimen…
export function ComboTagMatrix() {
const [crew, setCrew] = useState('')
const [toppings, setToppings] = useState<string[]>(['dulce-de-leche'])
const [allergens, setAllergens] = useState<string[]>(['gluten', 'frutos secos'])
return (
<Stage label="Combobox, MultiSelect y TagInput · ninguno tiene error" tall wide>
<div className="grid w-full grid-cols-1 gap-3 sm:grid-cols-2">
<Combobox
label="Tripulación de guardia"
options={CREW_OPTIONS}
value={crew}
onChange={setCrew}
onCreate={(name) => setCrew(name)}
placeholder="Buscar o agregar..."
/>
<Combobox
label="Proveedor de catering"
options={CREW_OPTIONS}
value=""
onChange={() => {}}
error="No hay proveedores habilitados para esta fecha"
/>
<MultiSelect
label="Toppings incluidos"
options={TOPPING_OPTIONS}
value={toppings}
onChange={setToppings}
showSelectAll
summaryAfter={3}
/>
<div className="flex flex-col gap-1.5">
<TagInput
label="Alérgenos declarados"
value={allergens}
onChange={setAllergens}
placeholder="Agregar alérgeno..."
/>
<span className="text-xs text-content/50">
TagInput no tiene error: una lista mal cargada no se puede marcar en rojo — KIT-023.
</span>
</div>
</div>
</Stage>
)
}De specimens/input.tsx · ComboTagMatrix: el espécimen del Muestrario, no un ejemplo oficial del paquete. Muestra cómo se usa la pieza de verdad, montada contra los tipos instalados —eso es lo que vale— pero no es documentación del kit.
Cómo se usa
import { Combobox } from '@solu30/ui-kit/input'Props
| Prop | Requerida | Tipo | Qué hace |
|---|---|---|---|
| options | sí | ComboboxOption[] | Available options. |
| value | opcional | string | Currently selected value (matches `ComboboxOption.value`). |
| onChange | sí | (value: string) => void | Callback when an existing option is selected. |
| onCreate | opcional | (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. |
| placeholder | opcional | string | Placeholder shown on the closed trigger when nothing is selected. |
| searchPlaceholder | opcional | string | Placeholder for the search input inside the popup. |
| createLabel | opcional | string | Label prefix for the create row. Default: "Crear". |
| label | opcional | string | Label above the trigger. |
| error | opcional | string | Error message — renders below the trigger and marks it invalid. |
| disabled | opcional | boolean | Disables the trigger entirely. |
| loading | opcional | boolean | Shows a spinner on the trigger and disables interaction (e.g. while `onCreate` is in flight upstream). |
| clearable | opcional | boolean | Shows a clear ("x") affordance when a value is selected. |
| onClear | opcional | () => void | Called when the clear affordance is activated. |
| noResultsText | opcional | string | Text shown when there are no matches and creation isn't available/eligible. |
| className | opcional | string | Extra 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: son 65 de los 541 símbolos. La sangría y los renglones en blanco son los del paquete.