Closed amyipdev closed 7 months ago
Hey @amyipdev 👋🏻 Thanks for submitting an issue!
The example uses shorthand, so it's actually assigning the color
that is currently being processed by the each
block.
Example:
<script lang="ts">
import { Button } from 'sveltestrap';
const colors: any = [
'primary',
'secondary',
'success',
'danger',
'warning',
'info',
'light',
'dark'
];
</script>
{#each colors as color}
<div>
<Button {color}>{color}</Button>
</div>
{/each}
This
<Button {color}>{color}</Button>
is the same as
<Button color={color}>{color}</Button>
Which renders as
<Button color="primary">primary</Button>
Seen first at https://sveltestrap.js.org/?path=/story/components-button--button
For setting buttons, for example - you can't just put the color name, it has to be color=colorname, such as: