UNPKG

@amsterdam/design-system-react

Version:

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

15 lines (14 loc) 852 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /** * @license EUPL-1.2+ * Copyright Gemeente Amsterdam */ import { WarningIcon } 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-forms-error-message--docs Error Message docs at Amsterdam Design System} */ export const ErrorMessage = forwardRef(({ children, className, icon, prefix = 'Invoerfout', ...restProps }, ref) => (_jsxs("p", { ...restProps, className: clsx('ams-error-message', className), ref: ref, children: [_jsx(Icon, { size: "small", svg: icon ? icon : WarningIcon }), _jsxs("span", { className: "ams-visually-hidden", children: [prefix, ': '] }), children] }))); ErrorMessage.displayName = 'ErrorMessage';