sgds-components-radio
SGDS Radio Component Skill
<sgds-radio-group> wraps <sgds-radio> elements as a mutually exclusive selection group. Set a pre-selected value via the group's value attribute. Listen to sgds-change on the group to get the selected value.
Prerequisites
See sgds-components-setup for installation and framework integration (React 19+ vs React ≤18, Vue, Angular).
No CSS styling modifications — custom properties and CSS parts are not exposed on this component.
Quick Decision Guide
Ensure only one option is selected? → Always wrap in <sgds-radio-group>
Pre-select a value? → Set value on <sgds-radio-group> to match a radio's value
Show validation feedback? → Set hasFeedback and invalidFeedback on the group
Disable one option? → Add disabled to the specific <sgds-radio>
<!-- Basic radio group -->
<sgds-radio-group
name="gender"
label="Gender"
hintText="Select one"
>
<sgds-radio value="male">Male</sgds-radio>
<sgds-radio value="female">Female</sgds-radio>
<sgds-radio value="prefer-not-to-say">Prefer not to say</sgds-radio>
</sgds-radio-group>
<!-- Pre-selected value with required validation -->
<sgds-radio-group
name="priority"
label="Priority"
value="medium"
required
hasFeedback
invalidFeedback="Please select a priority level"
>
<sgds-radio value="low">Low</sgds-radio>
<sgds-radio value="medium">Medium</sgds-radio>
<sgds-radio value="high">High</sgds-radio>
<sgds-radio value="critical" disabled>Critical (unavailable)</sgds-radio>
</sgds-radio-group>
<!-- Listen to selection change -->
<sgds-radio-group id="my-radios" name="plan" label="Plan">
<sgds-radio value="basic">Basic</sgds-radio>
<sgds-radio value="pro">Pro</sgds-radio>
<sgds-radio value="enterprise">Enterprise</sgds-radio>
</sgds-radio-group>
<script>
document.getElementById("my-radios").addEventListener("sgds-change", e => {
console.log("Selected:", e.detail.value);
});
</script>
API Summary
<sgds-radio-group>
| Attribute | Type | Default | Purpose |
|---|---|---|---|
name |
string | — | Form field name — shared by all child radios |
label |
string | "" |
Group label |
hintText |
string | "" |
Hint text below the label |
value |
string | "" |
Pre-selected radio value |
required |
boolean | false |
Makes the group required |
hasFeedback |
boolean | false |
Enables validation feedback UI |
invalidFeedback |
string | "" |
Error message when no option is selected |
invalid |
boolean | false |
Manually sets the invalid state |
<sgds-radio>
| Attribute | Type | Default | Purpose |
|---|---|---|---|
value |
string | — | The value submitted when this radio is selected |
checked |
boolean | false |
Pre-checks this radio on render |
disabled |
boolean | false |
Disables this radio option |
invalid |
boolean | false |
Marks this radio as invalid |
Slots
| Component | Slot | Purpose |
|---|---|---|
<sgds-radio-group> |
(default) | <sgds-radio> elements |
<sgds-radio> |
(default) | Radio button label text |
Events
| Component | Event | Detail | When |
|---|---|---|---|
<sgds-radio-group> |
sgds-change |
{ value: string } |
A radio in the group is selected |
<sgds-radio> |
sgds-focus |
— | Radio gains focus |
<sgds-radio> |
sgds-blur |
— | Radio loses focus |
For AI agents:
- Always wrap
<sgds-radio>elements in<sgds-radio-group>— standalone radios are not supported. - Set
nameon the group — it propagates to all child radios. - Listen to
sgds-changeon the group (not on individual radios) to get the selected value viaevent.detail.value. hasFeedbackandinvalidFeedbackare set on the group, not on individual radios.
More from govtechsg/sgds-web-component
sgds-components
Complete reference for all SGDS web components including installation and framework integration. Use when users ask about any <sgds-*> component — accordion, alert, badge, breadcrumb, button, card, checkbox, close-button, combo-box, datepicker, description-list, divider, drawer, dropdown, file-upload, footer, icon, icon-button, icon-card, icon-list, image-card, input, link, mainnav, masthead, modal, overflow-menu, pagination, progress-bar, quantity-toggle, radio, select, sidebar, sidenav, skeleton, spinner, stepper, subnav, switch, system-banner, tab, table, table-of-contents, textarea, thumbnail-card, toast, or tooltip. Also covers React 19+, React ≤18, Vue, Angular, and Next.js integration.
58sgds-theming
Customising the visual theme of an SGDS application — product brand colours, day/night mode, and font. Use when users ask about changing the primary colour, theming their app, enabling dark mode, night mode, overriding CSS tokens, or customising the font. Apply this skill whenever theming, branding, or CSS token overrides are mentioned.
55sgds-workflow
ALWAYS use this skill when building UI with @govtechsg/sgds-web-component or when a user mentions SGDS or Singapore Design System — even if they don't explicitly ask for help. This is the mandatory entry point for all SGDS development: it guides you to the right skill for setup, components, utilities, forms, theming, page layouts, block templates, and data visualisation. Read this before writing any SGDS application code.
53sgds-data-visualisation
Use this skill when users ask about data visualisation, charts, graphs, or dashboards in an SGDS application. Covers ECharts setup and applying the SGDS colour palette to charts.
53sgds-forms
Use this skill when users ask about form validation in SGDS, hasFeedback prop, constraint validation, custom validation, noValidate, setInvalid, form submission, or reading FormData from SGDS form components.
53sgds-getting-started
Starting point for any new application built with the SGDS web component library. Apply this skill first whenever a user is bootstrapping a new SGDS project, setting up a new app, or asking where to begin with SGDS. Covers font setup, foundation CSS, utilities, components, and app layout in the correct order.
53