Componentes
Avatar
El avatar es una representación de una entidad única, como una persona, una empresa o un objeto. Puede contener iniciales, imágenes, íconos o emojis.
Cuándo utilizar
Utilizar
- Para representar a quienes tienen cuentas de usuario en perfiles.
Anatomía
- Cuerpo: es la imagen que representa al usuario o entidad.
- Insignia: indicador de presencia para mostrar la disponibilidad en línea.
Criterios
1. Tamaño
- Grande: 40px
- Mediano: 32px
- Pequeño: 24px
2. Forma
Por defecto, el Avatar se presenta solo de forma circular.
3. Variantes
- Imagen: retrato fotográfico de la persona.
- Iniciales: Su estilo de texto es siempre en la fuente Sans. Elegir sus colores con cuidado para asegurar un buen contraste con el color de fondo del avatar. Evitar colores con poco contraste.
4. Estados
- Personalizado: se ha seleccionado un avatar personalizado, mostrando la identidad mediante una fotografía.
- Sin avatar: no se ha configurado un avatar. Se muestran las iniciales.
- Activo: indica que el usuario está en línea y disponible para interactuar.
- Ausente: indica que el usuario está en línea pero no disponible para interactuar.
- Desconectado: muestra que el usuario no está en línea.
Buenas prácticas
- Agregar un indicador de presencia para mostrar la disponibilidad en línea.
- Nunca utilizar un avatar de forma aislada sin un texto o señales de interacción. Esto es para que sean claramente identificables y faciliten la comprensión y la interacción.
Códigos CSS
Copiar Código CSS/* ================================
AVATAR COMPONENT
Extracted from Figma Design System
================================ *//* Base Avatar */
.avatar {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 50%;
overflow: hidden;
flex-shrink: 0;
}/* — Size: 40px — */
.avatar–lg {
width: 40px;
height: 40px;
}/* — Size: 32px — */
.avatar–md {
width: 32px;
height: 32px;
}/* — Size: 24px — */
.avatar–sm {
width: 24px;
height: 24px;
}/* — Type: Image — */
.avatar–image img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 50%;
}/* — Type: Initials — */
.avatar–initials {
background-color: #ffe9d5;
font-family: ‘Work Sans’, sans-serif;
font-weight: 500;
color: #7c2312;
}.avatar–lg.avatar–initials {
font-size: 18px;
line-height: 28px;
}.avatar–md.avatar–initials {
font-size: 14px;
line-height: 20px;
}.avatar–sm.avatar–initials {
font-size: 10px;
line-height: 16px;
}/* — Badge (status indicator) — */
.avatar__badge {
position: absolute;
bottom: 2px;
right: 1px;
border-radius: 50%;
border: 2px solid #ffffff;
box-sizing: content-box;
}.avatar–lg .avatar__badge {
width: 8px;
height: 8px;
}.avatar–md .avatar__badge {
width: 6px;
height: 6px;
}.avatar–sm .avatar__badge {
width: 4px;
height: 4px;
}/* — Status: Online (en línea) — */
.avatar__badge–online {
background-color: #27aa29;
}/* — Status: Busy (ocupado) — */
.avatar__badge–busy {
background-color: #ffe0e1;
}/* — Status: Unavailable (no disponible) — */
.avatar__badge–unavailable {
background-color: #6d6d6d;
}/* — Badge: Add — */
.avatar__badge–add {
display: flex;
align-items: center;
justify-content: center;
background-color: #3c7af6;
border: none;
cursor: pointer;
padding: 2px;
}.avatar–lg .avatar__badge–add {
width: 12px;
height: 12px;
}.avatar–md .avatar__badge–add {
width: 10px;
height: 10px;
}.avatar–sm .avatar__badge–add {
width: 8px;
height: 8px;
}.avatar__badge–add svg {
color: #ffffff;
width: 100%;
height: 100%;
}/* — Badge: Notification — */
.avatar__badge–notification {
display: flex;
align-items: center;
justify-content: center;
background-color: #ffe0e1;
border: none;
padding: 1px;
top: 0;
right: 0;
bottom: auto;
}.avatar–lg .avatar__badge–notification {
width: 12px;
height: 12px;
}.avatar__badge–notification span {
font-family: ‘Work Sans’, sans-serif;
font-size: 5px;
font-weight: 600;
line-height: 7px;
color: #ffffff;
}