Skip to content

Commit c537af2

Browse files
fix: [M3-7565] - Fix Radio size prop not affecting the radio button's dimensions (linode#11242)
* Customizing radio button sizes * Added a sample * Reverted sample * Updated sizes for medium and small radio buttons * Added changeset * Wrapped radio icons in SvgIcon & added font sizes to themes/light.ts * fixes * linting fix
1 parent 6be3f6b commit c537af2

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Fixed
3+
---
4+
5+
Radio size prop not affecting the radio button's dimensions ([#11242](https://github.com/linode/manager/pull/11242))

packages/ui/src/components/Radio/Radio.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { SvgIcon } from '@mui/material';
12
import { default as _Radio } from '@mui/material/Radio';
23
import * as React from 'react';
34

@@ -26,9 +27,21 @@ import type { RadioProps } from '@mui/material/Radio';
2627
export const Radio = (props: RadioProps) => {
2728
return (
2829
<_Radio
29-
checkedIcon={<RadioIconRadioed />}
30+
checkedIcon={
31+
<SvgIcon
32+
component={RadioIconRadioed}
33+
fontSize={props.size}
34+
viewBox="0 0 25 25"
35+
/>
36+
}
37+
icon={
38+
<SvgIcon
39+
component={RadioIcon}
40+
fontSize={props.size}
41+
viewBox="0 0 25 25"
42+
/>
43+
}
3044
data-qa-radio={props.checked || false}
31-
icon={<RadioIcon />}
3245
{...props}
3346
inputProps={{
3447
'aria-checked': props.checked,

packages/ui/src/foundations/themes/light.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,16 @@ export const lightTheme: ThemeOptions = {
10941094
fill: `${Color.Neutrals[5]} !important`,
10951095
pointerEvents: 'none',
10961096
},
1097+
'&.MuiRadio-root': {
1098+
'.MuiSvgIcon-fontSizeMedium': {
1099+
fontSize: '20px',
1100+
},
1101+
},
1102+
'&.MuiRadio-sizeSmall': {
1103+
'.MuiSvgIcon-fontSizeSmall': {
1104+
fontSize: '16px',
1105+
},
1106+
},
10971107
'&:hover': {
10981108
'& .defaultFill': {
10991109
fill: theme.color.white,

0 commit comments

Comments
 (0)