matyunya / smelte

UI framework with material components built with Svelte and Tailwind CSS
https://smeltejs.com/
MIT License
1.53k stars 114 forks source link

Make color prop reactive #272

Open r2dev2 opened 2 years ago

r2dev2 commented 2 years ago

The color prop currently isn't reactive as shown by this example in which the color doesn't switch.

<script>
  import { Button } from "smelte";
  export let name;

  let color = 'primary';

  const switchColor = () => {
    console.log('switching color');
    color = color == 'primary' ? 'secondary': 'primary';
  };
</script>

<Button {color} on:click={switchColor}>
  Test Button
</Button>

It would be nice if the color prop was reactive. Also, is the current non-reactivity intentional or not?