Icon
Renders an icon from a collection.
Usage
Code
import { createSystem } from 'frog/ui'
const { Icon } = createSystem()
function Example() {
return <Icon name="zap" />
}
Icon
Properties
color
Sets the color of the icon. Defaults to 'currentColor'
or the color of the icon (when mode
is set to 'bg'
).
Code
<Icon
color="backgroundbackground100background200inverttexttext100text200text300text400gray100gray200gray300gray400gray500gray600graygray700gray800gray900gray1000blue100blue200blue300blue400blue500blue600blueblue700blue800blue900blue1000red100red200red300red400red500red600redred700red800red900red1000amber100amber200amber300amber400amber500amber600amberamber700amber800amber900amber1000green100green200green300green400green500green600greengreen700green800green900green1000teal100teal200teal300teal400teal500teal600tealteal700teal800teal900teal1000purple100purple200purple300purple400purple500purple600purplepurple700purple800purple900purple1000pink100pink200pink300pink400pink500pink600pinkpink700pink800pink900pink1000green800"
name="zap"
/>
mode
Sets rendering mode of the icon. Defaults to 'auto'
.
Code
<Icon
name="zap"
mode?: "auto" | "bg" | "mask" | undefinedSets rendering mode of the icon.
mode="auto"
/>
collection
Icon collection to use for resolving icons. Defaults to lucide
imported from 'frog/ui/icons'
.
The following collections are available:
- Heroicons -
frog/ui/icons/heroicons
- Lucide -
frog/ui/icons/lucide
- Radix Icons -
frog/ui/icons/radix-icons
Collection is mapped to the icons
property on the UI System Variables.
Code
<Icon
name="bolt"
collection?: Record<string, string> | {
"academic-cap": string;
"academic-cap-16-solid": string;
"academic-cap-20-solid": string;
"academic-cap-solid": string;
"adjustments-horizontal": string;
... 1179 more ...;
"x-mark-solid": string;
} | undefinedIcon collection to use for resolving icons.
collection={heroicons}
/>
name
Icon name in the current icon collection.
Code
<Icon
name: "text" | "a-arrow-down" | "a-arrow-up" | "a-large-small" | "accessibility" | "activity" | "air-vent" | "airplay" | "alarm-clock" | "alarm-clock-check" | "alarm-clock-minus" | ... 1436 more ... | "zoom-out"Icon name in the current icon collection.
name="bell"
/>
size
Sets the size of the icon.
Code
<Icon
name="bell"
size="100%012346810121416182022242628303234363840424446485256606472809612816019222425648"
/>