Mantine theme provides several functions that can be used to simplify writing styles.
All functions available at fn object:
You can use theme functions wherever Mantine theme is available. There are 4 main ways to work with theme:
- createStyles function
All Mantine components have custom focus ring styles which are based on :focus-visible
pseudo-class. It is important to keep styles consistent across all of your application components and you should
include Mantine focus styles to your custom interactive elements.
focusStyles function lets you spread Mantine focus styles
without providing any additional parameters:
fontStyles function you can add font styles from your Mantine theme to any element.
Function returns font-family and font-smoothing styles:
largerThan function can help you write responsive styles with
You can use both functions as a replacement for regular media query syntax in
radialGradient can be used to generate simple gradients with equal colors distributions.
If you need anything more complex – you will need to write it from scratch:
cover function returns styles to fully cover parent element:
darken functions can be used to lighten or darken a color by a given percentage.
Both functions work with hex, rgb and rgba formats and always return color in rgba format:
rgba function converts color to rgba format with given alpha channel: