Avatar
User or entity representation with image, initials fallback, and optional status indicator. Includes Avatar Group mode for stacking multiple avatars with configurable overlap and "+N more" overflow handling. Supports five sizes, two shapes, four status states, and deterministic auto-generated background colors from initials.
Preview & Code
_avatar.html.erb
███
██████ █████████ █████████
██████ ██████ ██████
███ ██████ ████████████████████ █████████ ████ ██
███ ██████ ████████████████████ ████ ████████████████████████████████ ████ █████ █████ █████ ███ ██
███ ██████ ████████████████████ █████████ █████ ███████ ████████ ██████ ████████ ██
███ ██████ ████████████████████ █████████ █████ █████ ████ █████ ██████████ ██
██████ █████ ██████
avatar_group_controller.js
██████ █ ██████████ █ ████ ████████████████████
██ ███████ ███ ██████████ ████████ █████████ ██ ██ ██████ ██████
██
██ ████ ███ ███ █████ ████████ ████ ██ ████████ ██████ ███████ ███ ████████
██ ███ ███ ████ ██████ ██ ███████ ████ █████
██
██ ████████
██ ████████ █ ███ ███ █████ ████ ██████
██ ██████ █ ██████ ████████ ████ ███ █████████ ██████ ████████████████
avatar_component.rb
█ ██████████████████████ ████
█████ ███████████████ █ ███████████████████
█████ █ █
███ █ ██████████ ████ █████ █████ ██████████ ███████ ██████ █████ ████████ █████ ████████ ██
███ █ ██████████ ████ █████ █████ ██████████ ███████ ████ ███ ████████████████ █████ ██████████████ ██
███ █ ██████████ █████ ██████ █████ ██████████ ███████ ██████ █████ ██████████ █████ ████████ ██
███ █ ██████████ █████ ██████ █████ ████████████ ███████ ████ ███ ██████████ █████ ████████ ██
███ █ ██████████ █████ ██████ █████ ██████████ ███████ ██████ █████ ██████████ █████ ████████ █
████████
avatar_component.html.erb
██ ██ ███████████ ██
███ ████████████████████████████████████████████████████████████ ██
███ █████ █████ ███████ ███████ ████ ███████ ███ ████████ ████ ██
███ ████████████████████████████████████████████████████████████ ██
████ ██████████ █████████████████████ ███
██ ██ ██████████████ █ █ ██████████████████████████████████ ███ ███
███ ███████ ███████ ██
██ ███████████████████████████████ ██ ██████ ██████ ██
█████ ██████████ █████████████████████████████████ ██████ ███████████ ████████████████████ ████
avatar_group_controller.js
██████ █ ██████████ █ ████ ████████████████████
██ ███████ ███ ██████████ ████████ █████████ ██ ██ ██████ ██████
██
██ ████ ███ ███ █████ ████████ ████ ██ ████████ ██████ ███████ ███ ████████
██ ███ ███ ████ ██████ ██ ███████ ████ █████
██
██ ████████
██ ████████ █ ███ ███ █████ ████ ██████
██ ██████ █ ██████ ████████ ████ ███ █████████ ██████ ████████████████
Changelog
- v1.0.0: Initial release with single avatar and avatar group modes
- Five sizes (xs through xl), two shapes (circle, rounded)
- Status indicators (online, offline, busy, away)
- Deterministic initials color generation
- Stimulus-powered expandable overflow in group mode
Get Full Access
Unlock the source code for this component and all others. One-time payment for lifetime access.
Get Access Now