@atlaskit/form
Version:
A form allows people to input information.
19 lines (18 loc) • 593 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 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));