pub struct IconProps {
pub icon: IconData,
pub weight: Signal<IconWeight>,
pub size: TextProp,
pub color: TextProp,
pub mirrored: Signal<bool>,
}Expand description
Props for the Icon component.
A thin wrapper around <svg /> for displaying Phosphor icons.
use leptos::prelude::*;
use phosphor_leptos::{Icon, IconWeight, HORSE, HEART, CUBE};
#[component]
fn MyComponent() -> impl IntoView {
view! {
<Icon icon=HORSE />
<Icon icon=HEART color="#AE2983" weight=IconWeight::Fill size="32px" />
<Icon icon=CUBE color="teal" weight=IconWeight::Duotone />
}
}§Required Props
- icon:
IconData- The icon data to display.
§Optional Props
-
weight:
impl Into<Signal<IconWeight>>- Icon weight/style. This can also be used, for example, to “toggle” an icon’s state: a rating component could use Stars with IconWeight::Regular to denote an empty star, and IconWeight::Fill to denote a filled star.
-
size:
impl Into<TextProp>- Icon height & width. As with standard React elements,
this can be a number, or a string with units in
px,%,em,rem,pt,cm,mm,in.
- Icon height & width. As with standard React elements,
this can be a number, or a string with units in
-
color:
impl Into<TextProp>-
Icon stroke/fill color.
This can be any CSS color string, including
hex,rgb,rgba,hsl,hsla, named colors, or the specialcurrentColorvariable.
-
-
mirrored:
impl Into<Signal<bool>>-
Flip the icon horizontally.
This can be useful in RTL languages where normal icon orientation is not appropriate.
-
Fields§
§icon: IconDataThe icon data to display.
weight: Signal<IconWeight>Icon weight/style. This can also be used, for example, to “toggle” an icon’s state: a rating component could use Stars with IconWeight::Regular to denote an empty star, and IconWeight::Fill to denote a filled star.
size: TextPropIcon height & width. As with standard React elements,
this can be a number, or a string with units in
px, %, em, rem, pt, cm, mm, in.
color: TextPropIcon stroke/fill color.
This can be any CSS color string, including
hex, rgb, rgba, hsl, hsla, named colors,
or the special currentColor variable.
mirrored: Signal<bool>Flip the icon horizontally.
This can be useful in RTL languages where normal icon orientation is not appropriate.
Implementations§
Source§impl IconProps
impl IconProps
Sourcepub fn builder() -> IconPropsBuilder<((), (), (), (), ())>
pub fn builder() -> IconPropsBuilder<((), (), (), (), ())>
Create a builder for building IconProps.
On the builder, call .icon(...), .weight(...)(optional), .size(...)(optional), .color(...)(optional), .mirrored(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of IconProps.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IconProps
impl !RefUnwindSafe for IconProps
impl Send for IconProps
impl Sync for IconProps
impl Unpin for IconProps
impl !UnwindSafe for IconProps
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more