A wider screen, please

This page features interactive demos and side-by-side code samples that need at least 340 pixels of horizontal space. Please widen your browser window, or rotate your device, to continue.

Morpheus v0.1.0
v0.1.0

Avatars#

Component <neo-avatars> is an overlapping row of avatar images. Authored avatars stay in light DOM so server patches can append, replace, or remove them. The host folds extras into a +N circle when collapse-at is exceeded, and reduces the visible count further whenever the row no longer fits its container.

Default
Fixed collapse
Responsive collapse
Virtual overflow
Clickable overflow
Photographic images
Links
Deactivate Rename Duplicate
Delete
New state Toggle autoplay
Diego Vega Jan O'Sullivan Evelyn Kone Samira Khalil Alice Larsson Camila Duarte Theo Becker Mateusz Wisniewski
HTML CSS

The selected state's markup and its scoped CSS. The CSS is wrapped in <style>@scope { ... }</style> and applies to the preview only. Edits change the preview above, applied live while Sync is on, or when you click Patch or Replace. Patch morphs the preview; Replace swaps it outright.

Replace Patch

Signals

Datastar signals declared in the selected state's markup. Change a value to drive the preview, applied live while Sync is on, or when you click Patch.

Patch

Reference#

<neo-avatar>

Style-only frame for one avatar image or fallback. Use it standalone or as a direct child of <neo-avatars>.

Slots #

NameDescription
defaultAvatar content. Usually an <img>, but fallback initials or an icon work too.

CSS variables #

NameDefaultDescription
--neo-avatar-size2.25remAvatar width and height.
--neo-avatar-radius9999pxCorner radius.
--neo-avatar-clip-pathnoneClip path applied to the frame.
--neo-avatar-filternoneFilter applied to the frame.
--neo-avatar-bgcolor-mix(in srgb, var(--page-fg) 8%, transparent)Fallback background fill.
--neo-avatar-colorvar(--page-fg)Fallback text color.
--neo-avatar-border-width0Border width.
--neo-avatar-border-colorvar(--page-bg, #ffffff)Border color.
--neo-avatar-font-size0.8125remFallback initials font size.
--neo-avatar-font-weight650Fallback initials font weight.

<neo-avatars>

Responsive overlapping avatar group with generated overflow.

Attributes #

NameTypeDefaultDescription
collapse-atnumber observed0Maximum authored avatars to keep visible before generating the overflow circle. Omit or set to 0 for no author cap; responsive fitting still collapses as needed.
overflow-countnumber observed0Additional server-known people not present as avatar children. Added to hidden child count in the generated +N circle.
aria-labelstring"Avatars"Accessible label for the avatar group.

Slots #

NameDescription
defaultAvatar elements. Prefer direct <neo-avatar> children, or direct anchors/buttons containing a <neo-avatar>.
template[data-neo-avatars-overflow]Optional overflow template. The first element is cloned as the generated overflow circle when hidden avatars exist; descendants marked data-neo-avatars-overflow-count receive the current hidden count.

Events #

NameDetailBubblesDescription
neo-avatars-change{ shown: string[], hidden: string[] }yesFires when the shown/hidden split changes. shown and hidden are the ids of the visible vs. overflow-hidden <neo-avatar> children; avatars without an id are omitted.

CSS variables #

NameDefaultDescription
--neo-avatars-overlap0.75remHorizontal overlap between adjacent avatars.
--neo-avatars-radiusvar(--neo-avatar-radius)Corner radius of group children.
--neo-avatars-clip-pathvar(--neo-avatar-clip-path)Clip path applied to non-avatar children.
--neo-avatars-filtervar(--neo-avatar-filter)Filter applied to non-avatar children.
--neo-avatars-bgvar(--neo-avatar-bg)Background fill of group children.
--neo-avatars-border-width2pxBorder width separating overlapping avatars.
--neo-avatars-border-colorvar(--page-bg, #ffffff)Border color separating overlapping avatars.
--neo-avatars-overflow-bgcolor-mix(in srgb, var(--page-fg) 8%, var(--page-bg))Background fill of the generated +N circle.
--neo-avatars-overflow-colorvar(--page-fg)Text color of the generated +N circle.
--neo-avatars-overflow-font-size0.8125remFont size of the generated +N circle.
--neo-avatars-overflow-font-weight650Font weight of the generated +N circle.
--neo-avatars-focus-ringvar(--accent, currentColor)Focus ring color for clickable avatars.

Examples#

Fixed collapse#

collapse-at caps the visible authored avatars before responsive fitting kicks in. Here the row keeps five images visible at wide widths and folds the rest into +N.

Diego Vega Jan O'Sullivan Evelyn Kone Samira Khalil Alice Larsson Camila Duarte Theo Becker Mateusz Wisniewski

Responsive collapse#

Omit collapse-at to let the row show everything at wide widths. Drag the preview narrower and the host hides trailing avatars into the overflow circle until the row fits.

Diego Vega Jan O'Sullivan Evelyn Kone Samira Khalil Alice Larsson Camila Duarte Theo Becker Mateusz Wisniewski

Virtual overflow#

overflow-count adds people that are not present as image children. The generated circle combines that number with any children hidden by collapse-at or by responsive fitting.

Diego Vega Jan O'Sullivan Evelyn Kone Samira Khalil Alice Larsson Camila Duarte

Clickable overflow#

Add a <template data-neo-avatars-overflow> child to replace the generated inert circle. The host clones the template only when overflow exists and writes the hidden count into any data-neo-avatars-overflow-count descendant.

Diego Vega Jan O'Sullivan Evelyn Kone Samira Khalil Alice Larsson Camila Duarte Theo Becker

Photographic images#

Raster files (.jpg, .png, …) drop in the same way as the styled SVG illustrations. The host's clip / radius / border tokens crop the photo to the theme's avatar shape, and object-fit: cover keeps the subject centred when the source aspect ratio differs from the square frame.

Roman Sharkov Daniel

Direct children may be anchors or buttons with a <neo-avatar> inside. The focus ring belongs to the clickable avatar, while the generated overflow circle stays inert.

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator