UNPKG

@atlaskit/form

Version:

A form allows people to input information.

24 lines (23 loc) • 804 B
import React from 'react'; import { FieldId } from './field-id-context'; import Message from './message'; import messageMotion from './message-motion-capability'; /** * __Error message__ * * An error message is used to tell a user that the field input is invalid. For example, an error message could be * 'Invalid username, needs to be more than 4 characters'. * */ export var ErrorMessage = function ErrorMessage(_ref) { var children = _ref.children, testId = _ref.testId; return /*#__PURE__*/React.createElement(FieldId.Consumer, null, function (fieldId) { return /*#__PURE__*/React.createElement(Message, { appearance: "error", fieldId: fieldId ? "".concat(fieldId, "-error") : undefined, testId: testId }, children); }); }; messageMotion.mark(ErrorMessage);