Page Presence

See who has viewed a page, and when


Live Demo

When to use

The PagePresence component renders a "facepile" showing the avatars of users who are (or have been) present on that page. Users will be able to see who is viewing the page now, and when others were last online via tooltips. The component also marks the current user as present on the page.

This component pairs well with:


How to use

If you use this component alongside Sidebar, you can turn off showing presence in the Sidebar by adding showPresence={false} to Sidebar.

import { PagePresence } from "@cord-sdk/react";

export const Example = () => (
  <div>
    <PagePresence excludeViewer={false} />
  </div>
);
Copy

Properties


location

optional
string
The location to watch for users. The default is set to the current URL.

exactMatch

optional
boolean
When true, only users in the component's exact location are shown in the facepile. When false, users in any partially matching location are shown.
The default is set to false.

onlyPresentUsers

optional
boolean
When true, only users with ephemeral presence are shown in the facepile. When false, users with ephemeral or durable presence are shown.

excludeViewer

optional
boolean
When true, users do not see their own avatars in the facepile. When false, users see themselves in the facepile.
The default is set to false.

maxUsers

optional
number
The maximum number of avatars to display in the facepile. If there are more than this many avatars to show, a "+N" indicator will be shown after the faces to indicate how many avatars are not being shown.
The default is set to 5.

durable

optional
boolean
Whether to send durable presence updates. Ephemeral presence updates are always sent.
The default is set to true.

orientation

optional
string
The orientation of the facepile. Can either be horizontal or vertical.
The default is set to horizontal.

onUpdate

optional
function
Callback invoked when the presence information changes.

CSS Variables

These can be used to customize the component. You can learn more about customization here.

Name Default Value
--cord-avatar-border-radius
var(--cord-space-3xs, 4px);
--cord-avatar-text-color
var(--cord-color-base, #FFFFFF);
--cord-avatar-background-color
var(--cord-color-brand-primary, #121314);
--cord-avatar-text-transform
none;
--cord-facepile-background-color
var(--cord-color-base, #FFFFFF);