React
Composition
Explains how to use icons.
Overview
Karrot icon library is designed to be independent (agnostic) of the design system and does not include Crispy's opinions. Sometimes you need to use icon composition patterns while using custom icons that are not in the library.
For this purpose, we provide utility components that accept icons through the svg attribute and connect them to the design system:
Icon: Use when using icons independently or in components that display icons only.PrefixIcon,SuffixIcon: Use when placing icons and text together within a component.
Icon Component
The Icon component is used when using icons independently or in components that display icons only.
PrefixIcon and SuffixIcon
When placing icons and text together within a component, place PrefixIcon and SuffixIcon components as children.
This pattern is used consistently in the following components:
ActionButton: Icon placement within a buttonButton: Icon placement within a regular buttonToggleButton: Icon placement within a toggle buttonActionChip: Icon placement within an action chipControlChip: Icon placement within a control chip