Heroicons for Rust
A Rust crate providing access to the beautiful hand-crafted SVG icons from Heroicons, created by the makers of Tailwind CSS.
This crate offers Heroicons through a structured Icon system:
- Icon struct - Represent icons with
IconNameandVariant - String conversion - Convert icons to SVG strings using
to_string() - Hypertext components - Ready-to-use components for the
hypertextframework
Icon Variants
All icons are available in multiple variants:
- Outline (24×24px) - Outlined icons with 2px stroke
- Solid (24×24px) - Filled icons
- Mini (20×20px) - Smaller solid icons
- Micro (16×16px) - Tiny solid icons
Usage
Icon Struct
use ;
// Create icons with different variants
let home_icon = Icon ;
let user_icon = Icon ;
// Convert to SVG string
let svg_string = home_icon.to_string;
// Use the SVG string in HTML templates, web frameworks, etc.
Hypertext Components
The hypertext feature is enabled by default. Use the <Icon> component with the rsx! macro:
use ;
use *;
let page = rsx! .render;
Or with the maud! macro:
use ;
use *;
let page = maud! .render;
Features
- Default: Includes
hypertextfeature for component support hypertext: Adds component functions in thehypertextmodulesimd: Enables SIMD optimizations for HTML parsing