Icons libraries with Mantine
You can use any icons library with Mantine components, most popular options are:
Tabler icons
Tabler icons are used in Mantine demos, documentation
and some @mantine/
packages depend on them. If you do not know which icons library
to use, we recommend Tabler icons.
Icons size
Most of the icons libraries support size
prop (or similar width
and height
props) which allows changing
icon width and height. Usually, it is a number in pixels. All Mantine components use rem
units – components are scaled based on user preferences and font-size
of the root element. If you want to
support this feature in your application, set icon width and height in rem units with style
prop.
rem units in size prop
Icons
size
prop is usually converted towidth
andheight
props under the hood. If you setsize={16}
it will be converted towidth="16"
andheight="16"
attributes on svg element.You can use rem units in
size
prop:size="1rem"
will be converted towidth="1rem"
andheight="1rem"
, but it is not recommended as it is prohibited by SVG standard – some browsers (Firefox) will show a warning in the console.
Custom icons
It is recommended to use icons as React components. In this case, you will be able to use
currentColor
in the fill
and stroke
prop. This will change icon color based on the context
it is used in.