UNPKG

mt-flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

11 lines (10 loc) 953 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { twMerge } from 'tailwind-merge'; import { useTheme } from '../../'; import { mergeDeep } from '../../helpers/merge-deep'; export const ListGroupItem = ({ active: isActive, children, className, href, icon: Icon, onClick, theme: customTheme = {}, ...props }) => { const theme = mergeDeep(useTheme().theme.listGroup.item, customTheme); const isLink = typeof href !== 'undefined'; const Component = isLink ? 'a' : 'button'; return (_jsx("li", { className: twMerge(theme.base, className), children: _jsxs(Component, { href: href, onClick: onClick, type: isLink ? undefined : 'button', className: twMerge(theme.link.active[isActive ? 'on' : 'off'], theme.link.base, theme.link.href[isLink ? 'on' : 'off']), ...props, children: [Icon && _jsx(Icon, { "aria-hidden": true, "data-testid": "flowbite-list-group-item-icon", className: theme.link.icon }), children] }) })); };