enes

Radio Button

A radio button lets someone choose a single option from a set of mutually exclusive choices. Group several radio buttons with a shared name, or use bind:group to bind the selected value to a variable.

Usage

<script>
	import { RadioButton } from 'fluentui-svelte';
</script>

<RadioButton label="Option 1" />

Grouping

While you can use name="inputName" to group items and have only one checked, you can use bind:group to update that variable with the value of the selected input and inspect it in your console. Read More

Disabled

The disabled prop can be used to disable a radio button, preventing user interaction.

Checked

The checked prop allows you to control the checked state of the radio button. This is useful for controlled components.

Component Props

NameTypeDefaultDescription
labelstringThe label displayed next to the radio button.
group bindableunknownBindable value representing a group of radio inputs that the input will be bound to.
checked bindablebooleanfalseWhether the radio button is selected.
ref bindableHTMLInputElementThe DOM reference of the radio button element.
labelAttributesPolymorphicPropsThe attributes to spread on the label wrapping the radio button.
Element Attributes (input)