UNPKG

@amsterdam/design-system-react

Version:

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

18 lines (17 loc) 654 B
import { jsxs as _jsxs } from "react/jsx-runtime"; import { clsx } from 'clsx'; import { forwardRef } from 'react'; const getHintText = ({ hint, optional }) => { if (hint) { return hint; } else if (optional) { return 'niet verplicht'; } return null; }; export const Hint = forwardRef(({ className, hint, inFieldSet, optional, ...restProps }, ref) => { const hintText = getHintText({ hint, optional }); return (hintText && (_jsxs("span", { ...restProps, className: clsx('ams-hint', inFieldSet && 'ams-hint--in-fieldset', className), ref: ref, children: ["(", hintText, ")"] }))); }); Hint.displayName = 'Hint';