Skip to main content

Radio ready

Radio Buttons are graphical interface elements that allow user to choose only one of a predefined set of mutually exclusive options.

Examples

Open in new window
<duet-radio checked label="Checked" value="test"></duet-radio>

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

// Listen for change events in the radio
radio.addEventListener("duetChange", function(e) {
console.log("Change detected in radio", e.detail)
})
</script>
Open in new window
<duet-radio label="Unchecked"></duet-radio>
Open in new window
<duet-radio checked disabled label="Disabled"></duet-radio>

Properties #

Property Attribute Description Type Default
accessibleActiveDescendant accessible-active-descendant Indicates the id of a related component’s visually focused element. string undefined
accessibleControls accessible-controls Use this prop to add an aria-controls attribute. Use the attribute to indicate the id of a component controlled by this component. string undefined
accessibleIndex accessible-index Control the tabindex of checkbox. In most cases this should never be used! It exists only for Duet’s internal needs. string undefined
accessibleOwns accessible-owns Indicates the id of a component owned by the radio. string undefined
blockEvents block-events Stops the components from emitting events boolean false
checked checked Check state of the radio. boolean undefined
disabled disabled Makes the radio component disabled. This prevents users from being able to interact with the radio, and conveys its inactive state to assistive technologies. boolean false
groupDirection group-direction Determines, whether the control is displayed horizontally or vertically within a group. string undefined
groupDisabled group-disabled Determines, whether the control is disabled from the parent group. boolean undefined
identifier identifier Adds a unique identifier for the radio. string undefined
label label Label for the radio. string "label"
margin margin Controls the margin of the component. Can be one of: "auto", "none". string "auto"
name name Name of the radio. string undefined
role role Defines a specific role attribute for the input. string undefined
theme theme Theme of the radio. Can be one of: "default", "turva". string ""
value value The value of the radio input does not mean if it's checked or not, use the checked property for that. string undefined

Events #

Event Description Type
duetBlur Emitted when the checkbox loses focus. CustomEvent<any>
duetChange Emitted when the checked property has changed. CustomEvent<any>
duetFocus Emitted when the checkbox has focus. CustomEvent<any>

Methods #

setFocus() => Promise<void> #

Sets focus on the specified duet-radio. Use this method instead of the global
input.focus().

Returns #

Type: Promise<void>


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.