- Prop
tone- Type
Tone | undefined- Default
- —
- Requirement
- optional
Docs Components Uncategorized
RadioGroup
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Radio, RadioGroup } from "@grassroot/ui-react";const radioGroupFixture = { id: "radio-group", name: "engagement", label: "Engagement", description: "How should we work together?", value: "embedded-team", options: [ { id: "embedded-team", label: "Embedded team", value: "embedded-team" }, { id: "fixed-scope-project", label: "Fixed-scope project", value: "fixed-scope-project" }, { id: "advisory-fractional", label: "Advisory / fractional", value: "advisory-fractional" }, ],} satisfies { id: string; name: string; label: string; description: string; value: string; options: Array<{ id: string; label: string; value: string }>;}; export default function RadioGroupDemo() { return ( <RadioGroup name={`${radioGroupFixture.name}-react`} defaultValue={radioGroupFixture.value} label={radioGroupFixture.label} description={radioGroupFixture.description} > {radioGroupFixture.options.map((option) => ( <Radio key={option.id} value={option.value} label={option.label} /> ))} </RadioGroup> );}- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script setup lang="ts">import { Radio, RadioGroup } from "@grassroot/ui-vue";const radioGroupFixture = { id: "radio-group", name: "engagement", label: "Engagement", description: "How should we work together?", value: "embedded-team", options: [ { id: "embedded-team", label: "Embedded team", value: "embedded-team" }, { id: "fixed-scope-project", label: "Fixed-scope project", value: "fixed-scope-project" }, { id: "advisory-fractional", label: "Advisory / fractional", value: "advisory-fractional" }, ],} satisfies { id: string; name: string; label: string; description: string; value: string; options: Array<{ id: string; label: string; value: string }>;}; </script> <template> <RadioGroup :name="`${radioGroupFixture.name}-vue`" :default-value="radioGroupFixture.value" :label="radioGroupFixture.label" :description="radioGroupFixture.description" @value-change="() => {}" > <Radio v-for="option in radioGroupFixture.options" :key="option.id" :value="option.value" > <template #label>{{ option.label }}</template> </Radio> </RadioGroup></template>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Component } from "@angular/core";const radioGroupFixture = { id: "radio-group", name: "engagement", label: "Engagement", description: "How should we work together?", value: "embedded-team", options: [ { id: "embedded-team", label: "Embedded team", value: "embedded-team" }, { id: "fixed-scope-project", label: "Fixed-scope project", value: "fixed-scope-project" }, { id: "advisory-fractional", label: "Advisory / fractional", value: "advisory-fractional" }, ],} satisfies { id: string; name: string; label: string; description: string; value: string; options: Array<{ id: string; label: string; value: string }>;}; import { GrassrootRadio, GrassrootRadioGroup } from "@grassroot/ui-angular"; @Component({ selector: "app-radio-group-demo", standalone: true, imports: [GrassrootRadioGroup, GrassrootRadio], host: { style: "display: contents" }, template: ` <grassroot-radio-group [name]="name" [defaultValue]="fixture.value" [label]="fixture.label" [description]="fixture.description" > @for (option of fixture.options; track option.id) { <grassroot-radio [value]="option.value" [label]="option.label" /> } </grassroot-radio-group> `,})export class RadioGroupDemoComponent { protected readonly fixture = radioGroupFixture; protected readonly name = `${radioGroupFixture.name}-angular`;} export default RadioGroupDemoComponent;- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script lang="ts"> import { Radio, RadioGroup } from "@grassroot/ui-svelte"; const radioGroupFixture = { id: "radio-group", name: "engagement", label: "Engagement", description: "How should we work together?", value: "embedded-team", options: [ { id: "embedded-team", label: "Embedded team", value: "embedded-team" }, { id: "fixed-scope-project", label: "Fixed-scope project", value: "fixed-scope-project" }, { id: "advisory-fractional", label: "Advisory / fractional", value: "advisory-fractional" }, ], } satisfies { id: string; name: string; label: string; description: string; value: string; options: Array<{ id: string; label: string; value: string }>; }; </script> <RadioGroup name={`${radioGroupFixture.name}-svelte`} defaultValue={radioGroupFixture.value} label={radioGroupFixture.label} description={radioGroupFixture.description}> {#each radioGroupFixture.options as option (option.id)} <Radio value={option.value} label={option.label} /> {/each}</RadioGroup>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
/** @jsxImportSource solid-js */import { Radio, RadioGroup } from "@grassroot/ui-solid";const radioGroupFixture = { id: "radio-group", name: "engagement", label: "Engagement", description: "How should we work together?", value: "embedded-team", options: [ { id: "embedded-team", label: "Embedded team", value: "embedded-team" }, { id: "fixed-scope-project", label: "Fixed-scope project", value: "fixed-scope-project" }, { id: "advisory-fractional", label: "Advisory / fractional", value: "advisory-fractional" }, ],} satisfies { id: string; name: string; label: string; description: string; value: string; options: Array<{ id: string; label: string; value: string }>;}; export default function RadioGroupDemo() { return ( <RadioGroup name={`${radioGroupFixture.name}-solid`} defaultValue={radioGroupFixture.value} label={radioGroupFixture.label} description={radioGroupFixture.description} > {radioGroupFixture.options.map((option) => ( <Radio value={option.value} label={option.label} /> ))} </RadioGroup> );}Installation
API Reference
Import
import { Radio, RadioGroup } from "@grassroot/ui-react";
Props
Prop
Type
Default
Requirement
toneTone | undefined—
optional
onValueChange((detail: RadioGroupChangeDetail) => void) | undefined—
optional
defaultValuestring | undefined—
optional
idstring | undefined—
optional
onChange((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined—
optional
namestring | undefined—
optional
valuestring | undefined—
optional
disabledboolean | undefined—
optional
readOnlyboolean | undefined—
optional
requiredboolean | undefined—
optional
asChildboolean | undefined—
optional
ariaLabelstring | undefined—
optional
- Prop
onValueChange- Type
((detail: RadioGroupChangeDetail) => void) | undefined- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
id- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
onChange- Type
((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined- Default
- —
- Requirement
- optional
- Prop
name- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
value- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
disabled- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
readOnly- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
asChild- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string | undefined- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onValueChange | ((detail: RadioGroupChangeDetail) => void) | undefined |
onChange | ((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined |
Content regions
childrendescriptionlabel
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { Radio, RadioGroup } from "@grassroot/ui-vue";
Props
Prop
Type
Default
Requirement
valuestring | undefined—
optional
defaultValuestring | undefined—
optional
disabledboolean | undefined—
optional
readOnlyboolean | undefined—
optional
namestring | undefined—
optional
requiredboolean | undefined—
optional
idstring | undefined—
optional
ariaLabelstring | undefined—
optional
labelstring | undefined—
optional
descriptionstring | undefined—
optional
tone"accent" | "amber" | "teal" | "indigo" | undefined"accent"optional
- Prop
value- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
disabled- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
readOnly- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
name- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
id- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
label- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
description- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
tone- Type
"accent" | "amber" | "teal" | "indigo" | undefined- Default
"accent"- Requirement
- optional
Events
| Event | Payload |
|---|---|
valueChange | [detail: RadioGroupChangeDetail] |
Content regions
default
Import
import { Component } from "@angular/core";
import { GrassrootRadio, GrassrootRadioGroup } from "@grassroot/ui-angular";
Props
Prop
Type
Default
Requirement
valuestring—
optional
defaultValuestring—
optional
disabledboolean—
optional
readOnlyboolean—
optional
namestring—
optional
requiredboolean—
optional
idstring—
optional
ariaLabelstring—
optional
labelstring—
optional
descriptionstring—
optional
tone"accent" | "amber" | "teal" | "indigo""accent"optional
- Prop
value- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string- Default
- —
- Requirement
- optional
- Prop
disabled- Type
boolean- Default
- —
- Requirement
- optional
- Prop
readOnly- Type
boolean- Default
- —
- Requirement
- optional
- Prop
name- Type
string- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean- Default
- —
- Requirement
- optional
- Prop
id- Type
string- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
label- Type
string- Default
- —
- Requirement
- optional
- Prop
description- Type
string- Default
- —
- Requirement
- optional
- Prop
tone- Type
"accent" | "amber" | "teal" | "indigo"- Default
"accent"- Requirement
- optional
Events
| Event | Payload |
|---|---|
valueChange | RadioGroupChangeDetail |
Content regions
default
Import
import { Radio, RadioGroup } from "@grassroot/ui-svelte";
Props
Prop
Type
Default
Requirement
valuestring—
optional
defaultValuestring—
optional
disabledboolean—
optional
readOnlyboolean—
optional
namestring—
optional
requiredboolean—
optional
idstring—
optional
ariaLabelstring—
optional
toneTone"accent"optional
onValueChange(detail: RadioGroupChangeDetail) => void—
optional
- Prop
value- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string- Default
- —
- Requirement
- optional
- Prop
disabled- Type
boolean- Default
- —
- Requirement
- optional
- Prop
readOnly- Type
boolean- Default
- —
- Requirement
- optional
- Prop
name- Type
string- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean- Default
- —
- Requirement
- optional
- Prop
id- Type
string- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
tone- Type
Tone- Default
"accent"- Requirement
- optional
- Prop
onValueChange- Type
(detail: RadioGroupChangeDetail) => void- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onValueChange | (detail: RadioGroupChangeDetail) => void |
Content regions
childrendescriptionlabel
Import
import { Radio, RadioGroup } from "@grassroot/ui-solid";
Props
Prop
Type
Default
Requirement
valuestring—
optional
defaultValuestring—
optional
disabledboolean—
optional
readOnlyboolean—
optional
namestring—
optional
requiredboolean—
optional
idstring—
optional
ariaLabelstring—
optional
toneTone—
optional
onValueChange(detail: RadioGroupChangeDetail) => void—
optional
- Prop
value- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string- Default
- —
- Requirement
- optional
- Prop
disabled- Type
boolean- Default
- —
- Requirement
- optional
- Prop
readOnly- Type
boolean- Default
- —
- Requirement
- optional
- Prop
name- Type
string- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean- Default
- —
- Requirement
- optional
- Prop
id- Type
string- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
tone- Type
Tone- Default
- —
- Requirement
- optional
- Prop
onValueChange- Type
(detail: RadioGroupChangeDetail) => void- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onValueChange | (detail: RadioGroupChangeDetail) => void |
Content regions
childrendescriptionlabel
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.