Updated
Notification Stack
- Maya ChennowPushed the new tab bar, take a look
Customize
Visible2
Peek12px
Gap10px
Blur24px
Installation
npx shadcn@latest add https://uibrik.com/r/notification-stack.jsonInstall the packages
npm install motionAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/notification-stack/notification-stack.tsx"use client"; import { useEffect, useRef, useState, type ReactNode } from "react"; import { AnimatePresence, animate, motion, useMotionValue, useReducedMotion, useTransform, type PanInfo, type Variants, } from "motion/react"; import { cn } from "@/lib/utils"; // Notification stack. Notifications pile up as panes of frosted glass, the // newest in front and older ones tucked behind it, each a little smaller and // fainter. Hovering (or tabbing in) fans the pile into a list. Swiping one // sideways blurs and fades it as it goes; let go past the threshold and it // flies off, otherwise it springs back. // // Fades live on the glass itself, never on a wrapper: an ancestor with // opacity below 1 becomes the glass's backdrop root, and the frost goes clear.
Adds the files to
components/uibrik/notification-stack and installs motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/notification-stack.Usage
import { NotificationStack } from "@/components/uibrik/notification-stack/notification-stack";const notifications = [ { id: 1, title: "Maya Chen", body: "Pushed the new tab bar, take a look", time: "now" }, { id: 2, title: "Design review", body: "Starts in 10 minutes · Room 4", time: "2m" },];<NotificationStack notifications={notifications} visible={2} peek={12} gap={10} blur={24} expanded={false} onDismiss={(id) => {}}/>Where to use Notification Stack
Desktop-style alerts
Notifications piling up as frosted glass panes echo macOS.
Pairs with Toast
Live dashboard updates
Fanning out on hover lets users read several alerts without opening a panel.
Landing page demos
Blurring away when swiped shows a product's notification feature in action.
Props
NotificationStack- visible
- Type number
- 2
- Notifications peeking out behind the front one.
- peek
- Type number
- 12
- How far each one behind peeks out.
- gap
- Type number
- 10
- Gap between notifications when fanned out.
- blur
- Type number
- 24
- Backdrop blur of the glass.
- expanded
- Type boolean
- false
- Fan the stack out even without hover.
- notificationsrequired
- Type { id; title; body?; icon?; time? }[]
- –
- Newest first.
- onDismiss
- Type (id) => void
- –
- Called when one is swiped away or its close button pressed. Remove it from the list here.
- className
- Type string
- –
- Classes for the list.