MCPcopy Create free account
hub / github.com/DioxusLabs/dioxus-components / AvatarFallback

Function AvatarFallback

primitives/src/avatar.rs:198–216  ·  view source on GitHub ↗
(props: AvatarFallbackProps)

Source from the content-addressed store, hash-verified

196/// ```
197#[component]
198pub fn AvatarFallback(props: AvatarFallbackProps) -> Element {
199 let mut ctx: AvatarCtx = use_context();
200
201 // Mark that a fallback child is provided
202 use_effect(move || {
203 ctx.has_fallback_child.set(true);
204 });
205
206 let show_fallback =
207 use_memo(move || matches!((ctx.state)(), AvatarState::Error | AvatarState::Empty));
208
209 if !show_fallback() {
210 return rsx!({});
211 }
212
213 rsx! {
214 span { ..props.attributes, {props.children} }
215 }
216}
217
218/// The props for the [`AvatarImage`] component.
219#[derive(Props, Clone, PartialEq)]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected