v6.0.35

ThemeIcon

Render icon inside element with theme colors
Import

Usage

Radius
xs
sm
md
lg
xl
Size
xs
sm
md
lg
xl
Color
Shades
import { ThemeIcon } from '@asuikit/core';
import { IconPhoto } from '@tabler/icons-react';
function Demo() {
return (
<ThemeIcon>
<IconPhoto />
</ThemeIcon>
);
}

Color

ThemeIcon supports all colors from theme.colors, default color is theme.primaryColor:

Gradient variant

To use gradient as ThemeIcon background:

  • set variant to gradient
  • set gradient to { from: 'color-from', to: 'color-to', deg: 135 }, where
    • color-from and color-to are color from theme.colors
    • deg is linear gradient deg
import { IconPhoto } from '@tabler/icons-react';
import { ThemeIcon } from '@asuikit/core';
function Demo() {
return (
<>
<ThemeIcon size="lg" variant="gradient" gradient={{ from: 'indigo', to: 'cyan' }}>
<IconPhoto size="1.2rem" />
</ThemeIcon>
<ThemeIcon size="lg" variant="gradient" gradient={{ from: 'teal', to: 'lime', deg: 105 }}>
<IconPhoto size="1.2rem" />
</ThemeIcon>
<ThemeIcon size="lg" variant="gradient" gradient={{ from: 'teal', to: 'blue', deg: 60 }}>
<IconPhoto size="1.2rem" />
</ThemeIcon>
<ThemeIcon size="lg" variant="gradient" gradient={{ from: 'orange', to: 'red' }}>
<IconPhoto size="1.2rem" />
</ThemeIcon>
<ThemeIcon size="lg" variant="gradient" gradient={{ from: '#ed6ea0', to: '#ec8c69', deg: 35 }}>
<IconPhoto size="1.2rem" />
</ThemeIcon>
</>
);
}

ThemeIcon component props

NameTypeDescription
children *
ReactNode
Icon
color
MantineColor
Icon color from theme
gradient
MantineGradient
Controls gradient settings in gradient variant only
radius
number | "xs" | "sm" | "md" | "lg" | "xl"
Key of theme.radius or any valid CSS value to set border-radius, theme.defaultRadius by default
size
number | "xs" | "sm" | "md" | "lg" | "xl"
Width and height of theme icon
variant
ThemeIconVariant
Controls appearance