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.

Form Control Attributes

Attributes and events apply to the native form field; ref gives you access to it. For the container, use wrapperAttributes and wrapperRef.

Component Props

NameTypeDefaultDescription
labelstringThe label displayed next to the radio button. Inside a Label, it is not rendered
group bindableunknownBindable value representing a group of radio inputs that the input will be bound to.
checked bindableboolean | nullfalseWhether the radio button is selected.
ref bindableHTMLInputElement | nullThe DOM reference of the radio button element.
wrapperAttributesHTMLAttributesThe attributes to spread on the wrapper element.
wrapperRef bindableHTMLDivElement | nullThe DOM reference of the wrapper element.
Element Attributes (input)
Edit this Doc View as Markdown