How to use the @chakra-ui/hooks.useRadioGroup function in @chakra-ui/hooks

To help you get started, we’ve selected a few @chakra-ui/hooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chakra-ui / chakra-ui / packages / chakra-ui / src / RadioGroup / RadioGroup.tsx View on Github external
(
    {
      variantColor,
      size,
      isInline,
      spacing = 2,
      children,
      ...props
    }: RadioGroupProps,
    ref: React.Ref,
  ) => {
    const rootRef = React.useRef(null);
    const radioGroup = useRadioGroup(props);

    const clones = React.Children.map(children, (child, index) => {
      if (!React.isValidElement(child)) return;

      const isLastRadio = React.Children.count(children) === index + 1;
      const spacingProps = isInline ? { mr: spacing } : { mb: spacing };

      return (
        
          {React.cloneElement(child, {
            size,
            variantColor,
            name: radioGroup.name,