Use indeterminate for select all

This commit is contained in:
Adria Navarro 2023-06-07 14:48:17 +01:00
parent 615d825817
commit 1bdf62ab41
1 changed files with 2 additions and 0 deletions

View File

@ -14,6 +14,7 @@
$: updateSelected(selectedBooleans) $: updateSelected(selectedBooleans)
$: dispatch("change", selected) $: dispatch("change", selected)
$: allSelected = selected?.length === options.length $: allSelected = selected?.length === options.length
$: noneSelected = !selected?.length
function reset() { function reset() {
return Array(options.length).fill(true) return Array(options.length).fill(true)
@ -48,6 +49,7 @@
text={selectAllText} text={selectAllText}
compress compress
lighter lighter
indeterminate={!allSelected && !noneSelected}
/> />
</div> </div>
{/if} {/if}