Displays a validity message for a form control, with an icon matching the validity state: invalid, valid, or validating (a spinner while an async check is pending).
ControlWithError renders it automatically; use it directly to give a
custom validated control the same presentation.
import { ValidityIndicator } from '@wordpress/ui';
LinksPermalink to this section
PropsPermalink to this section
| Name | Default | Description |
|---|---|---|
id |
The | |
type Required |
The validation status to indicate. | |
message |
The message to display next to the status icon. |
ExamplesPermalink to this section
InvalidPermalink to this section
const Invalid = () => <ValidityIndicator type="invalid" message="Please enter a valid URL." />;
ValidPermalink to this section
const Valid = () => <ValidityIndicator type="valid" message="This URL is available." />;
ValidatingPermalink to this section
const Validating = () => <ValidityIndicator type="validating" message="Checking availability…" />;