bestguy / sveltestrap

Bootstrap 4 & 5 components for Svelte
https://sveltestrap.js.org
MIT License
1.3k stars 180 forks source link

Allow markup in Input labels #583

Open igorsantos07 opened 7 months ago

igorsantos07 commented 7 months ago

In short, the Input label should accept either the usual label prop or also a slot named label, so we can use markup inside the label.

<Input type="switch" bind:checked={doomed}>
  <svelte:fragment slot="label">
    I agree with the <a href="/boring-terms">Terms & Conditions</a> without reading them
  </svelte:fragment>
</Input>

Also, to avoid spamming the repo with issues: <Label check/> yields class="form-label form-label-check", where the first class is unnecessary and creates extra bottom-margin.