~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/spaces-bookclub

Book club: a Svelte demo app for atproto spaces (@atproto/lex-space)

0
0
main
37 lines · 663 B Raw History
<script lang="ts">
  import type { Snippet } from 'svelte'

  let {
    label,
    hint,
    children,
  }: {
    label: string
    hint?: string
    /** The control, given the id the label points to */
    children: Snippet<[id: string]>
  } = $props()

  const id = $props.id()
</script>

<div class="field">
  <label for={id}>{label}</label>
  {@render children(id)}
  {#if hint}<p class="hint">{hint}</p>{/if}
</div>

<style>
  .field {
    display: grid;
    gap: var(--space-1);
  }
  label {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
  }
  .hint {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
  }
</style>