dioxus-feather-icons

Crates.iodioxus-feather-icons
lib.rsdioxus-feather-icons
version0.2.3
created_at2025-05-10 17:59:02.016285+00
updated_at2025-05-11 15:40:18.154243+00
descriptionFeather Icons for Dioxus
homepage
repositoryhttps://github.com/dsplce-co/dioxus-feather-icons
max_upload_size
id1668656
size122,126
publish (github:dsplce-co:publish)

documentation

README

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.3"

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.

βΈ»

Commit count: 10

cargo fmt