~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0
46 lines · 1.1 KB Raw History
<script lang="ts">
	let { label, checked = $bindable(false) }: { label: string; checked?: boolean } = $props();
</script>

<label class="check"><input type="checkbox" bind:checked /><span>{label}</span></label>

<style>
	.check {
		display: flex;
		align-items: flex-start;
		gap: var(--space-2);
		cursor: pointer;
	}

	/* Drawn as the fields are, in either scheme: the edge of a field, and
	   when checked, the primary fill with a tick in --on-primary. */
	input {
		appearance: none;
		position: relative;
		flex: none;
		width: var(--text-lg);
		height: var(--text-lg);
		margin: var(--space-0-5) 0 0;
		border: var(--border) solid var(--field-line);
		border-radius: var(--radius-sm);
		background: var(--bg);
		cursor: pointer;
	}

	input:checked {
		border-color: var(--primary);
		background: var(--primary);
	}

	input:checked::after {
		content: '';
		position: absolute;
		top: var(--space-0-5);
		left: var(--space-1-5);
		width: var(--space-1);
		height: var(--space-2);
		border: solid var(--on-primary);
		border-width: 0 var(--focus-width) var(--focus-width) 0;
		transform: rotate(45deg);
	}
</style>