summaryrefslogtreecommitdiffstatshomepage
path: root/frontend/src/lib/components/LabelledBlock.svelte
blob: feb563edb257c23a43a325b370f12c55aebc057e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script lang="ts">
	import { idFromLabel } from '$lib/Utils';

	export let label: string;

	const id = idFromLabel(label);
</script>

<div class="flex flex-col">
	<div class="flex">
		<label for={id}>{label}</label>
		{#if $$slots.controls}
			<div class="grow" />
			<slot name="controls" />
		{/if}
	</div>
	<slot {id} />
</div>