import React from 'react'; import { Box, BoxProps } from '../Box'; type RadioProps = { sx?: BoxProps['sx']; size?: number; checkedIconSize?: number; checked?: boolean; onChange?: ( evt: React.ChangeEvent, checked: boolean, ) => void; }; export const Radio = React.forwardRef( function Radio( { sx, onChange, size: sizeProps, checkedIconSize: checkedIconSizeProps, ...other }, ref, ) { const size = sizeProps ?? 20; const checkedIconSize = checkedIconSizeProps ?? size / 2 + 2; return ( { onChange?.(evt, evt.target.checked); }} sx={{ position: 'absolute', top: 0, left: 0, width: size, height: size, opacity: 0, }} /> {other.checked && ( )} ); }, );