Flux uses the excellent Heroicons project for its icon collection. Heroicons is a set of beautiful and functional icons crafted by the fine folks at Tailwind Labs
import { BoltIcon } from '@fluxui-dev/react/icons';<BoltIcon />
There are four variants for each icon: outline (default), solid, mini, and micro.
<BoltIcon /> {/* 24px, outline */}<BoltIcon variant="solid" /> {/* 24px, filled */}<BoltIcon variant="mini" /> {/* 20px, filled */}<BoltIcon variant="micro" /> {/* 16px, filled */}
Control the size (height/width) of an icon using the size-* Tailwind utility.
<BoltIcon className="size-12" /><BoltIcon className="size-10" /><BoltIcon className="size-8" />
You can customize the color of an icon using Tailwind's text color utilities
<BoltIcon variant="solid" className="text-amber-500 dark:text-amber-300" />
Flux has a special loading spinner icon that isn't part of the Heroicons collection. You can use this special icon anywhere you would normally use a standard icon.
import { LoadingIcon } from '@fluxui-dev/react/icons';<LoadingIcon />
If you need to dynamically set an icon, you can use the Icon component and pass in the icon component as a prop.
import { Icon } from '@fluxui-dev/react';<Icon icon={BoltIcon} />
We love Heroicons, but we acknowledge that it's a fairly limited icon set. If you need more icons, we recommend using Lucide instead.
npm install lucide-react
Pass any lucide-react icon to a Flux icon prop or to Icon, and Flux will size it for the variant (24px for outline, 20px for mini, 16px for micro) and adjust its stroke width.
import { Crown, Github, GripVertical } from 'lucide-react';<Icon icon={Crown} /><Icon icon={GripVertical} /><Icon icon={Github} />
For full control over your icons, you can create your own icon components. You can simply render SVG code directly, however we recommend using the following template structure to ensure compatibility with other components:
import type { ComponentPropsWithRef } from 'react';export function WinkIcon({ className, ...props }: ComponentPropsWithRef<'svg'>) { return ( <svg className={`shrink-0 [:where(&)]:size-6 ${className ?? ''}`} data-flux-icon="" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} {...props} > {/* Your SVG paths here */} </svg> );}
<WinkIcon />
All icon components (e.g., BoltIcon, LoadingIcon) share the same props and behavior.
|
Prop
|
Description
|
|---|---|
| variant |
Visual style of the icon. Options: outline (default), solid, mini, micro.
|
| ...props |
Any other SVG prop (such as aria-label or style) and ref are forwarded to the svg element.
|
|
Class
|
Description
|
|---|---|
| size-* |
Control the size of the icon using Tailwind's size utilities (e.g., size-8, size-12).
|
| text-* |
Control the color of the icon using Tailwind's text color utilities (e.g., text-blue-500).
|
|
Attribute
|
Description
|
|---|---|
| data-flux-icon |
Applied to the root SVG element for styling and identification.
|
|
Prop
|
Description
|
|---|---|
| icon |
Icon component to render, such as BoltIcon from @fluxui-dev/react/icons or an icon from lucide-react. Required.
|
| variant |
Visual style and size of the icon; Flux icons render the matching variant, while other icons receive that variant's size. Options: outline, solid, mini, micro. Default: outline.
|
| className |
Additional classes applied to the svg element, such as size or color utilities. Icon accepts no other props.
|
|
Size
|
Description
|
|---|---|
| outline |
24x24 pixels (default)
|
| solid |
24x24 pixels
|
| mini |
20x20 pixels
|
| micro |
16x16 pixels
|