Skip to main content

dioxus_icons/
props.rs

1use dioxus::core::{AttributeValue, IntoAttributeValue};
2use dioxus::prelude::*;
3
4/// Convenience size for SVG width and height.
5#[derive(Clone, PartialEq)]
6pub struct IconSize(AttributeValue);
7
8impl IconSize {
9    pub(crate) fn into_value(self) -> AttributeValue {
10        self.0
11    }
12}
13
14impl Default for IconSize {
15    fn default() -> Self {
16        Self(AttributeValue::Int(24))
17    }
18}
19
20impl<T> From<T> for IconSize
21where
22    T: IntoAttributeValue,
23{
24    fn from(value: T) -> Self {
25        Self(value.into_value())
26    }
27}
28
29/// Properties shared by every Lucide icon component.
30#[derive(Clone, PartialEq, Props)]
31pub struct IconProps {
32    /// Convenience size for SVG width and height when those attributes are not set directly.
33    #[props(into, default = IconSize::default())]
34    pub size: IconSize,
35    /// Attributes passed to the root SVG.
36    #[props(extends = SvgAttributes)]
37    pub attributes: Vec<Attribute>,
38}