Radio Group
RadioGroup holds the one value chosen from a set of radios.
Use a RadioGroup around every Radio that answers the same question. The group gives the radios a shared name and holds the one chosen value, which it also sends with a form.
By default the group stacks its radios in a column, with enough space that the pressable area of one never covers the next. To lay them out differently, pass a layout to render, such as render={<Flex gap="5" />} for a row, and your layout replaces the column.
Use defaultValue to let the group keep track of the value, or value and onValueChange to hold it in your own state. Set name to send the value with a form, and required to stop the form from submitting until someone picks an option. disabled disables every Radio in the group.
Screen readers announce the group as a radio group. Give it a name by putting it in a Field with a FieldLabel, or by setting aria-label. The whole group is one tab stop, and the arrow keys move between the radios and check each one they reach.
- Select when there are many options, or there is no room to show them.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
It declares no props of its own. What it takes arrives from a shared type or from the primitive it is built on.
- Visual props — The group draws nothing of its own. It holds the value and stacks the radios, and you can pass any layout to
renderwhen you need a different arrangement. readOnly— HTML has no read-only radio group. To show a value that cannot change, setdisabledand add a description that says why.