BadgeArrayEmit

<Story name="Edit array via Set component" knobs={{ canEdit: true, minimum: 0 }} let:knobs={{ canEdit, minimum }}> <ReactiveSet input={['A Tale of Four Cities', 'www.google.com']} let:value={editedBooks} let:add let:remove> <BadgeArrayEmit strings={editedBooks} {canEdit} {minimum} addMessage="Add Book" on:itemclicked={(e) => console.log('itemclicked', e.detail)} on:itemremoved={(e) => { remove(e.detail.value); }} on:additem={() => { const string = prompt('What would you like to add?'); if (string) { add(string.trim()); } }} />

console.log('itemclicked', e.detail)} on:additem={(e) => { const string = prompt('What book would you like to avoid?'); if (string) { books = [...books, string.trim()]; } }} on:itemremoved={(e) => { books.splice(e.detail.index, 1); books = books; }} /> alert('fired')} /> alert('fired')} />
Edit page in GitHub