pub struct IconProps<T: IconShape> {
pub icon: T,
pub title: Option<&'static str>,
pub width: Option<&'static str>,
pub height: Option<&'static str>,
pub fill: Option<&'static str>,
pub stroke: Option<&'static str>,
pub stroke_width: Option<&'static str>,
pub stroke_line_cap: Option<&'static str>,
pub stroke_line_join: Option<&'static str>,
pub attributes: Vec<Attribute>,
}Expand description
Props for the Icon component.
All fields are optional except icon. When a field is not provided,
the default value from the associated IconShape implementation is used.
Fields§
§icon: TThe icon shape implementation that provides SVG child elements.
title: Option<&'static str>Optional title text rendered as a <title> element inside the SVG for accessibility.
width: Option<&'static str>Default width of the SVG element in pixels.
height: Option<&'static str>Default height of the SVG element in pixels.
fill: Option<&'static str>Default fill color of the SVG element.
stroke: Option<&'static str>Default stroke color of the SVG element.
stroke_width: Option<&'static str>Default stroke width of the SVG element (e.g., “2”).
stroke_line_cap: Option<&'static str>Default stroke line cap style (e.g., “round”, “butt”, “square”).
stroke_line_join: Option<&'static str>Default stroke line join style (e.g., “round”, “miter”, “bevel”).
attributes: Vec<Attribute>Additional HTML/SVG global attributes to spread onto the <svg> element.
Allows passing standard attributes like id, aria-*, event handlers, etc.
Implementations§
Source§impl<T: IconShape> IconProps<T>
impl<T: IconShape> IconProps<T>
Sourcepub fn builder() -> IconPropsBuilder<((), (), (), (), (), (), (), (), (), ()), T>
pub fn builder() -> IconPropsBuilder<((), (), (), (), (), (), (), (), (), ()), T>
Create a builder for building IconProps.
On the builder, call .icon(...), .title(...)(optional), .width(...)(optional), .height(...)(optional), .fill(...)(optional), .stroke(...)(optional), .stroke_width(...)(optional), .stroke_line_cap(...)(optional), .stroke_line_join(...)(optional), .attributes(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of IconProps.