@vertisanpro/flowbite-react
Version:
Non-Official React components built for Flowbite and Tailwind CSS
14 lines (13 loc) • 1.06 kB
JavaScript
import { twMerge } from '@vertisanpro/tailwind-merge';
import React from 'react';
import { mergeDeep } from '../../helpers/merge-deep';
import { getTheme } from '../../theme-store';
export const ListGroupItem = ({ active: isActive, children, className, href, icon: Icon, onClick, theme: customTheme = {}, disabled, ...props }) => {
const theme = mergeDeep(getTheme().listGroup.item, customTheme);
const isLink = typeof href !== 'undefined';
const Component = isLink ? 'a' : 'button';
return (React.createElement("li", { className: twMerge(theme.base, className) },
React.createElement(Component, { href: href, onClick: onClick, type: isLink ? undefined : 'button', disabled: disabled, className: twMerge(theme.link.active[isActive ? 'on' : 'off'], theme.link.disabled[disabled ? 'on' : 'off'], theme.link.base, theme.link.href[isLink ? 'on' : 'off']), ...props },
Icon && React.createElement(Icon, { "aria-hidden": true, "data-testid": "flowbite-list-group-item-icon", className: theme.link.icon }),
children)));
};