7 releases
Uses new Rust 2024
new 0.2.3 | May 11, 2025 |
---|---|
0.2.2 | May 11, 2025 |
0.1.2 | May 11, 2025 |
#461 in Images
106 downloads per month
120KB
64 lines
dioxus-feather-icons
Feather Icons for Dioxus — Inline SVG icons packaged for seamless use in Dioxus apps. This crate provides ergonomic macros to embed Feather Icons in your UI with no runtime cost.
🖤 Features
- Render Feather Icons as inline SVG
- Build-time icon name validation
- Lightweight and dependency-free
- Simple macro-based usage with
rsx!
- Optimized for performance via SVG sprite injection
📦 Installation
Add to your Cargo.toml
:
[dependencies]
dioxus-feather-icons = "0.2.2"
This crate requires Rust 2024 edition.
⸻
🗂️ Icons Included
The crate includes a curated set of Feather .svg files and a bundled _sprite.svg
. You do not need to download or manage the icons yourself.
⸻
🚀 Usage
1. Add the Sprite
To make icons render, you must inject the sprite once in your component tree, ideally toward the end of the body to avoid blocking first paint:
rsx! {
// ...
{ dioxus_feather_icons::sprite!() }
}
Avoid injecting it into <head>
— inline SVGs are render-blocking when placed early.
⸻
2. Render an Icon
Use the icon!
macro to render a Feather icon inline. It supports progressively more customization:
✅ Basic usage (inherits text color, 24px size by default):
use dioxus::prelude::*;
use dioxus_feather_icons::prelude::*;
fn App() -> Element {
rsx! {
{ icon!(activity) }
}
}
🎨 Set a specific size:
icon!(alert_circle, 48)
📐 Customize size and color:
icon!(camera, 32, "#333")
3. Access Raw SVG String (if needed)
let svg: &str = icon_str!(zap);
⸻
📁 Links
📦 Crate: https://crates.io/crates/dioxus-feather-icons
🛠️ Repo: https://github.com/dsplce-co/dioxus-feather-icons
⸻
🔒 License
MIT or Apache-2.0, at your option.
⸻