import { Children, ReactNode } from 'react';
import Box from './Box';
import Flex from './Flex';
import useExperimentalTheme from './utils/useExperimentalTheme';
type Props = {
/**
* One or more Buttons and/or IconButtons.
*/
children?: ReactNode;
};
/**
* [ButtonGroup](https://gestalt.pinterest.systems/web/buttongroup) is used to display a series of buttons.
*
* 
* 
*
*/
function ButtonGroup({ children }: Props) {
const theme = useExperimentalTheme();
if (Children.count(children) === 0) {
return null;
}
if (theme.MAIN) {
return (
{children}
);
}
return (
{Children.map(children, (child) =>
child !== null && child !== undefined ? {child} : null,
)}
);
}
ButtonGroup.displayName = 'ButtonGroup';
export default ButtonGroup;