thomas-lowry / figma-plugin-ds-svelte

Figma Plugin DS components made with Svelte
MIT License
180 stars 26 forks source link

Components should emit consistent events #11

Open michaelgaigg opened 3 years ago

michaelgaigg commented 3 years ago

At a minimum emit event.detail with attributes like value or checked, e.g. SelectMenu change event has event.detail.value but Checkbox change event does not transmit event.detail

thomas-lowry commented 3 years ago

Open to PRs on this if you have a use case where this is useful to you. In most cases cases I have just done this with Svelte's reactive declarations with values on those elements bound to variables.

Something like this

let menuItems = [{},{}];
let selectedItem;
$: selectedItem, functionName(); //run this when selectedItem changes
<SelectMenu bind:menuItems={menuItems} bind:value={selectedItem}/>