Icon component to render a visual icon within other components. It can generally be used inside most components, excluding ones that don’t support child components (e.g., the Input component does not support icons).
Always pair icons with text. If that’s not possible, include the screenReaderText prop to convey the icon’s meaning for users with screen readers.
Props
| Prop | Type | Description |
|---|---|---|
name Required | String | Sets the icon to display. See all available icons. |
color | 'inherit' (default) | 'alert' | 'warning' | 'success' | The color of the icon. See the colors section for details. |
screenReaderText | String | Sets the text that screen readers will read for the icon. |
size | 'small' | 'medium' | 'large' | By default, the size of the icon is set automatically based on the parent component. If you need to override the default size, you can specify one to use instead. |
Colors
Using thecolor prop, you can set an icon to one of the following colors:
Default
color="inherit"Alert
color="alert"Warning
color="warning"Success
color="success"Spacing
By default, spacing is not added around the icon. However, To add a space between the icon and adjacent text, you can manually add a space with the space bar, or by using and {" "} as shown below.
Available icons
Below are the currently available icons and theirname values, which you can copy by clicking the icon.