Skip to main content

Radio Group ready

Radio group allows user to select one option from a set of options. Use value on group to set the selected option.

Examples

Open in new window
<duet-radio-group responsive label="Choose" direction="vertical" value="one" name="group1">
<duet-radio value="one" label="Option one"></duet-radio>
<duet-radio value="two" label="Option two"></duet-radio>
<duet-radio value="three" label="Option three"></duet-radio>
</duet-radio-group>

<script>
// Select the above radio group component
var radioGroup = document.querySelector("duet-radio-group")

// Listen for change events in the radio group
radioGroup.addEventListener("duetChange", function(e) {
console.log("Option changed in radio group:", e.detail)
})
</script>
Open in new window
<duet-radio-group responsive label="Choose" direction="horizontal" value="one" name="group2">
<duet-radio value="one" label="Option one"></duet-radio>
<duet-radio value="two" label="Option two"></duet-radio>
<duet-radio value="three" label="Option three"></duet-radio>
</duet-radio-group>

Properties #

Property Attribute Description Type Default
caption caption Additional caption to show inside the label of the radio group. string ""
direction direction Direction of the radio group. Can be one of: "vertical", "horizontal". string "vertical"
disabled disabled Determines, whether the control is disabled or not. boolean undefined
error error Display radio group in error state along with an error message. string ""
label label Legend displayed for the radio buttons in this group. string "Label"
margin margin Controls the margin of the component. Can be one of: "auto", "none". string "auto"
name name name for the radio buttons within this group. string undefined
responsive responsive Enable or disable the automatic responsive behaviour of the radio group component when horizontal setting is used. Setting this option to "true" makes sure that contents are stacked vertically on mobile. boolean false
theme theme Theme of the radio group. Can be one of: "default", "turva". string ""
tooltip tooltip Tooltip to display next to the label of the radio group. string ""
value value The value of the selected radio button. string undefined

Events #

Event Description Type
duetChange Callback for when the value changed. CustomEvent<any>

Dependencies #

Depends on #

Graph #

graph TD;
duet-radio-group --> duet-tooltip
duet-radio-group --> duet-spacer
duet-radio-group --> duet-paragraph
duet-tooltip --> duet-visually-hidden
style duet-radio-group fill:#f9f,stroke:#333,stroke-width:4px

Integration

For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.



Tutorials

Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:

Tutorials

Building Layouts

Tutorials

Server Side Rendering


Troubleshooting

If you experience any issues while using a component, please head over to the Support page for more guidelines and help.