An image element with a fallback for representing the user.
use yew::prelude::*;
use crate::components::ui::avatar::{Avatar, AvatarFallback, AvatarImage};
#[function_component]
pub fn AvatarDemo() -> Html {
html! {
<Avatar>
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
<AvatarFallback>{"CN"}</AvatarFallback>
</Avatar>
}
}
use yew::prelude::*;
use crate::components::ui::avatar::{Avatar, AvatarFallback, AvatarImage};
#[function_component]
pub fn AvatarDemo() -> Html {
html! {
<Avatar>
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
<AvatarFallback>{"CN"}</AvatarFallback>
</Avatar>
}
}
The CLI is not yet available. For now, manually copy the component source into your project.
rust-shadcn-ui add avatar
use yew::prelude::*;
use crate::components::ui::avatar::{Avatar, AvatarFallback, AvatarImage};
#[component]
fn Usage() -> impl IntoView {
view! {
<Avatar>
<AvatarImage src="https://github.com/shadcn.png" />
<AvatarFallback>{"CN"}</AvatarFallback>
</Avatar>
}
}