Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
A radio group is a set of checkable buttons, known as radio buttons, where no more than one of the buttons can be checked at a time.
import { RadioGroup, Radio } from "@sharegate/orbit-ui";
A default radio group.
A radio group can have a selected value.
A single radio can be disabled.
Or the whole group.
A radio can have icons after his text.
A radio can have a counter after his text.
A radio button can be to the left or to the right of his label.
Or the whole group.
A radio group can render his elements horizontally.
A radio group can display a validation state to communicate to the user whether the current value is valid or invalid. Implement your own validation logic in your app and pass either "valid"
or "invalid"
to the input via the validationState
prop.
The example below illustrates how one would validate if a specific value of the radio group has been selected.
Any component implementing the CheckableContext
can behave like a radio group. This is usually done by using the useCheckableProps
hook.
A radio group can handle value
state in controlled mode.
import { RadioGroup } from "@sharegate/orbit-ui";
Name | Description | Default | ||||
---|---|---|---|---|---|---|
align | The alignment of the elements. "center" | "end" | "start" | ResponsiveValue<FlexAlignment> | - | ||||
autoFocus | Whether or not the first input of the group should autoFocus on render. numberfalsetrue | - | ||||
disabled | Whether or not the inputs of the group are disabled. falsetrue | - | ||||
fluid | Whether the elements take up the width & height of their container. false | true | ResponsiveValue<boolean> | - | ||||
inline | Whether or not the element generate line breaks before or after himself. falsetrue | - | ||||
name | Radio group name. string | - | ||||
onChange | Called when an input of the group change. (event: SyntheticEvent<Element, Event>, value: string) => void
| - | ||||
orientation | The orientation of the elements. "horizontal" | "vertical" | ResponsiveValue<FlexOrientation> | - | ||||
required | Whether a user input is required before form submission. falsetrue | - | ||||
reverse | Whether or not to reverse the order of the elements. falsetrue | - | ||||
validationState | Whether the group should display as "valid" or "invalid". "valid""invalid" | - | ||||
value | The value of the group. string | - | ||||
wrap | Whether elements are forced onto one line or can wrap onto multiple rows. false | true | ResponsiveValue<boolean> | - |
import { Radio } from "@sharegate/orbit-ui";
"label", "icon", "counter"
Name | Description | Default | ||||
---|---|---|---|---|---|---|
autoFocus | Whether or not the input should autoFocus on render. numberfalsetrue | - | ||||
checked | A controlled checked state value. falsetrue | - | ||||
children* | React children. string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal | - | ||||
defaultChecked | The initial value of checked when uncontrolled.falsetrue | - | ||||
onChange | Called when the radio checked state change. ChangeEventHandler<Element>
| - | ||||
onValueChange | Called when the radio checked state change. (event: ChangeEvent<HTMLInputElement>, isChecked: boolean) => void
| - | ||||
required | Whether or not a user input is required before form submission. falsetrue | - | ||||
reverse | Invert the order of the checkmark box and the label. falsetrue | - | ||||
validationState | Whether or not the input should display as "valid" or "invalid". "valid""invalid" | - | ||||
value | The value to associate with when in a group. string | - |