Skip to content

Commit 30a1851

Browse files
authored
Vanilla Radio/Checkbox: add option for layout
Allows to configure the previously hard coded flex direction of the 'RadioGroup' React Vanilla renderer via the new UI Schema option 'orientation: "horizontal" | "vertical"'.
1 parent b4166e5 commit 30a1851

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/examples/src/examples/radioGroup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ const schema = {
5555
type: 'Control',
5656
scope: '#/properties/exampleRadioEnum',
5757
options: {
58-
format: 'radio'
58+
format: 'radio',
59+
orientation: 'vertical'
5960
}
6061
}
6162
]

packages/vanilla-renderers/src/controls/RadioGroup.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const RadioGroup = ({
7373
if (hasRadioClass) {
7474
groupStyle = {
7575
display: 'flex',
76-
flexDirection: 'row'
76+
flexDirection: ('vertical' === appliedUiSchemaOptions.orientation) ? 'column' : 'row'
7777
};
7878
}
7979
return (
@@ -90,7 +90,6 @@ export const RadioGroup = ({
9090
appliedUiSchemaOptions.hideRequiredAsterisk
9191
)}
9292
</label>
93-
9493
<div className={radioControl} style={groupStyle}>
9594
{options.map(option => (
9695
<div key={option.label} className={radioOption}>

0 commit comments

Comments
 (0)