Skip to content

Commit 38510d6

Browse files
committed
make title prop optional
1 parent 979bb25 commit 38510d6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/lib/src/icon_component.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ pub struct IconProps<T: IconShape + Clone + PartialEq + 'static> {
2525
#[props(default = "".to_string())]
2626
pub class: String,
2727
/// An accessible, short-text description for the icon.
28-
#[props(default = "".to_string())]
29-
pub title: String,
28+
pub title: Option<String>,
3029
}
3130

3231
/// Icon component which generates SVG elements
@@ -42,9 +41,11 @@ pub fn Icon<T: IconShape + Clone + PartialEq + 'static>(props: IconProps<T>) ->
4241
xmlns: "{props.icon.xmlns()}",
4342
fill: "{props.fill}",
4443
stroke: "{props.fill}",
45-
title {
46-
"{props.title}"
47-
}
44+
if let Some(title_text) = props.title {
45+
title {
46+
"{title_text}"
47+
}
48+
},
4849
{props.icon.child_elements()}
4950
}
5051
)

0 commit comments

Comments
 (0)