Status and Presence

Set a status that clears itself, go away, pause notifications, and a person's card with their local time.

Set a status

Availability

Pause notifications

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/presence

Usage

import { StatusPicker, type UserStatus } from "./ui/uicontext/components/kit/Presence.ts"
const Message = UiSchema.TaggedEnum({	SetStatus: { emoji: Schema.String, text: Schema.String, until: Schema.optional(Schema.String) },	ClearedStatus: {},	SetAway: { away: Schema.Boolean },	Paused: { until: Schema.NullOr(Schema.String) },})// `until` is worked out from the reader's "Clear after" choice and `now`export const Status = (h: Html.H<typeof Message.Type>, status: UserStatus | null, away: boolean, pausedUntil: string | null, now: string) =>	StatusPicker(h, {		props: { status, away, pausedUntil, now },		onEmit: {			RequestedStatus: (status) => Message.SetStatus(status),			RequestedClearStatus: () => Message.ClearedStatus(),			RequestedAway: ({ away }) => Message.SetAway({ away }),			RequestedPause: ({ until }) => Message.Paused({ until }),		},	})

Examples

Profile card

BO

Ben Okafor

Platform engineerActive

Lisbon (UTC+0)

3:00 PM local time (GMT+0)
MF

Maximiliana Alexandra Featherstonehaugh-Worthington

Principal staff engineer, platform reliability (EMEA)Notifications paused

Heads down on the billing ledger · until 6:45 AM

4:45 AM local time (GMT+13:45)

API reference

StatusPickerComponent

Props

StatusPicker props
NameTypeDescription
statusrequiredUserStatus | nullThe reader's status now, or null
awayrequiredbooleanThe reader set themselves away
pausedUntilrequiredstring | nullNotifications are paused until this time (ISO), or null
nowrequiredstringThe time now (ISO), for "until 3:30 PM"
timeZonestring—
agentIdstring—

Events

StatusPicker events
EventPayloadDescription
RequestedStatus{ emoji: string; text: string; until?: string }Set the reader's status; until is when it clears, worked out from their choice
RequestedClearStatus{}—
RequestedAway{ away: boolean }Show the reader as away (or active again)
RequestedPause{ until: string | null }Pause notifications until until (ISO), or resume them (null)

Agent actions

What agents can do with StatusPicker
ActionDescription
ClickedPresetFill in a status: emoji, text and when it clears (never, 30m, 1h, 4h, today, week)
SubmittedStatusSave the status being written
ClickedClearClear the reader's status
ClickedPausePause notifications: 30m, 1h, 2h or tomorrow

ProfileCardView function

Options

ProfileCard options
NameTypeDescription
personrequired{ readonly id: string; readonly name: string; readonly title?: string | undefined; readonly agent?: boolean | undefined }—
presence"active" | "away" | "dnd" | "offline"—
statusUserStatus | null—
timeZonestringThe person's time zone (IANA): the card shows their local time
nowrequiredstringThe time now, ISO
messagestringA printed route to their DM
call((button: ButtonBuilder<Message>) => ButtonBuilder<Message>)Binds the Call button's press; no button without it
extraView.Input—

Accessibility

  • The status form names its field and its Clear after select; suggestions are buttons. Away is a toggle button, and paused notifications are announced with when they resume.
  • A profile card names the person and reads their presence, status and local time as text; Message is a link and Call a button.

Source