Skip to main content

Radio buttons

Allow users to select one option from a list. This component uses the base structure of the Input component.

Legend
<RadioButtons label="Legend">
<Radio name="radio" id="radio_1" value="1" label="Option 1" />
<Radio name="radio" id="radio_2" value="2" label="Option 2" />
</RadioButtons>

Usage​

To follow user-centred design and GDPR best practices, we should only ask users for information we need. In that respect, all form fields of the Pallote component library are by default required.

For the CSS library, you do not need to add the required property to the form fields, it is added automatically with the javascript import.

Props​

Direction​

Portrait
Landscape
<RadioButtons label="Portrait">
<Radio name="portrait" id="portrait_1" value="1" label="Option 1" />
<Radio name="portrait" id="portrait_2" value="2" label="Option 2" />
</RadioButtons>

<RadioButtons label="Landscape" direction="landscape">
<Radio name="landscape" id="landscape_1" value="1" label="Option 1" />
<Radio name="landscape" id="landscape_2" value="2" label="Option 2" />
</RadioButtons>

Error​

Error
<RadioButtons label="Error" error="This is the error message">
<Radio name="error" id="error_1" value="1" label="Option 1" />
<Radio name="error" id="error_2" value="2" label="Option 2" />
</RadioButtons>

Disabled​

Disabled
<RadioButtons label="Disabled" disabled>
<Radio name="disabled" id="disabled_1" value="1" label="Option 1" />
<Radio name="disabled" id="disabled_2" value="2" label="Option 2" />
</RadioButtons>

Optional​

Optional
<RadioButtons label="Optional" optional>
<Radio name="optional" id="optional_1" value="1" label="Option 1" />
<Radio name="optional" id="optional_2" value="2" label="Option 2" />
</RadioButtons>

Hint​

Hint

This is a hint to give more details

<RadioButtons label="Hint" hint="This is a hint to give more details">
<Radio name="hint" id="hint_1" value="1" label="Option 1" />
<Radio name="hint" id="hint_2" value="2" label="Option 2" />
</RadioButtons>

Dense​

Reduce the font size and radio size for a more compact appearance.

Dense
<RadioButtons id="dense" label="Dense" dense>
<Radio name="dense" id="dense_1" value="1" label="Option 1" />
<Radio name="dense" id="dense_2" value="2" label="Option 2" />
</RadioButtons>

HideLabel​

Hide the label visually while keeping it accessible to screen readers.

Hidden Label
<RadioButtons id="hideLabel" label="Hidden Label" hideLabel>
<Radio name="hideLabel" id="hideLabel_1" value="1" label="Option 1" />
<Radio name="hideLabel" id="hideLabel_2" value="2" label="Option 2" />
</RadioButtons>