UNPKG

@pagamio/frontend-commons-lib

Version:

Pagamio library for Frontend reusable components like the form engine and table container

11 lines (10 loc) 720 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import * as React from 'react'; import { cn } from '../../helpers'; import Button from './Button'; /* eslint-disable @typescript-eslint/naming-convention */ const IconButton = React.forwardRef(({ icon: Icon, label, size = 'default', variant = 'primary', className, children, ...props }, ref) => { return (_jsxs(Button, { variant: variant, ref: ref, "aria-label": label, size: size, className: cn('flex flex-row flex-nowrap text-nowrap items-center', className), ...props, children: [_jsx(Icon, { size: 20, "aria-hidden": "true", className: children ? 'mr-2' : '' }), children] })); }); IconButton.displayName = 'IconButton'; export default IconButton;