Import
Description
TheHugeIcon component provides access to icons from the @hugeicons/react library. It supports icon switching for interactive states and customizable stroke properties.
Library
- Package:
@hugeicons/[email protected] - Icons:
@hugeicons/[email protected] - Tag:
HugeiconsIcon
Usage
Props
The main icon to display. This should be the icon name from the Hugeicons library.When passed as a string, the component automatically imports the icon from
@hugeicons/[email protected].Alternative icon for states or interactions. Like
icon, this automatically imports from the Hugeicons library when provided as a string.Use with show_alt to toggle between the main and alternative icons.Whether to show the alternative icon instead of the main icon.This is typically bound to a state variable to toggle between icons based on user interaction.
The size of the icon in pixels. Controls both width and height.
The stroke width of the icon paths. This affects the thickness of the icon lines.Note: This prop is applied via Tailwind CSS class
[&_path]:stroke-[{value}].Special Behavior
create() Method
TheHugeIcon.create() method (also available as hi() and icon()) accepts the icon name as the first positional argument:
Automatic Icon Imports
Whenicon or alt_icon props are provided as strings, the component automatically:
- Creates a
Varwith the icon name - Adds the necessary import from
@hugeicons/[email protected] - Makes the icon available to the frontend
Icon Names
Icon names follow the Hugeicons naming convention. Browse available icons at: Icon names typically use PascalCase with a number suffix (e.g.,Home01Icon, User02Icon, Settings03Icon).