sterling-svelte  2.0.0
A modern, accessible, lightweight UI component library for Svelte.

Radio

An interactive element used to make a single choice from a set of options.

Code
<script lang="ts">
  import { Radio } from '@geoffcox/sterling-svelte';

  let selectedValue : string = $state('item-1');
</script>

<Radio bind:group={selectedValue} name="choices" value="item-1">Item 1</Radio>
<Radio bind:group={selectedValue} name="choices" value="item-2">Item 1</Radio>
<Radio bind:group={selectedValue} name="choices" value="item-3">Item 3</Radio>

Members

Property NameTypeDefaultComment
groupany | undefined | nullundefinedThe group to bind to the selected value for a group of radio buttons.

Considerations

  • Includes HTMLInputElement props, events, and methods.

Anatomy

radio (<div>)
  container (<div>)
    hidden (<input type="radio">)
    indicator (<div>)
  label (<label>)
    children