@amsterdam/design-system-react
Version:
All React components from the Amsterdam Design System. Use it to compose pages in your website or application.
13 lines (12 loc) • 819 B
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { clsx } from 'clsx';
import { forwardRef } from 'react';
import { Hint } from '../Hint';
/**
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-label--docs Label docs at Amsterdam Design System}
*/
export const Label = forwardRef(({ children, className, hint, inFieldSet, isPageHeading, optional, ...restProps }, ref) => {
const labelElement = (_jsxs("label", { ...restProps, className: clsx('ams-label', inFieldSet && 'ams-label--in-fieldset', className), ref: ref, children: [children, " ", _jsx(Hint, { hint: hint, inFieldSet: inFieldSet, optional: optional })] }));
return isPageHeading ? _jsx("h1", { className: "ams-label__heading", children: labelElement }) : labelElement;
});
Label.displayName = 'Label';