Tonic UI
Getting StartedColor ModeColor StyleVersionsContributing
THEME
BordersBreakpointsColorsOutlinesPositionsSpacingSizesShadowsTypography
BUILDING BLOCKS
BoxControlBox
UTILITIES

Icon

Icon is used to render SVG icons in a more convenient way. You can extend icons by defining icon keys in theme.icons.

Import

Usage

Use an icon by passing the icon prop. This icon property value must match an icon key defined in theme.icons. By default, the icon inherits the font size and color of its parent.

EDITABLE EXAMPLE

Animating icons

Use the spin prop to get any icon to rotate either in the clockwise (CW) or counterclockwise (CCW) direction.

EDITABLE EXAMPLE

The animation prop can be used to override default animation, it is a shorthand property for:

• animationName
• animationDuration
• animationTimingFunction
• animationDelay
• animationIterationCount
• animationDirection
• animationFillMode
• animationPlayState

Adding custom icons

First, you have to add custom icons to the theme. Each icon must be an object containing path and optional style props passed to SVGIcon.

After that simply wrap your app into ThemeProvider component and pass your theme as a theme prop. Just like this:

Pass the icon name as a prop to the <Icon> component to render the SVG icon:

Search icons

EDITABLE EXAMPLE

Props

NameTypeDefaultDescription
iconstringThe name of the icon.
spinboolean | stringfalseIf true or 'cw', it will rotate in the clockwise direction. If 'ccw', it will rotate in the counterclockwise direction. Otherwise, no rotation occurs.