aboutsummaryrefslogtreecommitdiffstats
path: root/code/app/src/lib/components/checkbox.svelte
blob: b2fcddb65a62c9f8fc6697f5a843c7421175b603 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script lang="ts">
    import pwKey from "$actions/pwKey";
    import { random_string } from "$lib/helpers";

    export let label: string;
    export let id: string | undefined = "input__" + random_string(4);
    export let name: string | undefined = undefined;
    export let disabled: boolean | null = null;
    export let checked: boolean;
    export let _pwKey: string | undefined = undefined;
</script>

<div class="flex items-center">
    <input
        {name}
        use:pwKey={_pwKey}
        {disabled}
        {id}
        type="checkbox"
        bind:checked
        class="h-4 w-4 text-teal-600 focus:ring-teal-500 border-gray-300 rounded"
    />
    <label for={id} class="ml-2 block text-sm text-gray-900">{label}</label>
</div>