UNPKG

hoda-react

Version:

<div align="center"> <h1>:construction: flowbite-react (unreleased) :construction:</h1> <p> <a href="https://flowbite-react.com"> <img alt="Flowbite - Tailwind CSS components" width="350" src=".github/assets/flowbite-react-github.png"> <

16 lines (15 loc) 773 B
import { jsx as _jsx } from "react/jsx-runtime"; import classNames from 'classnames'; import { Children, cloneElement, useMemo } from 'react'; import { useTheme } from '../Flowbite/ThemeContext'; const ButtonGroup = ({ children, outline, pill, className, ...props }) => { const items = useMemo(() => Children.map(children, (child, index) => cloneElement(child, { outline, pill, positionInGroup: index === 0 ? 'start' : index === children.length - 1 ? 'end' : 'middle', })), [children, outline, pill]); const theme = useTheme().theme.buttonGroup; return (_jsx("div", { className: classNames(theme.base, className), role: "group", ...props, children: items })); }; ButtonGroup.displayName = 'Button.Group'; export default ButtonGroup;