refactor: checkbox (#18337)

refactor: checkboxes
This commit is contained in:
Jason Rasmussen 2025-05-16 14:13:39 -04:00 committed by GitHub
parent 8f045bc602
commit fa45a26cff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 47 additions and 67 deletions

View file

@ -1,37 +0,0 @@
<script lang="ts">
interface Props {
id: string;
label: string;
checked?: boolean | undefined;
disabled?: boolean;
labelClass?: string | undefined;
name?: string | undefined;
value?: string | undefined;
onchange?: () => void;
}
let {
id,
label,
checked = $bindable(),
disabled = false,
labelClass = undefined,
name = undefined,
value = undefined,
onchange = () => {},
}: Props = $props();
</script>
<div class="flex items-center space-x-2">
<input
type="checkbox"
{name}
{id}
{value}
{disabled}
class="size-5 flex-shrink-0 focus-visible:ring"
bind:checked
{onchange}
/>
<label class={labelClass} for={id}>{label}</label>
</div>