Zephora UI

Overlay

Notification

Persistent, rich notification cards stacked in the top-end viewport. Wrap the app in NotificationProvider and call useNotification(); cards stay until closed unless a duration is given.

Import

import { NotificationProvider, useNotification, Notification } from "@zephora/react";

Examples

Firing notifications

`useNotification()` returns `notify(options)`. Notifications are persistent by default; pass `duration` for auto-dismiss.

Action buttons

`actions` renders buttons under the description; `dismiss(id)` closes a card.

Standalone Notification card

Weekly report ready
Your analytics digest for June is available.

API

NotificationProvider props

PropTypeDefaultDescription
maxnumberMaximum number of cards shown at once; older notifications collapse into a "+N more" line. Auto-dismiss timers keep running for collapsed cards.
placement"top-end" | "top-start" | "bottom-end" | "bottom-start""top-end"Viewport corner where notification cards stack.
unstyledbooleanfalseHeadless mode — skips Zephora styling.

useNotification() props

PropTypeDefaultDescription
notify(options)(options: NotificationOptions) => stringShows a notification and returns its id.
update(id, options)(id: string, options: Partial<NotificationOptions>) => voidRe-renders an existing notification in place; restarts the timer if duration is provided.
dismiss(id)(id: string) => voidRemoves the notification with the given id.

useNotification() → notify(options) props

PropTypeDefaultDescription
title *ReactNodeCard heading.
descriptionReactNodeSupporting text under the title.
status"info" | "success" | "warning" | "danger""info"Semantic tone; danger announces assertively.
iconReactNodeOptional leading icon.
actionsArray<{ label: string; onClick: () => void }>Action buttons rendered under the description.
durationnumber | nullnullAuto-dismiss delay in ms. null keeps the card until explicitly closed. The timer runs at the provider level (so it fires even while collapsed behind max) and pauses while the pointer hovers the card.

Notification (standalone) props

PropTypeDefaultDescription
title *ReactNodeCard heading.
descriptionReactNodeSupporting text.
status"info" | "success" | "warning" | "danger""info"Semantic tone.
iconReactNodeOptional leading icon.
actionsArray<{ label: string; onClick: () => void }>Action buttons under the description.
durationnumber | nullnullAuto-dismiss delay in ms (requires onClose); null = persistent.
onClose() => voidRenders the close button and is called on close / when the timer fires.
unstyledbooleanfalseHeadless mode.