Saltar al contenido
El Muestrario

componente · @solu30/ui-kit/input

ArrayItemsEditor

Editor de una lista de objetos: una tarjeta por ítem, con campos configurables y alta y baja.

Seguir leyendo — 2 párrafos más

ArrayItemsEditor — dynamic list editor for structured objects.

Renders a card per item with configurable text/textarea fields and add/remove controls. Generic over any flat record type.

2 sitios de import en 2 de 15 verticales — un archivo que la importa cuenta una vez, monte una instancia o veinte.

  • cmp-packages
  • dietaly

El componente, montado

Cargando el espécimen…

Cómo se usa

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

Props

6 props declaradas en los tipos de la versión instalada.
PropRequeridaTipoQué hace
itemssíT[]Current list of items
onChangesí(items: T[]) => voidCalled with the updated list on any change
fieldssíFieldDef[]Field definitions — each entry renders one input or textarea per item
addLabelsístringLabel for the "add item" button
emptyTextopcionalstringText shown when the list is empty (default: "No items yet.")
disabledopcionalbooleanDisables all inputs and add/remove buttons

Ejemplo del paquete

<ArrayItemsEditor<BenefitItem>
  items={benefits}
  onChange={setBenefits}
  fields={[
    { key: 'icon', label: 'Icon', type: 'text', placeholder: 'heart, leaf…' },
    { key: 'title', label: 'Title', type: 'text' },
    { key: 'text', label: 'Description', type: 'textarea' },
  ]}
  addLabel="Add benefit"
/>

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.