@atlaskit/form
Version:
A form allows people to input information.
21 lines (20 loc) • 684 B
JavaScript
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 const ErrorMessage = ({
children,
testId
}) => /*#__PURE__*/React.createElement(FieldId.Consumer, null, fieldId => /*#__PURE__*/React.createElement(Message, {
appearance: "error",
fieldId: fieldId ? `${fieldId}-error` : undefined,
testId: testId
}, children));
messageMotion.mark(ErrorMessage);