BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/100xui/notification

Notification

100xui/notification
FreeBlock

A reusable notification component that displays animated messages with smooth slide and scale transitions, perfect for in-app alerts, toasts, and contextual updates.

Live preview

live · rendered by the registry
Rendered by 100xui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://100xui.com/r/notification.json

Source

registry/100xui/blocks/notification/components/notification.tsx100xui.com/r/notification.json
1"use client";
2
3import * as React from "react";
4import {
5 motion,
6 useAnimate,
7 type Transition,
8 type HTMLMotionProps,
9 type MotionStyle,
10} from "motion/react";
11import { XIcon } from "lucide-react";
12
13import { cn } from "@/lib/utils";
14
15interface NotificationContextType {
16 dismissNotification: () => void;
17 showNotification: () => Promise<void>;
18 hideNotification: () => Promise<void>;
19 scope: React.RefObject<HTMLDivElement>;
20 expandedGap: React.CSSProperties["gap"];
21 minVisibleContentHeight: React.CSSProperties["height"];
22 initialContentScale: React.CSSProperties["scale"];
23 slideFromTop: boolean;
24}
25
26const NotificationContext = React.createContext<NotificationContextType | null>(
27 null,
28);
29
30function useNotification() {
31 const ctx = React.useContext(NotificationContext);
32 if (!ctx)
33 throw new Error(
34 "useNotification must be used within Notification Provider",
35 );
36 return ctx;
37}
38
39interface NotificationProps extends React.ComponentProps<"div"> {
40 transition?: Partial<Record<"scale" | "translateY", Transition>>;
41 initialContentScale?: React.CSSProperties["scale"];
42 expandedGap?: React.CSSProperties["gap"];
43 minVisibleContentHeight?: React.CSSProperties["height"];
44 slideContentFrom?: "bottom" | "top";
45}
46
47export function Notification({
48 transition: { scale: scaleTransition, translateY: translateYTransition } = {
49 scale: { ease: "easeOut" },
50 translateY: { ease: "easeOut" },
51 },
52 initialContentScale = 0.95,
53 expandedGap = "calc(var(--spacing) * 2)",
54 minVisibleContentHeight = "calc(var(--spacing) * 2)",
55 onMouseLeave,
56 className,
57 children,
58 slideContentFrom = "top",
59 ...rest
60}: NotificationProps) {
61 const [isRendered, setIsRendered] = React.useState(true);
62 const [scope, animate] = useAnimate();
63 const slideFromTop = slideContentFrom === "top";
64
65 const showNotification = async () => {
66 await animate(scope.current, { y: "0px" }, translateYTransition);
67 await animate(scope.current, { scale: 1 }, scaleTransition);
68 };
69
70 const hideNotification = async () => {
71 await animate(
72 scope.current,
73 { scale: initialContentScale },
74 scaleTransition,
75 );
76 await animate(
77 scope.current,
78 {
79 y: `calc(${slideFromTop ? "1" : "-1"} * (-100% - ${expandedGap} + ${minVisibleContentHeight}))`,
80 },
81 translateYTransition,
82 );
83 };
84
85 const dismissNotification = () => setIsRendered(false);
86
87 return (
88 <>
89 {isRendered && (
90 <NotificationContext.Provider
91// … truncated

What it pulls in

npm packages

  • motion

Files it writes

  • registry/100xui/blocks/notification/components/notification.tsx

Facts

Registry
100xui
Type
registry:block
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-01
Last confirmed
2 days ago

Go to the source

Docs on 100xui 100xui.com YashwantOstwal/100xUI on GitHub Raw registry item This item as JSON

More from 100xui

All 14 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Apple galleryapple-gallery100xuiBlocksFree1 dep
Chat bento cardchat-bento-card100xuiBlocksFree1 dep
demosdemos100xuiBlocksFreeno deps · 12 files
In-page navbarin-page-navbar100xuiBlocksFree1 dep · 2 files
internalsinternals100xuiBlocksFreeno deps · 4 files
iPhone 3D mockupiphone-3d-mockup100xuiBlocksFreeno deps
Menu wheelmenu-wheel100xuiBlocksFree1 dep
Morph modalmorph-modal100xuiBlocksFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex