@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) • 770 B
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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 = WarningIcon, prefix = 'Invoerfout', ...restProps }, ref) => (_jsxs("p", { ...restProps, className: clsx('ams-error-message', className), ref: ref, children: [_jsx(Icon, { svg: icon }), _jsx("span", { className: "ams-visually-hidden", children: `${prefix}: ` }), children] })));
ErrorMessage.displayName = 'ErrorMessage';