import React, { type PropsWithChildren } from "react"; import { twMerge } from "tailwind-merge"; import { ButtonClasses, type TWUIButtonColorType, type TWUIButtonVariantType, } from "../layout/Button"; export type TWUI_TOGGLE_PROPS = PropsWithChildren & React.DetailedHTMLProps< React.HTMLAttributes, HTMLDivElement > & { color?: TWUIButtonColorType; variant?: TWUIButtonVariantType; href?: string; newTab?: boolean; linkProps?: React.DetailedHTMLProps< React.AnchorHTMLAttributes, HTMLAnchorElement >; }; /** * # Tabs Component * @className twui-tag * @className twui-tag-primary-outlined */ export default function Tag({ color, variant, children, href, newTab, linkProps, ...props }: TWUI_TOGGLE_PROPS) { const finalClassName = ButtonClasses[variant || "normal"]?.[color || "primary"] ?? ""; const mainComponent = (
{children}
); if (href) { return ( {mainComponent} ); } return mainComponent; }