UNPKG

@amsterdam/design-system-react

Version:

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

14 lines (13 loc) 997 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /** * @license EUPL-1.2+ * Copyright Gemeente Amsterdam */ import clsx from 'clsx'; import { forwardRef } from 'react'; import { Icon } from '../Icon'; /** * @see {@link https://designsystem.amsterdam/?path=/docs/components-buttons-button--docs Button docs at Amsterdam Design System} */ export const Button = forwardRef(({ children, className, disabled, icon, iconBefore, iconOnly, type, variant = 'primary', ...restProps }, ref) => (_jsxs("button", { ...restProps, className: clsx('ams-button', `ams-button--${variant}`, icon && iconOnly && `ams-button--icon-only`, className), disabled: disabled, ref: ref, type: type || 'button', children: [icon && (iconBefore || iconOnly) && _jsx(Icon, { square: iconOnly, svg: icon }), icon && iconOnly ? _jsx("span", { className: "ams-visually-hidden", children: children }) : children, icon && !iconBefore && !iconOnly && _jsx(Icon, { svg: icon })] }))); Button.displayName = 'Button';