Status message
Component to display icon and text below the form field.
import * as React from 'react';
import { StatusMessage } from '@itwin/itwinui-react';
import { SvgPlaceholder } from '@itwin/itwinui-icons-react';
export default () => {
return <StatusMessage startIcon={<SvgPlaceholder />}>Message</StatusMessage>;
};
The StatusMessage component can be used with form fields, such as inputs, selects, etc.
You can pass StatusMessage to any component that has message prop to fully customize rendered message.
Status
Use status prop to set proper color to the message and its icon.
import * as React from 'react';
import { StatusMessage } from '@itwin/itwinui-react';
import { SvgPlaceholder } from '@itwin/itwinui-icons-react';
export default () => {
return (
<div className='demo-container'>
<StatusMessage startIcon={<SvgPlaceholder />} status='positive'>
Positive message
</StatusMessage>
<StatusMessage startIcon={<SvgPlaceholder />} status='warning'>
Warning message
</StatusMessage>
<StatusMessage startIcon={<SvgPlaceholder />} status='negative'>
Negative message
</StatusMessage>
</div>
);
};
Props
| Prop | Description | Default |
|---|---|---|
| startIcon | Custom icon to be displayed at the beginning.
Element | |
| children | Message content. ReactNode | |
| status | Status of the message. "positive" | "warning" | "negative" | |
| iconProps | Passes props to icon Omit<DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "as" | "key" | "fill" | "size" | keyof HTMLAttributes<...> | "padded"> & { ...; } & Omit<...> & { ...; } | |
| contentProps | Passes props to content DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> | |
| as | "symbol" | "object" | "div" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | ... 159 more ... | FunctionComponent<...> |