UNPKG

@amsterdam/design-system-react

Version:

All React components from the Amsterdam Design System. Use it to compose pages in your website or application.

11 lines (10 loc) 822 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { CloseIcon } from '@amsterdam/design-system-react-icons'; import { clsx } from 'clsx'; import { forwardRef } from 'react'; import { Icon } from '../Icon'; /** * @see {@link https://designsystem.amsterdam/?path=/docs/components-buttons-icon-button--docs Icon Button docs at Amsterdam Design System} */ export const IconButton = forwardRef(({ className, color, label, size, svg = CloseIcon, type, ...restProps }, ref) => (_jsxs("button", { ...restProps, className: clsx('ams-icon-button', color && `ams-icon-button--${color}`, className), ref: ref, type: type || 'button', children: [_jsx("span", { className: "ams-visually-hidden", children: label }), _jsx(Icon, { size: size, square: true, svg: svg })] }))); IconButton.displayName = 'IconButton';