Componente Avatar para Angular | ng-hub-ui-avatar
Componente avatar para Angular con iniciales, imágenes fallback, badges de presencia y variables CSS para interfaces reutilizables de identidad de usuario.
Ejemplos interactivos
Explora ejemplos en vivo que muestran cómo se comporta la librería en casos de uso habituales de Angular.
Fuentes de avatar
Resuelve avatares a partir de perfiles sociales, imágenes personalizadas, iniciales del nombre o un valor personalizado, con fallback automático.
Perfil de Facebook
Gravatar
Perfil de GitHub
Fuente de imagen personalizada
Iniciales del nombre
Visualización de valor
Sistema de fallback
Degrada con elegancia a través de cada fuente configurada hasta mostrar una representación significativa.
Sistema de fallback
Showing GitHub source (Facebook ID invalid)
Dimensionado
Controla las dimensiones del avatar, la proporción entre texto y tamaño y cuántas iniciales se renderizan.
Tamaño personalizado
3.5remcalc(2rem + 12px)72 (pixels)Proporción del tamaño de texto
Límite de iniciales
Estilizado
Forma, radio de esquina, colores, bordes y estilos en línea arbitrarios, todo controlado mediante inputs y variables CSS.
Avatar redondo
Radio de esquinas
Color de fondo y de primer plano
--hub-avatar-bg-color ([autoColor]="false")Iniciales que se leen siempre
The automatic palette, as it paints today
Eight names, one per palette slot. Each avatar writes black or white on the colour its name hashed to, and the first ratio below it is read back from the two colours the browser actually painted. The second is what white initials would have scored on that same colour — what the component forced before 22.14.0, and what six of these eight would still be doing.
- GHmeasuring…
- ALmeasuring…
- LTmeasuring…
- BLmeasuring…
- DKmeasuring…
- ATmeasuring…
- KTmeasuring…
- ABmeasuring…
Those six are stated rather than shown on purpose: a row of white-on-yellow initials would be a page about readable labels printing six unreadable ones. An explicit fgColor does still win, contrast or not — that is how you pin the old look, and the snippet below is all it takes.
A palette the library has never seen
#ffcc00, #cccccc and #004080 — three colours the library ships no knowledge of. An application hands them to provideAvatar({ colors }) once at bootstrap; this demo scopes the same palette to its own avatars so it does not repaint the rest of the page. Either way the ink is derived from whatever colour ends up behind the text, so the guarantee travels with the background rather than with a list of approved pairings.
- VRmeasuring…
- INmeasuring…
- RPmeasuring…
Color del borde
Estilos personalizados
Interactividad
Reacciona a la interacción del usuario con el evento de clic del avatar.
Manejador del evento de clic
Grupos y badge
Apila avatares en un grupo y superpón un badge en la esquina — un punto de presencia o un contador — coloreado con la paleta semántica.
Visualización de grupo de avatares
Badge (punto y contador)
Contenido personalizado
Proyecta cualquier icono, SVG en línea, imagen o emoji dentro del avatar. Se centra, espacia y recorta a la forma del avatar, se dimensiona de forma agnóstica (los iconos de fuente escalan, los SVG/imágenes rellenan) y se tematiza con los inputs habituales bgColor / fgColor.
Contenido personalizado (iconos, SVG)