Primitives
Animated Number Avatar Badge Button Button Group Toggle Toggle Group Checkbox Chip Countdown Divider Fab Grid Icon Image Input Search Input Textarea Label Loader Marquee Masked Input Message Bubble Notification Banner Offline Banner Progress Progress Ring Radio Group Range Slider Rating Separator Skeleton Slider Stack Stepper Switch Text Theme Toggle Ticker Typing IndicatorComposed
Accordion Achievement Badge Action Bar Action Sheet Action Swap Activity Rings Add to Cart Button Address Card Agenda List Alert Amount Keypad Animated Icons App Bar Audio Message Audio Recorder Autocomplete Avatar Group Balance Display Bar List Barcode Before After Biometric Gate Bloom Menu Bottom Sheet Paywall Sheet Side Sheet Breadcrumb Calendar Calendar Strip Card Carousel Cart Item Character Charts Chat Composer Chat List Item Choice Card Circle Reveal Coach Marks Collapsible Collapsible Header Color Picker Combobox Command Palette Comment Thread Confetti Consent Sheet Context Menu Copy Field Country Picker Coupon Input Currency Input Data Table Date Range Picker Day Schedule Dialog Dock Donut Chart Drawer Driver Card Dropdown Menu Drum Picker Emoji Picker Empty State Error State Event Card Expandable Control Fader Feature Gate File Picker Filter Bar Follow Button Form Gauge Glass Glass Cluster Glass Dock Morph Glass Fab Morph Glass Lab Glass Orb Glass Search Morph Glass Sheet Edge Gradient Button Headline New Heatmap Image Cropper Image Viewer Kanban Card Keyboard Avoiding Keyboard Toolbar Leaderboard Level Progress Lightbox Like Button Line Chart List Reorderable List Swipeable Row Location Card Location Search Map Sheet Map View Markdown View Media Controls Media Picker Media Tile Mention Input Meter Bar Mini Player Mood Slider Morphing Modal Multi Select Navigation Rail Notification Item Number Input Onboarding Pager Order Card Order Summary OTP Input Pagination Paper Clip New Parallax Header Pass Card Password Strength Payment Button Payment Card Payment Method Permission Primer Phone Input PIN Pad Polaroid New Poll Popover Post Card Postage Stamp New Price Tag Pricing Table Product Card Product Gallery Profile Header Promo Banner Prompt Input Property Card Pull To Refresh QR Code Quick Actions Quick Replies Rating Summary Reaction Picker Resend Timer Review Card Review Prompt Ride Option Save Button Scan Frame Scroll Spy Tabs Seat Map Section Header Section Index Segmented Control Select Share Button Share Sheet Shutter Button Signature Pad Slide to Confirm Slot Picker Smart Banner Social Login Button Sparkline Splash Screen Split Button Stat Card Stateful Button Status Dot Step Flow Steps Sticker New Stopwatch Stories Progress Stories Viewer Story Ring Streak Counter Streaming Text Success Seal Swipe Deck Tabs Tag Input Tape New Text Reveal Thinking Indicator Time Picker Timeline Timer Ring Tip Selector Toast Toolbar Tooltip Track Row Transaction Row Trip Progress Variant Picker Video Controls Waveform Weather Card Weekday Picker Zoom TransitionScreens
Account Switcher Biometric Setup Delete Account Forgot Password Grow Auth Login Login — Dark Stage Login — Dense Work Login — Editorial Login — Illustrated Login — Minimal Ink Login — Social Login — Video Loop Food Onboarding Onboarding Onboarding Dark Objects Onboarding Editorial Onboarding Illustrated Onboarding Personalize Onboarding Photo Carousel OTP Verification Passkey — Create Password Reset Permission — Notifications Phone Verification Onboarding Quiz Session Devices Signup Sign-up Chat Sign-up Photo Sheet Social Auth Split Auth Verify Identity Welcome AI Chat AI Assistant Channels List Chat Info Chat List Chat Media Chat Thread Create Group Group Info Message Requests New Message Kept Messages Accessibility Activity Log Appearance Authenticator Blocked Accounts Export Your Data Downloads Edit Profile Edit Profile — Rows Emergency Call Empty States Set Error State Send Feedback Device Locator Help Center Home — Bento Home — Dark Home — Editorial Home Feed Invite Friends Language & Region Linked Accounts Not Found (404) Notification Settings Notifications Password Vault Paywall Paywall — Comparison Paywall — Dark Stage Paywall — Editorial Paywall — Photo Paywall — Trial Timeline Privacy Profile Profile — Gamified Profile — Minimal Profile — Photo Hero QR Scanner Report Issue Saved Items Phone Time Search Search — Command Palette Search — Visual Account Health Settings Settings — Dark Device Settings — Search Storage & Data Terms & Privacy Dating Chat Dating Filters Profile Discover Its A Match Into You Matches Profile Detail Profile Editor Courier Matching Delivery History Delivery Support Package Schedule Parcel Tracking Proof Of Delivery Quick Aisle Quick Home Send Package Substitutions Add Payment Address Book Cart Categories Checkout Checkout — Steps Checkout Success Delivery Filters & Sort Flash Sale Gift Cards Loyalty Points Order Cancel Order Detail Orders Pay Later Checkout Payment Methods Product Detail Product Detail — Hero Product Grid Product Reviews Promo Codes Recently Viewed Return Items Search Results Shop Assistant Store Home Tip & Rate Courier Order Tracking Wishlist Write a Review Event Checkin Event Hero Events Discover My Tickets Seat Selection Ticket Checkout Add Card Bank Accounts Dashboard — Bento Bill Pay Budgets Card Details Crypto Portfolio Finance Dashboard Dashboard — Dark Exchange Currency Expense List Invoice Detail Manage Cards Plan Management Savings Goals Send Money Spending Analytics Split Bill Subscriptions Token Detail Token Swap Transactions Wallet Home Wallet Movers Courier Tracking Food Cart Food Home Food Orders Grocery List Recipe Detail Restaurant — Dark Restaurant Detail Activity Rings Fitness Home Habit Quest Habit Tracker Meal Planner Med Store Meditation Player Mood Check-in Nutrition Home Period Tracker Prior Auth Prior Auth Cases Quest Complete Run Tracking Rx Scan Sleep Tracker Telehealth Booking Walk Map Water Tracker Workout Complete Workout Detail Workout Session Applications Apply Company Interview Schedule Job Detail Job Feed Resume Saved Jobs Create Listing Item Chat Listing Detail Make Offer Market Checkout Market Home Market Search My Listings Offers Inbox Seller Profile Audiobook Player Camera Gallery Albums Game Store Mini Player Music Player Photo Editor Photo Gallery Playlist Detail Podcast Player Clips Feed Serene Home Sound Mixer Stories Video Call Video Player Article Reader Course Detail Event Detail Memory Onboarding Icon Lab Leaderboard Lesson Player Match Detail News Editorial News Home Plant Care Prediction Live Prediction Welcome Smart Home Standings Ticket Wallet Topics Follow Weather Detail Add Task Sheet Alarm Clock Calendar Day Calendar Month Doc Scanner File Manager Focus Timer Journal Kanban Board Mail Inbox Mail Thread Note Editor Notes List Reminders Task List Time Blocks Agent Profile Compare Homes Mortgage Calculator Property Detail Rental Application Saved Homes Schedule Tour Search List Search Map Complete Destination Driver Arriving Ev Charging History Home In Trip Matching Options Parking Receipt Safety Schedule Scooter Unlock Booking Confirmed Booking Review Booking Slots My Bookings Pro On The Way Provider Detail Provider List Rate Service Services Home Arc Create Arc Detail Arc Onboarding Avatar Creator Comments Sheet Create Post Explore Grid Followers List Hashtag Feed Mentions Post Detail Post Hero Social Profile Boarding Pass Booking Confirm Car Rental Trip Discover Flight Live Flight Preferences Flight Results Flight Search Hotel Detail Live Transit Trip — Map Day Trip — Rideshare Request Seat Select Travel Home Trip Itinerary Trip OnboardingNothing matches — try another word.
Status Dot
Presence and live indicator where away, offline and do-not-disturb have their own shapes, not just colours. Comes as a plain dot, a dot with a cut-out edge for avatars, or a labelled pill.
Preview
import * as React from "react";
import { forwardRef } from "react";
import { Text, View, type LayoutChangeEvent, type ViewProps } from "react-native";
import Animated, {
Easing,
cancelAnimation,
useAnimatedStyle,
useSharedValue,
withRepeat,
withSpring,
withTiming,
} from "react-native-reanimated";
import { Sheen, cn, createVariant, ease, spring, tempo, timing, useReducedMotion } from "@lumioui/core";
/**
* StatusDot — presence and live indicators, drawn as light.
* <StatusDot status="online" />
* <StatusDot status="dnd" ring /> // cut out of an avatar
* <StatusDot status="away" variant="pill" /> // dot + "Away"
* <StatusDot status="live" variant="pill" /> // red "Live" pill, breathing
* <StatusDot status="online" glow /> // lit point with a faint halo
*
* Each status has its own SHAPE as well as colour (team-chat idiom) so it
* never relies on colour alone: online is a filled disc, away a hollow amber
* ring, busy a filled red disc, do-not-disturb a red disc with a bar,
* offline a hollow grey ring, live a red disc.
*
* Motion: the dot is at rest on first paint (a list of avatars never flashes
* on mount). A status change swaps in place — the old shape dims to 0.96 on
* timing.recede while the new one ignites over timing.fast, 0.96 → 1 on
* spring.swap. In the pill, the width springs to the measured new label and
* going live is the pill's own act: the red fill switches on, the label
* ignites inside, one sheen crosses it. Only `live` loops — a slow luminance
* breath (a real on-air state); stop it with `animate={false}` off-screen.
* Reduced motion keeps the fades and the breath, drops scale and width springs.
* Expo Go compatible.
*/
export type PresenceStatus = "online" | "away" | "busy" | "dnd" | "offline" | "live";
/** Diameter per size, in pt. */
const DIAMETER = { xs: 8, sm: 10, md: 12, lg: 14 } as const;
/** Swap in place — outgoing dims to this scale, incoming grows from it. */
const SWAP_SCALE = 0.96;
const IGNITE = { duration: timing.fast.duration, easing: Easing.bezier(...ease.out) };
const DIM = { duration: timing.recede.duration, easing: Easing.bezier(...ease.in) };
/** Live breath — each half on tempo.roll × 1.5 (~0.9s, a ~1.8s breath):
* slow enough to stay below notice, never read as an alarm. */
const BREATH = { duration: tempo.roll * 1.5, easing: Easing.bezier(...ease.inOut) };
const BREATH_LOW = 0.7;
/** `glow`: the online halo — a faint pool of the dot's own light. */
const HALO_SPREAD = 6;
const HALO_ALPHA = 0.25;
/** `glow`: away/offline read as unlit filaments. */
const FILAMENT = 0.7;
const DEFAULT_LABEL: Record<PresenceStatus, string> = {
online: "Active",
away: "Away",
busy: "Busy",
dnd: "Do not disturb",
offline: "Offline",
live: "Live",
};
/** Fill/stroke per status. Hollow statuses draw a border instead of a fill. */
const dotVariants = createVariant({
base: "items-center justify-center rounded-full",
variants: {
status: {
online: "bg-success",
away: "border-warning bg-transparent",
busy: "bg-destructive",
dnd: "bg-destructive",
offline: "border-muted-foreground bg-transparent",
live: "bg-destructive",
},
},
defaultVariants: { status: "online" },
});
/** Pill row (padding + gap live on the row so a measuring copy matches it). */
const rowVariants = createVariant({
base: "flex-row items-center",
variants: {
size: {
xs: "h-6 gap-1.5 px-2",
sm: "h-6 gap-1.5 px-2.5",
md: "h-7 gap-2 px-3",
lg: "h-8 gap-2 px-3",
},
},
defaultVariants: { size: "sm" },
});
const PILL_H = { xs: "h-6", sm: "h-6", md: "h-7", lg: "h-8" } as const;
export interface StatusDotProps extends Omit<ViewProps, "className" | "children"> {
/** Presence or live state. Default "online". */
status?: PresenceStatus;
/** Dot diameter — xs 8 · sm 10 · md 12 · lg 14. Default "sm". */
size?: keyof typeof DIAMETER;
/** "dot" renders the bare indicator; "pill" pairs it with a text label. Default "dot". */
variant?: "dot" | "pill";
/** Pill text. Defaults to the status name ("Active", "Away", "Live"…). */
label?: string;
/** Surface-coloured cut-out ring so the dot reads as punched out of an
* avatar or thumbnail. Default false. */
ring?: boolean;
/** Ring classes — border AND fill matching the surface the dot sits on
* (the fill shows through hollow away/offline rings). Default "border-card bg-card". */
ringClassName?: string;
/** Run the live breath. Defaults to true for `live`; ignored for other statuses.
* Set false when the row is off-screen or the stream is paused. */
animate?: boolean;
/** Status as light: online gets a faint halo of its own light, away and
* offline dim to unlit filaments. Default false. */
glow?: boolean;
/** Screen-reader label. Defaults to the status label ("Active"). */
accessibilityLabel?: string;
className?: string;
/** Extra classes for the pill label. */
textClassName?: string;
}
/** Slow luminance breath while a live state sits behind it. */
function useBreath(active: boolean) {
const v = useSharedValue(1);
React.useEffect(() => {
if (!active) {
cancelAnimation(v);
v.value = withTiming(1, IGNITE);
return;
}
v.value = 1;
v.value = withRepeat(withTiming(BREATH_LOW, BREATH), -1, true);
return () => cancelAnimation(v);
}, [active, v]);
return useAnimatedStyle(() => ({ opacity: v.value }));
}
function Glyph({
status,
d,
onFill,
breathing,
glow,
}: {
status: PresenceStatus;
d: number;
onFill: boolean;
breathing: boolean;
glow: boolean;
}) {
const hollow = status === "away" || status === "offline";
const breath = useBreath(breathing);
const halo = d + HALO_SPREAD;
return (
<View style={{ width: d, height: d }} className="items-center justify-center">
{glow && status === "online" ? (
<View
pointerEvents="none"
style={{ position: "absolute", width: halo, height: halo, borderRadius: halo / 2, opacity: HALO_ALPHA }}
className="bg-success"
/>
) : null}
<Animated.View style={breath}>
<View
style={{
width: d,
height: d,
borderWidth: hollow ? Math.max(2, Math.round(d / 4.5)) : 0,
opacity: glow && hollow ? FILAMENT : 1,
}}
className={cn(dotVariants({ status }), onFill && "bg-destructive-foreground")}
>
{status === "dnd" ? (
<View
className="rounded-full bg-destructive-foreground"
style={{ width: Math.round(d * 0.55), height: Math.max(2, Math.round(d / 5)) }}
/>
) : null}
</View>
</Animated.View>
</View>
);
}
interface Face {
status: PresenceStatus;
text: string;
width: number;
}
export const StatusDot = forwardRef<React.ElementRef<typeof View>, StatusDotProps>(
function StatusDot(
{
status = "online",
size = "sm",
variant = "dot",
label,
ring = false,
ringClassName = "border-card bg-card",
animate = true,
glow = false,
accessibilityLabel,
className,
textClassName,
...props
},
ref
) {
const reduce = useReducedMotion();
const d = DIAMETER[size];
const isLive = status === "live";
const text = label ?? DEFAULT_LABEL[status];
const inPill = variant === "pill";
// ── Swap in place ────────────────────────────────────────────────────
// Rests at full on mount; the motion marks a status CHANGE only (a label
// that ticks — "Live · 0:42" — updates in place without a swap).
const [measuredW, setMeasuredW] = React.useState(0);
const [outgoing, setOutgoing] = React.useState<Face | null>(null);
const [sheen, setSheen] = React.useState(0);
const last = React.useRef<Face>({ status, text, width: measuredW });
const inOn = useSharedValue(1);
const inGrow = useSharedValue(1);
const outT = useSharedValue(1);
const liveFill = useSharedValue(isLive ? 1 : 0);
const outTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);
React.useEffect(() => {
const prev = last.current;
last.current = { status, text, width: measuredW };
if (prev.status === status) return;
setOutgoing(prev);
inOn.value = 0;
inOn.value = withTiming(1, IGNITE);
inGrow.value = reduce ? 1 : SWAP_SCALE;
if (!reduce) inGrow.value = withSpring(1, spring.swap);
outT.value = 0;
outT.value = withTiming(1, DIM);
liveFill.value = withTiming(isLive ? 1 : 0, isLive ? IGNITE : DIM);
// Going live is the pill's act — one light pass crosses it.
if (isLive && inPill) setSheen((n) => n + 1);
if (outTimer.current) clearTimeout(outTimer.current);
outTimer.current = setTimeout(() => setOutgoing(null), DIM.duration);
}, [status, text, measuredW, isLive, inPill, reduce, inOn, inGrow, outT, liveFill]);
React.useEffect(
() => () => {
if (outTimer.current) clearTimeout(outTimer.current);
},
[]
);
const inStyle = useAnimatedStyle(() => ({
opacity: inOn.value,
transform: [{ scale: inGrow.value }],
}));
const outStyle = useAnimatedStyle(() => ({
opacity: 1 - outT.value,
transform: reduce ? [] : [{ scale: 1 - (1 - SWAP_SCALE) * outT.value }],
}));
// ── Pill width: spring to the measured label ─────────────────────────
const width = useSharedValue(0);
React.useEffect(() => {
if (!measuredW) return;
// First measure lands; later ones spring (or land, under reduced motion).
width.value = width.value === 0 || reduce ? measuredW : withSpring(measuredW, spring.swap);
}, [measuredW, reduce, width]);
const widthStyle = useAnimatedStyle(() => (width.value > 0 ? { width: width.value } : {}));
const fillStyle = useAnimatedStyle(() => ({ opacity: liveFill.value }));
const onMeasure = (e: LayoutChangeEvent) => {
const w = Math.ceil(e.nativeEvent.layout.width);
if (w !== measuredW) setMeasuredW(w);
};
const a11y = {
accessible: true,
accessibilityRole: "text" as const,
accessibilityLabel: accessibilityLabel ?? text,
};
if (inPill) {
const row = (face: { status: PresenceStatus; text: string }, breathing: boolean) => {
const live = face.status === "live";
return (
<>
<Glyph status={face.status} d={d} onFill={live} breathing={breathing} glow={glow} />
<Text
numberOfLines={1}
className={cn(
"text-xs font-semibold",
live ? "text-destructive-foreground" : "text-secondary-foreground",
textClassName
)}
>
{face.text}
</Text>
</>
);
};
// Rows sit absolutely once the pill is measured, at their own widths,
// so a growing pill clips its label instead of squeezing it.
const placed = measuredW > 0;
return (
<Animated.View
ref={ref}
className={cn("self-start overflow-hidden rounded-full bg-secondary", PILL_H[size], className)}
// The JS width holds the frame the rows go absolute; the spring
// drives it from then on.
style={[placed ? { width: measuredW } : null, widthStyle]}
{...a11y}
{...props}
>
<Animated.View
pointerEvents="none"
className="absolute bottom-0 left-0 right-0 top-0 bg-destructive"
style={fillStyle}
/>
{/* Measuring copy — the width the pill springs to. */}
<View
pointerEvents="none"
style={{ position: "absolute", left: 0, top: 0, width: 1000, opacity: 0 }}
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
>
<View className={cn(rowVariants({ size }), "self-start")} onLayout={onMeasure}>
{row({ status, text }, false)}
</View>
</View>
<Animated.View
className={rowVariants({ size })}
style={[placed ? { position: "absolute", left: 0, top: 0, width: measuredW } : null, inStyle]}
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
>
{row({ status, text }, isLive && animate)}
</Animated.View>
{outgoing ? (
<Animated.View
pointerEvents="none"
className={rowVariants({ size })}
style={[{ position: "absolute", left: 0, top: 0, width: outgoing.width || undefined }, outStyle]}
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
>
{row(outgoing, false)}
</Animated.View>
) : null}
<Sheen run={sheen} />
</Animated.View>
);
}
return (
<View
ref={ref}
className={cn(
"items-center justify-center self-start rounded-full",
ring && cn("border-2", ringClassName),
className
)}
{...a11y}
{...props}
>
<View
style={{ width: d, height: d }}
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
>
<Animated.View style={inStyle}>
<Glyph status={status} d={d} onFill={false} breathing={isLive && animate} glow={glow} />
</Animated.View>
{outgoing ? (
<Animated.View pointerEvents="none" style={[{ position: "absolute", left: 0, top: 0 }, outStyle]}>
<Glyph status={outgoing.status} d={d} onFill={false} breathing={false} glow={glow} />
</Animated.View>
) : null}
</View>
</View>
);
}
);
StatusDot.displayName = "StatusDot"; import { StatusDot } from "@/components/ui/status-dot/status-dot";
export function Example() {
return (
<StatusDot />
);
} Installation
Install the dependencies
npx expo install react-native-reanimatedCopy the source from the Code tab into your project
components/ui/status-dot/status-dot.tsxcomponents/ui/status-dot/index.tsUpdate the import paths to match your project setup.
Usage
import { StatusDot } from "@/components/ui/status-dot/status-dot"; <StatusDot /> Examples
A creator app's live tab.
import * as React from "react";
import { View } from "react-native";
import { Accent } from "@lumioui/core";
import { StatusDot } from "../status-dot";
import { Avatar } from "../../avatar/avatar";
import { Button } from "../../button/button";
import { Image } from "../../image/image";
import { Icon } from "../../icon/icon";
import { Text } from "../../text/text";
const STREAMS = [
{
title: "Vinyl Sunday: deep house from Detroit",
host: "Nadia Rahm",
viewers: "2.4K",
img: "https://images.unsplash.com/photo-1541296481353-b1eb3a4e0309?w=600&h=400&fit=crop&q=70&auto=format",
avatar: 25,
},
{
title: "Morning breathwork, 20 minutes",
host: "Calder Studio",
viewers: "812",
img: "https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=600&h=400&fit=crop&q=70&auto=format",
avatar: 44,
},
];
/** StatusDotLive — a creator app's live tab. Thumbnails wear the red Live
* pill whose dot breathes slowly (a real on-air state, so the loop is
* earned). Your own channel starts offline; Go live and the grey pill
* becomes the red one in place — it widens to "Live · 0:00", the fill
* switches on and one sheen crosses it. */
export function StatusDotLive() {
const [onAir, setOnAir] = React.useState(false);
const [secs, setSecs] = React.useState(0);
React.useEffect(() => {
if (!onAir) return;
setSecs(0);
const id = setInterval(() => setSecs((s) => s + 1), 1000);
return () => clearInterval(id);
}, [onAir]);
const clock = `${Math.floor(secs / 60)}:${String(secs % 60).padStart(2, "0")}`;
return (
<Accent color="pink" className="w-full">
<View className="w-full gap-6">
<View className="flex-row items-center gap-3 rounded-2xl bg-card p-4">
<View className="h-14 w-14">
<Avatar size="lg" source={{ uri: "https://i.pravatar.cc/150?img=5" }} alt="Your channel" />
<StatusDot
status={onAir ? "live" : "offline"}
size="lg"
ring
className="absolute -bottom-0.5 -right-0.5"
/>
</View>
<View className="flex-1 gap-1">
<Text className="text-[17px] font-semibold">Studio Halvorsen</Text>
<StatusDot
status={onAir ? "live" : "offline"}
variant="pill"
label={onAir ? `Live · ${clock}` : "Offline"}
textClassName="tabular-nums"
/>
</View>
<Button size="sm" variant={onAir ? "secondary" : "default"} onPress={() => setOnAir((v) => !v)}>
{onAir ? "End" : "Go live"}
</Button>
</View>
<View className="gap-3">
<Text className="px-1 text-[17px] font-semibold">Live now</Text>
{STREAMS.map((s) => (
<View key={s.title} className="gap-3">
<View className="overflow-hidden rounded-2xl">
<Image source={{ uri: s.img }} aspectRatio={16 / 9} rounded="2xl" alt="" />
<View className="absolute left-3 top-3 flex-row items-center gap-2">
<StatusDot status="live" variant="pill" />
<View className="h-6 flex-row items-center gap-1 rounded-full bg-black/55 px-2">
<Icon name="eye" size="sm" color="#FFFFFF" />
<Text className="text-xs font-semibold text-white tabular-nums">{s.viewers}</Text>
</View>
</View>
</View>
<View className="flex-row items-center gap-3 px-1">
<Avatar size="sm" source={{ uri: `https://i.pravatar.cc/150?img=${s.avatar}` }} alt="" />
<View className="flex-1">
<Text className="text-[15px] font-medium" numberOfLines={1}>{s.title}</Text>
<Text variant="muted">{s.host}</Text>
</View>
</View>
</View>
))}
</View>
</View>
</Accent>
);
} A team chat's "set your status" sheet.
import * as React from "react";
import { View } from "react-native";
import { StatusDot, type PresenceStatus } from "../status-dot";
import { Avatar } from "../../avatar/avatar";
import { Form } from "../../form/form";
import { Icon } from "../../icon/icon";
import { Text } from "../../text/text";
const OPTIONS: { status: PresenceStatus; label: string; note: string }[] = [
{ status: "online", label: "Active", note: "Notifications on" },
{ status: "away", label: "Away", note: "Shown after 10 min idle" },
{ status: "dnd", label: "Do not disturb", note: "Until 4:00 PM" },
{ status: "offline", label: "Appear offline", note: "Messages still arrive" },
];
const TEAM: { name: string; note: string; img: number; status: PresenceStatus }[] = [
{ name: "Mara Okafor", note: "Reviewing the onboarding flow", img: 47, status: "online" },
{ name: "Jonas Lindqvist", note: "In a meeting until 3:30", img: 12, status: "dnd" },
{ name: "Sofia Brandt", note: "Back from lunch at 2", img: 32, status: "away" },
{ name: "Kenji Watanabe", note: "Last seen yesterday", img: 59, status: "offline" },
];
function Person({ img, status }: { img: number; status: PresenceStatus }) {
return (
<View className="h-10 w-10">
<Avatar size="md" source={{ uri: `https://i.pravatar.cc/150?img=${img}` }} alt="" />
<StatusDot status={status} size="sm" ring glow className="absolute -bottom-0.5 -right-0.5" />
</View>
);
}
/** StatusDotPresence — a team chat's "set your status" sheet. Pick a row and
* your own dot swaps to the new shape in place (the old one dims as the new
* one switches on) while the pill re-sizes to its label. Statuses read as
* light: active is a lit point with a faint halo, away and offline are
* unlit filaments — shape + colour, never colour alone. */
export function StatusDotPresence() {
const [mine, setMine] = React.useState<PresenceStatus>("online");
const current = OPTIONS.find((o) => o.status === mine)!;
return (
<View className="w-full">
<View className="w-full gap-6">
<View className="flex-row items-center gap-3 px-1">
<View className="h-14 w-14">
<Avatar size="lg" source={{ uri: "https://i.pravatar.cc/150?img=68" }} alt="Your photo" />
<StatusDot status={mine} size="lg" ring glow className="absolute -bottom-0.5 -right-0.5" />
</View>
<View className="flex-1 gap-1">
<Text className="text-lg font-semibold">Theo Marchetti</Text>
<StatusDot status={mine} variant="pill" label={current.label} />
</View>
</View>
<View className="gap-2">
<Text className="px-4 text-[13px] text-muted-foreground">Set yourself as</Text>
<View className="overflow-hidden rounded-2xl bg-card">
{OPTIONS.map((o, i) => (
<React.Fragment key={o.status}>
{i > 0 ? <Form.Separator className="ml-12" /> : null}
<Form.Row
label={o.label}
description={o.note}
leading={
<View className="w-5 items-center">
<StatusDot status={o.status} size="md" />
</View>
}
trailing={
mine === o.status ? <Icon name="check" size="sm" color="primaryText" /> : null
}
onPress={() => setMine(o.status)}
accessibilityRole="radio"
accessibilityState={{ selected: mine === o.status }}
/>
</React.Fragment>
))}
</View>
</View>
<View className="gap-2">
<Text className="px-4 text-[13px] text-muted-foreground">Design team</Text>
<View className="overflow-hidden rounded-2xl bg-card">
{TEAM.map((p, i) => (
<React.Fragment key={p.name}>
{i > 0 ? <Form.Separator className="ml-16" /> : null}
<View className="flex-row items-center gap-3 px-4 py-3">
<Person img={p.img} status={p.status} />
<View className="flex-1">
<Text className="text-[15px] font-medium">{p.name}</Text>
<Text variant="muted" numberOfLines={1}>{p.note}</Text>
</View>
</View>
</React.Fragment>
))}
</View>
</View>
</View>
</View>
);
} An infrastructure status page.
import * as React from "react";
import { View } from "react-native";
import { StatusDot, type PresenceStatus } from "../status-dot";
import { Button } from "../../button/button";
import { Text } from "../../text/text";
type Health = "operational" | "degraded" | "outage" | "maintenance";
/** Service health mapped onto presence shapes: filled green, hollow amber,
* filled red, hollow grey — readable without colour. */
const DOT: Record<Health, PresenceStatus> = {
operational: "online",
degraded: "away",
outage: "busy",
maintenance: "offline",
};
const LABEL: Record<Health, string> = {
operational: "Operational",
degraded: "Degraded",
outage: "Outage",
maintenance: "Maintenance",
};
const BEFORE: { name: string; health: Health; note?: string }[] = [
{ name: "Payments API", health: "operational" },
{ name: "Webhooks", health: "degraded", note: "Deliveries delayed ~4 min" },
{ name: "Payouts", health: "outage", note: "SEPA transfers failing" },
{ name: "Dashboard", health: "operational" },
{ name: "Search index", health: "maintenance", note: "Reindex until 02:00 UTC" },
];
const AFTER: typeof BEFORE = BEFORE.map((s) =>
s.name === "Webhooks" || s.name === "Payouts" ? { name: s.name, health: "operational" } : s
);
/** StatusDotSystem — an infrastructure status page. Incidents use the same
* shape vocabulary as presence; tap Refresh and resolved services swap back
* in place to a filled green dot while the header recounts. */
export function StatusDotSystem() {
const [resolved, setResolved] = React.useState(false);
const services = resolved ? AFTER : BEFORE;
const issues = services.filter((s) => s.health === "degraded" || s.health === "outage").length;
const refresh = async () => {
await new Promise((r) => setTimeout(r, 900));
setResolved((v) => !v);
};
return (
<View className="w-full gap-6">
<View className="gap-2 px-1">
<View className="flex-row items-center gap-2">
<StatusDot status={issues ? "away" : "online"} size="lg" />
<Text className="text-2xl font-bold tracking-tight">
{issues ? `${issues} services affected` : "All systems normal"}
</Text>
</View>
<Text variant="muted">Ledgerline status · updated {resolved ? "just now" : "6 min ago"}</Text>
</View>
<View className="overflow-hidden rounded-2xl bg-card">
{services.map((s, i) => (
<View
key={s.name}
className={`flex-row items-center gap-3 px-4 py-3.5 ${i > 0 ? "border-t border-border" : ""}`}
accessible
accessibilityLabel={`${s.name}, ${LABEL[s.health]}${s.note ? `, ${s.note}` : ""}`}
>
<View className="flex-1">
<Text className="text-base font-medium">{s.name}</Text>
{s.note ? <Text variant="muted" numberOfLines={1}>{s.note}</Text> : null}
</View>
<StatusDot status={DOT[s.health]} variant="pill" label={LABEL[s.health]} />
</View>
))}
</View>
<Button size="lg" variant="secondary" className="w-full" onPress={refresh}>
Refresh
</Button>
</View>
);
} API reference
status PresenceStatus Presence or live state. Default "online".
"online" size keyof typeof DIAMETER Dot diameter — xs 8 · sm 10 · md 12 · lg 14. Default "sm".
"sm" variant "dot" | "pill" "dot" renders the bare indicator; "pill" pairs it with a text label. Default "dot".
"dot" label string Pill text. Defaults to the status name ("Active", "Away", "Live"…).
—ring boolean Surface-coloured cut-out ring so the dot reads as punched out of an avatar or thumbnail. Default false.
false ringClassName string Ring classes — border AND fill matching the surface the dot sits on (the fill shows through hollow away/offline rings). Default "border-card bg-card".
"border-card bg-card" animate boolean Run the live breath. Defaults to true for live; ignored for other statuses. Set false when the row is off-screen or the stream is paused.
true glow boolean Status as light: online gets a faint halo of its own light, away and offline dim to unlit filaments. Default false.
false accessibilityLabel string Screen-reader label. Defaults to the status label ("Active").
—className string — textClassName string Extra classes for the pill label.
—