ThemeIcon
Render icon inside element with theme colors
Import
Source
Docs
Package
Usage
Gradient variant
When variant
prop is set to gradient
, you can control gradient with gradient
prop, it accepts an object with from
, to
and deg
properties. If thegradient
prop is not set, ThemeIcon
will use theme.defaultGradient
which can be configured on the theme object. gradient
prop is ignored when variant
is not gradient
.
Note that variant="gradient"
supports only linear gradients with two colors. If you need a more complex gradient, then use Styles API to modify ThemeIcon
styles.
Customize variants colors
You can customize colors for ThemeIcon
and other components variants by adding
variantColorResolver to your theme.
autoContrast
ThemeIcon
supports autoContrast
prop and theme.autoContrast. If autoContrast
is set either on ThemeIcon
or on theme, content color will be adjusted to have sufficient contrast with the value specified in color
prop.
Note that autoContrast
feature works only if you use color
prop to change background color. autoContrast
works only with filled
variant.