aboutsummaryrefslogtreecommitdiffstats
path: root/apps/kit/src/lib/components/checkbox.svelte
blob: 311d154993cdcac81374e79d97e3437ba70427fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<script lang="ts">
    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;
</script>

<div class="flex items-center">
    <input
        {name}
        {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>