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 an HTML button.
In your own components, you can call them like this:
use dioxus::prelude::*;
use dioxus_heroicons::{Icon, IconButton, solid::Shape};
#[derive(Props, PartialEq, Clone)]
struct DeleteButtonProps {
foo: u8,
}
fn DeleteButton(props: DeleteButtonProps) -> Element {
let onclick = move |evt| {
// Delete a thing
};
let disabled = if props.foo < 42 { true } else { false };
rsx! {
IconButton {
onclick: onclick,
class: "some-css-class",
title: "Delete it",
disabled: disabled,
size: 30,
icon: Shape::Trash,
}
}
}
fn PointsRight() -> Element {
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§
- mini
- This module contains all the mini icon shapes.
- outline
- This module contains all the outline icon shapes.
- solid
- This module contains all the solid icon shapes.
Structs§
- Icon
Button Props - The properties for the
IconButtoncomponent. - Icon
Props - The properties for the
Iconcomponent.
Traits§
- Icon
Shape - This trait is used to abstract the icon shape so you can use shapes from the
outlineorsolidmodules for any property that accepts a shape.
Functions§
- Icon
- Renders an
<svg>element for a heroicon. - Icon
Button - Renders a
<button>containing an SVG icon.