Crate dioxus_heroicons

source ·
Expand description

Dioxus components for heroicons

This library provides two components. The Icon component produces the SVG for a heroicon. The IconButton component wraps the icon with a HTML button.

In your own components, you can call them like this:

use dioxus::prelude::*;
use dioxus_heroicons::{Icon, IconButton, solid::Shape};

#[inline_props]
fn DeleteButton(cx: Scope, foo: u8) -> Element {
    let onclick = move |evt| {
        // Delete a thing
    };
    let disabled = if *foo < 42 { true } else { false };
    cx.render(rsx! {
        IconButton {
            onclick: onclick,
            class: "some-css-class",
            title: "Delete it",
            disabled: disabled,
            size: 30,
            icon: Shape::Trash,
        }
    })
}

fn PointsRight(cx: Scope) -> Element {
    cx.render(rsx! {
        Icon {
            icon: Shape::ArrowRight,
            fill: "blue",
        }
    })
}

Check out https://jkelleyrtp.github.io/icon-chooser/ for an icon chooser that shows you all the solid icons and lets you copy the relevant component code to the clipboard.

Modules

This module contains all the mini icon shapes.
This module contains all the outline icon shapes.
This module contains all the solid icon shapes.

Structs

The properties for the IconButton component.
The properties for the Icon component.

Traits

This trait is used to abstract the icon shape so you can use shapes from the outline or solid modules for any property that accepts a shape.

Functions

Renders an <svg> element for a heroicon.
Renders a <button> containing an SVG icon.