@molecule/app-presence-indicator-solid
Feature · presence-indicator · App (browser) · v1.1.2 · Apache-2.0
Online/offline dot + presence overlay for avatars and user chips
npm install @molecule/app-presence-indicator-solidHow it works
@molecule/app-presence-indicator-solid is a ready-made presence-indicator feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { AvatarWithPresence, PresenceDot } from '@molecule/app-presence-indicator-solid'
const user = { avatarUrl: '/avatar.png', name: 'Ada' }
export function User() {
// Inline dot next to a user name
const inline = (
<span>
{user.name} <PresenceDot status="online" />
</span>
)
// Dot overlaid on an avatar image
return (
<div>
{inline}
<AvatarWithPresence status="away" corner="bottom-right">
<img src={user.avatarUrl} alt={user.name} width={40} height={40} />
</AvatarWithPresence>
</div>
)
}Works with: @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid
Reference
Solid presence indicator primitives.
Exports:
PresenceDot— small colored status dot (online/away/busy/offline).AvatarWithPresence— wraps any avatar and overlays a presence dot.PresenceStatustype.
It is the Solid counterpart of @molecule/app-presence-indicator-react: the
same props (React names), the same DOM for the same input.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { AvatarWithPresence, PresenceDot } from '@molecule/app-presence-indicator-solid'
const user = { avatarUrl: '/avatar.png', name: 'Ada' }
export function User() {
// Inline dot next to a user name
const inline = (
<span>
{user.name} <PresenceDot status="online" />
</span>
)
// Dot overlaid on an avatar image
return (
<div>
{inline}
<AvatarWithPresence status="away" corner="bottom-right">
<img src={user.avatarUrl} alt={user.name} width={40} height={40} />
</AvatarWithPresence>
</div>
)
}
Type
feature
Installation
npm install @molecule/app-presence-indicator-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
API
Interfaces
PresenceDotProps
Props accepted by the PresenceDot component.
interface PresenceDotProps {
/** The presence state to display. */
status: PresenceStatus
/** Diameter in pixels. Defaults to 10. */
size?: number
/** Position — `'inline'` default; `'overlay'` positions absolutely for avatar overlays. */
position?: 'inline' | 'overlay'
/** Overlay corner when `position="overlay"`. Defaults to `'bottom-right'`. */
corner?: 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left'
/** Accessible label override; defaults to `t('presenceIndicator.aria.presence', …)`. */
ariaLabel?: string
/** Extra classes. */
className?: string
}
AvatarWithPresenceProps
Props accepted by the AvatarWithPresence component.
interface AvatarWithPresenceProps {
/** The avatar / media to decorate. */
children: JSX.Element
/** Presence status; omit to hide the dot. */
status?: PresenceStatus
/** Corner placement of the dot. Defaults to `'bottom-right'`. */
corner?: 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left'
/** Dot size. Defaults to 10. */
dotSize?: number
/** Extra classes on the outer wrapper. */
className?: string
}
Types
PresenceStatus
Union of supported user-presence states displayed by the dot.
type PresenceStatus = 'online' | 'away' | 'busy' | 'offline'
Functions
AvatarWithPresence(props)
Wraps any avatar/image and overlays a presence dot at a corner. Non-destructive — just positions the dot; the child is untouched.
function AvatarWithPresence(props: AvatarWithPresenceProps): JSX.Element
props— Component props (seeAvatarWithPresenceProps).
Returns: The rendered avatar with its presence overlay.
PresenceDot(props)
Small colored circle indicating user presence. Use inline next to a name,
or with position="overlay" attached to the corner of an avatar.
The default aria-label resolves through t() with the
presenceIndicator.aria.presence key (an explicitly translated status word
per presenceIndicator.status.* key), so it follows the active locale;
ariaLabel overrides it.
function PresenceDot(props: PresenceDotProps): JSX.Element
props— Component props (seePresenceDotProps).
Returns: The rendered presence dot.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-solid^3.5.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-solid^1.1.0solid-js^1.8.0
Runtime Dependencies
@molecule/app-solid@molecule/app-ui@molecule/app-ui-solidsolid-js
The default aria-label is the English string "Presence: <status>" — pass
ariaLabel (e.g. from t()) in localized apps; the package has no locale
bond. position="overlay" positions absolutely, so the dot must sit inside
a relatively-positioned parent — AvatarWithPresence provides that
wrapper. Status colors are fixed semantic hues (green/yellow/red/gray),
identical in both themes; the overlay ring color follows
var(--color-surface).
Translations
Translation strings are provided by @molecule/app-locales-presence-indicator.