`isChecked` property in Checkbox prop `choices` is not working
spassvogel opened this issue · 0 comments
spassvogel commented
Describe the bug
The choices
prop of Checkbox accepts an array of the following type:
export type CheckboxItem = {
value: string;
label?: string;
isChecked?: boolean;
};
This leads me to believe that isChecked
can be used for the initial checked value. This does not work, however.
Reproduction
<script>
import {Checkbox} from 'flowbite-svelte'
const choices = [{
value: 'd',
label: 'Donatello',
isChecked: true
}, {
value: 'l',
label: 'Leonardo',
isChecked: true
}, {
value: 'm',
label: 'Michelangelo'
},{
value: 'r',
label: 'Raphael'
}];
</script>
<Checkbox
choices={choices}
/>
I expect Donatello and Leonardo to be checked ,but they are not.
I know it's possible to databind to the group
property, but because in my case the checked state is derived from another state, this is not an option. It would be great if isChecked
worked, and I could handle the group state myself.
Flowbite version and System Info
"svelte": "^4.2.7",
"flowbite": "^2.5.2",
"flowbite-svelte": "^0.47.1",