@atlaskit/form
Version:
A form allows people to input information.
22 lines (21 loc) • 713 B
JavaScript
import React from 'react';
import { FieldId } from './field-id-context';
import Message from './message';
/**
* __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);
});
};