Components
Code examples
<RadioGroup> <Radio value="bus">Buss</Radio> <Radio value="train">Tog</Radio> <Radio value="plane">Fly</Radio> </RadioGroup>
Guidelines
Radio buttons should be used if you have between 2 and 5 options. If there are more than 5 options, you should instead use a NativeSelect or InfoSelect.
You may also consider using choice chips if they fit better with the design you are creating.
Remember to include RadioCardGroup as a wrapper around your buttons.
Code
<Radio />
import { Radio } from "@vygruppen/spor-react";
A radio button
Props
Name | Type | Required? | Description |
|---|---|---|---|
value | string | The value returned when selected | |
children | React.ReactNode | The label of the radio button | |
disabled | boolean | ||
inputProps | React.InputHTMLAttributes<HTMLInputElement> | Targets the input |
<RadioGroup />
import { RadioGroup } from "@vygruppen/spor-react";
Groups several Radio components
Props
Name | Type | Required? | Description |
|---|---|---|---|
name | string | The name of the choice | |
onValueChange | (details: ValueChangeDetails) => void | Callback for when the choice changes | |
orientation | "horizontal" | "vertical" | Defaults to "horizontal" | |
defaultValue | string |