diff --git a/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx b/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx index 8cce37a8195..8a9b7a1998f 100644 --- a/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx +++ b/packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButton.tsx @@ -45,7 +45,7 @@ export const RadioButton = React.forwardRef( const styles = getRadioButtonStyles(theme, size, fullWidth); return ( - <> +
( - +
); } ); @@ -77,10 +77,19 @@ const getRadioButtonStyles = stylesFactory((theme: GrafanaTheme2, size: RadioBut const labelHeight = height * theme.spacing.gridSize - 4 - 2; return { + radioOption: css({ + display: 'flex', + justifyContent: 'space-between', + position: 'relative', + flex: fullWidth ? `1 0 0` : 'none', + textAlign: 'center', + }), radio: css({ position: 'absolute', opacity: 0, zIndex: -1000, + width: '100% !important', + height: '100%', '&:checked + label': { color: theme.colors.text.primary, @@ -99,8 +108,6 @@ const getRadioButtonStyles = stylesFactory((theme: GrafanaTheme2, size: RadioBut }, }), radioLabel: css({ - display: 'inline-block', - position: 'relative', fontSize, height: `${labelHeight}px`, // Deduct border from line-height for perfect vertical centering on windows and linux @@ -111,10 +118,9 @@ const getRadioButtonStyles = stylesFactory((theme: GrafanaTheme2, size: RadioBut background: theme.colors.background.primary, cursor: 'pointer', zIndex: 1, - flex: fullWidth ? `1 0 0` : 'none', - textAlign: 'center', userSelect: 'none', whiteSpace: 'nowrap', + flexGrow: 1, '&:hover': { color: textColorHover,