No Preview

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.

RadioGroup

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.

usage
import { RadioGroup, Radio } from "@sharegate/orbit-ui";
sources
Github

Usage

Default

A default radio group.

Editable example

Selected value

A radio group can have a selected value.

Editable example

Disabled

A single radio can be disabled.

Editable example

Or the whole group.

Editable example

Icon

A radio can have icons after his text.

Editable example

Counter

A radio can have a counter after his text.

Editable example

Reverse

A radio button can be to the left or to the right of his label.

Editable example

Or the whole group.

Editable example

Orientation

A radio group can render his elements horizontally.

Editable example

Validation

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.

Editable example

Custom components

Any component implementing the CheckableContext can behave like a radio group. This is usually done by using the useCheckableProps hook.

Editable example

Controlled

A radio group can handle value state in controlled mode.

Editable example

API

RadioGroup

usage
import { RadioGroup } from "@sharegate/orbit-ui";
NameDescriptionDefault
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
eventReact's original event.
valueThe new value.
-
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>
-

Radio

usage
import { Radio } from "@sharegate/orbit-ui";
slots
"label", "icon", "counter"
NameDescriptionDefault
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>
eventReact's original synthetic event.
-
onValueChange
Called when the radio checked state change.
(event: ChangeEvent<HTMLInputElement>, isChecked: boolean) => void
eventReact's original synthetic event.
isCheckedWhether or not the radio is checked.
-
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
-