defmodule Shino.UI.Avatar do @moduledoc """ Provides avatar related components. > Displays an image with a fallback for representing the user. ## Examples ```heex CN ``` ```heex CN ``` ## References * [@radix-ui/primitives - Avatar](https://www.radix-ui.com/primitives/docs/components/avatar) * [shadcn/ui - Avatar](https://ui.shadcn.com/docs/components/avatar). """ use Shino.UI, :component @doc """ The root contains all the parts of an avatar. """ attr :class, :any, default: nil attr :rest, :global slot :inner_block, required: true def root(assigns) do ~H""" <%= render_slot(@inner_block) %> """ end @doc """ Renders an avatar image. """ attr :class, :any, default: nil attr :rest, :global, include: ~w(src) def image(assigns) do ~H""" """ end @doc """ Renders an avatar fallback. """ attr :class, :any, default: nil attr :rest, :global slot :inner_block, required: true def fallback(assigns) do ~H""" <%= render_slot(@inner_block) %> """ end end