Use free svg icons in your Dioxus projects easily with dioxus-free-icons.

Overview

dioxus-free-icons

Use free svg icons in your Dioxus projects easily with dioxus-free-icons.

More information about this crate can be found in the crate documentation.

Install

To use dioxus-free-icons, add this to your Cargo.toml:

[dependencies]
dioxus-free-icons = "0.1.1"

Example

This library provides Icon component, which will generate SVG for a Font Awesome icon.

use dioxus::prelude::*;
use dioxus_free_icons::icons::fa_brands_icons::FaRust;
use dioxus_free_icons::Icon;

fn RustIcon(cx: Scope) -> Element {
    cx.render(rsx! {
        Icon {
            size: 30,
            fill: "black",
            icon: Icon::FaRust,
        }
    })
}

License

This project is licensed under the MIT license.

Icon

Icon Library License Version
Font Awesome CC BY 4.0 License 6.1.1
heroicons MIT License 1.0.6
ionicons MIT License 6.0.2

Contribution

The project welcomes all contributions from anyone willing to work in good faith with other contributors and the community. In particular, contributions regarding support for other free icons such as Material Design icons or Ionicons are welcome. This library aims to be a react-icons-like library for dioxus projects.

Development

// generate icon files
cd packages/codegen
cargo run

Preview

cd packages/exmaple
cargo install dioxus-cli
dioxus serve

Update icons

  1. checkout a new tag in the icon resource submodule
  2. create new icon files
  3. Update README.md and check the LICENSE
You might also like...
Execute Javascript code in the Dioxus, and get the return value ( for Dioxus )

Golde Dioxus Execute Javascript code in the Dioxus, and get the return value. This demo can help use Javascript to calc the + operator formula. use di

A template for starting a dioxus project to be used with dioxus-cli

A template for starting a dioxus project to be used with dioxus-cli

Featured Dioxus projects on how to build clean user interfaces in Rust
Featured Dioxus projects on how to build clean user interfaces in Rust

Example projects with Dioxus This repository holds the code for a variety of example projects built with Dioxus. Each project has information on how t

 (Pre-Release Software) Secure, Encrypted, P2P chat written atop Warp, IPFS, LibP2P, Dioxus and many more awesome projects and protocols.
(Pre-Release Software) Secure, Encrypted, P2P chat written atop Warp, IPFS, LibP2P, Dioxus and many more awesome projects and protocols.

Uplink Privacy First, Modular, P2P messaging client built atop Warp. Uplink is written in pure Rust with a UI in Dioxus (which is also written in Rust

๐Ÿ”ฃ nerdfix helps you to find/fix obsolete Nerd Font icons in your project.

๐Ÿ”ฃ nerdfix nerdfix helps you to find/fix obsolete Nerd Font icons in your project. ๐Ÿ’ญ Why Nerd Fonts is used in many projects for a beautiful UI. It p

Animated app icons in your Dock that can run an arbitrary shell script when clicked.
Animated app icons in your Dock that can run an arbitrary shell script when clicked.

Live App Icon for Mac Animated app icons in your Dock that can run an arbitrary shell script when clicked. Requirements macOS 13 (Ventura) or higher X

A simple cli to clone projects and fetch all projects in a GitHub org..

stupid-git A simple cli to clone projects and update all projects. get all repository from GitHub clone all pull all with git stash Usage create sgit.

svgcleaner could help you to clean up your SVG files from the unnecessary data.

svgcleaner svgcleaner helps you clean up your SVG files, keeping them free from unnecessary data. Table of Contents Purpose Goals Alternatives Charts

Convert your ascii diagram scribbles into happy little SVG

Svgbob Svgbob can create a nice graphical representation of your text diagrams. Svgbob provides a cli which takes text as an input and creates an svg

Proc-macros for generating icons from the Iconify API

iconify-rs This crate provides a macro to embed SVGs from Iconify. For a list of icons, see Iconify Icon Sets. ๐Ÿ“ Usage let svg = iconify::svg!("mdi:h

12600+ icons pack for embedded graphics!
12600+ icons pack for embedded graphics!

๐Ÿ“ฆ embedded-icon 12600+ ๐Ÿ–ผ icons for embedded-graphics. ๐Ÿš€ Features ๐Ÿ“ฆ Support to multiple icon packs - Easy to add support to! ๐ŸŽจ Multiple resolution

A simple Iced application that I wrote as a learning activity, which allows you to browse the full list of regular Material Icons.
A simple Iced application that I wrote as a learning activity, which allows you to browse the full list of regular Material Icons.

Iced Material Icon Browser Iced Material Icon Browser is a simple Iced application that I wrote as a learning activity, which allows you to browse the

Generate QR code easily for free - QR Code Generation as a Service.

QRcode.show Generate QR code easily for free - QR Code Generation as a Service. INPUT: curl qrcode.show/INPUT curl qrcode.show -d INPUT curl qrcode.sh

Removes generated and downloaded files from code projects to free up space

makeclean Removes generated and downloaded files from code projects to free up space. Features: List, cleans and archives projects depending on how lo

Add toast support in your dioxus project

Add toast support in your dioxus project

A cross-platofrm desktop app to manage your ports made with Dioxus and Rust.
A cross-platofrm desktop app to manage your ports made with Dioxus and Rust.

Port Manager A cross-platofrm desktop app to manage your ports made with Dioxus and Rust. This app has been tested only on macOS. Test on other platfo

๐Ÿง  A command-line utility for switching git branches more easily. Switch branches interactively or use a fuzzy search to find that long-forgotten branch name.
๐Ÿง  A command-line utility for switching git branches more easily. Switch branches interactively or use a fuzzy search to find that long-forgotten branch name.

git-smart-checkout A git command extension for switching git branches more efficiently. About Interactively switch branches or fuzzy search for that f

An SVG rendering library.

resvg resvg is an SVG rendering library. Purpose resvg can be used as a Rust library, a C library and as a CLI application to render SVG files based o

๐Ÿ”ญ Annict ใงใฎไปŠๆœŸใฎ่ฆ–่ด็Šถๆณใ‚’ SVG ็”ปๅƒใจใ—ใฆๅ‡บๅŠ›ใ™ใ‚‹ใ‚ตใƒผใƒ (WIP)

annict-profile-card ๐Ÿ”ญ Annict ใฎ่ฆ–่ด็Šถๆณใชใฉใ‚’ SVG ็”ปๅƒใจใ—ใฆๅ‡บๅŠ›ใ™ใ‚‹ API ใ‚ตใƒผใƒ (WIP) Annict GraphQL API ใ‚’ไฝฟ็”จใ—ใฆใ„ใพใ™ใ€‚

Comments
  • Fill property doesn't change the icon fill color on Heroicons Solid

    Fill property doesn't change the icon fill color on Heroicons Solid

    Hi! I'm trying out Dioxus for the first time and I got here because of the Awesome Dioxus Page. I tried to use your library for icons, love that they are type compiled. I have an issue when trying to change the color of the icon from black to white:

    use dioxus::prelude::*;
    use dioxus_free_icons::icons::hi_solid_icons::*;
    use dioxus_free_icons::Icon;
    
    fn main() {
        let log_level = log::Level::Debug;
        wasm_logger::init(wasm_logger::Config::new(log_level));
        dioxus::web::launch(app);
    }
    
    fn app(cx: Scope) -> Element {
        let mut count = use_state(&cx, || 0u32);
        let button_class =
            "inline-block bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded";
    
        cx.render(rsx!(
            link { rel: "stylesheet", href: "https://unpkg.com/tailwindcss@^2.0/dist/tailwind.min.css" },
            div {
                class: "flex flex-col shrink-0 p-6 items-center justify-center",
                button {
                    class: "{button_class}",
                    onclick: move |_|{count += 1},
                    "High Five!"
                },
                h1 { "High Five counter: {count}"},
                button {
                    class: "{button_class}",
                    onclick: move |_|{count -= 1},
                    "",
                    Icon {
                        width: 30,
                        height: 30,
                        fill: "white",
                        icon: HiMinus
                    }},
            }
        ))
    }
    

    Here's a screenshot of what this code produces on the browser: imagen As you can see, even though the fill property is white, and the button has a style that makes all text white, the icon appears still black. The rendered SVG code is this:

    <svg stroke="currentColor" stroke-width="0" class="" height="30" width="30" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill="white"><title></title><path clip-rule="evenodd" d="M3 10C3 9.44772 3.44772 9 4 9L16 9C16.5523 9 17 9.44772 17 10C17 10.5523 16.5523 11 16 11L4 11C3.44772 11 3 10.5523 3 10Z" fill="#374151" fill-rule="evenodd"></path></svg>
    
    opened by ElrohirGT 2
  • Unnecessary title tags created in HTML

    Unnecessary title tags created in HTML

    If title props is empty value, empty title tag is created in HTML and it is not good. To avoid this, I tried to use "conditional rendering" but https://github.com/DioxusLabs/dioxus/issues/500 happened.

           svg {
                stroke: "currentColor",
                stroke_width: "0",
                class: format_args!("{}", cx.props.class),
                height: format_args!("{}", cx.props.height),
                width: format_args!("{}", cx.props.width),
                view_box: format_args!("{}", cx.props.icon.view_box()),
                xmlns: format_args!("{}", cx.props.icon.xmlns()),
                fill: format_args!("{}", cx.props.fill),
                 // conditional rendering
                cx.props.title.is_some().then(|| {
                    rsx!{  title  {  cx.props.title }  }
                }),
                cx.props.icon.child_elements()
            }
    

    I will look into this issue now

    help wanted 
    opened by nissy-dev 1
Releases(v0.5.2)
Owner
Daiki Nishikawa
Daiki Nishikawa
๐Ÿ”ญ Annict ใงใฎไปŠๆœŸใฎ่ฆ–่ด็Šถๆณใ‚’ SVG ็”ปๅƒใจใ—ใฆๅ‡บๅŠ›ใ™ใ‚‹ใ‚ตใƒผใƒ (WIP)

annict-profile-card ?? Annict ใฎ่ฆ–่ด็Šถๆณใชใฉใ‚’ SVG ็”ปๅƒใจใ—ใฆๅ‡บๅŠ›ใ™ใ‚‹ API ใ‚ตใƒผใƒ (WIP) Annict GraphQL API ใ‚’ไฝฟ็”จใ—ใฆใ„ใพใ™ใ€‚

Nep 16 Dec 20, 2022
resvg is an SVG rendering library.

resvg can be used as a Rust library, a C library and as a CLI application to render SVG files based on a static SVG Full 1.1 subset.

Evgeniy Reizner 1.8k Dec 30, 2022
An SVG toolkit based on resvg

rusty-svg An SVG toolkit based on resvg This module is compiled to WASM and currently only supports Node.js Comparing with the backend ReSVG, this mod

Zimon Dai 9 Mar 21, 2022
The tool to make svg with triangles by length from two points.

The tool to make svg with triangles by length from two points.

null 2 Sep 27, 2021
Convert UFO .glif files to SVG, whether they're part of a font or not

Convert UFO glyph files (.glif) to SVG There exists already an svg2glif, but for some reason not the opposite operation. My MFEKglif editor treats .gl

Modular Font Editor K 3 Apr 26, 2022
A Rust-implementation of devoutโ€™s tutorial to create an SVG graphic device using extendr.

A Rust-implementation of devoutโ€™s tutorial to create an SVG graphic device using extendr.

Hiroaki Yutani 1 Jan 25, 2022
OpenCV Sample Projects in Rust

OpenCV Sample Projects in Rust

iwatake 9 Jan 28, 2022
A Simple-to-use, cross-platform Rust Webcam Capture Library

Cross Platform Rust Library for powerful Webcam Capture and Virtual Webcams

null 246 Jan 8, 2023
๐Ÿงฌ Material Icons for Dioxus

?? Dioxus Material Icons This project provides a simple but configurable component to render Google's Material Icons in Dioxus. ?? How to get started

Lennart Kloock 6 Jan 31, 2023
SVG to PDF file conversion based on "svg2pdf" and "resvg" Rust projects

pysvg2pdf Blazingly Fast โ„ข๏ธ SVG to PDF file conversion for Python. This project is based on Rust's svg2pdf and resvg projects. The project uses pyo3 a

SuffleWaffle 4 Mar 28, 2024