Skip to content

Commit eff9658

Browse files
committed
fix(Radio): size prop
1 parent 90e9750 commit eff9658

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/components/fields/RadioGroup/Radio.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export interface CubeRadioProps
129129
/* Whether the radio is invalid */
130130
isInvalid?: boolean;
131131
/* Size of the button (for button type only) */
132-
size?: CubeItemBaseProps['size'];
132+
size?: Omit<CubeItemBaseProps['size'], 'inline'>;
133133
/* Icon to display (for button type only) */
134134
icon?: CubeItemBaseProps['icon'];
135135
/* Icon to display on the right (for button type only) */
@@ -196,7 +196,8 @@ function Radio(props: CubeRadioProps, ref) {
196196
let isButton = effectiveType === 'button' || effectiveType === 'tabs';
197197

198198
// Determine effective size with priority: prop > context > default
199-
let effectiveSize = size ?? contextSize ?? 'medium';
199+
let effectiveSize =
200+
size ?? contextSize ?? (effectiveType === 'tabs' ? 'small' : 'medium');
200201

201202
// Apply size mapping for tabs mode button radios
202203
if (effectiveType === 'tabs' && isButton) {
@@ -206,10 +207,8 @@ function Radio(props: CubeRadioProps, ref) {
206207
effectiveSize = 'medium';
207208
} else if (effectiveSize === 'xlarge') {
208209
effectiveSize = 'large';
209-
} else if (!size && !contextSize) {
210-
effectiveSize = 'xsmall';
211210
}
212-
// 'xsmall' stays 'xsmall', 'inline' stays 'inline'
211+
// 'xsmall' stays 'xsmall'
213212
}
214213

215214
// Determine effective button type

src/components/fields/RadioGroup/RadioGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export interface CubeRadioGroupProps
4444
/* Whether the radio group is invalid */
4545
isInvalid?: boolean;
4646
/* Size for all radio buttons in the group */
47-
size?: CubeItemBaseProps['size'];
47+
size?: Omit<CubeItemBaseProps['size'], 'inline'>;
4848
/* Button type for all button-style radios (ignored in tabs mode). When set to 'primary', selected buttons use 'primary' and non-selected use 'secondary' */
4949
buttonType?: Exclude<CubeItemBaseProps['type'], 'secondary'>;
5050
/* Visual type for all radios in the group: radio (default), button, or tabs */

0 commit comments

Comments
 (0)