BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/indiacn/toast

Toast

indiacn/toast
FreeComponent

Notification toast with provider, hook, container, and theme variants.

Install it

npx shadcn@latest add https://indiacn.in/r/toast.json

Source

components/ui/toast.tsxindiacn.in/r/toast.json
1'use client';
2/* eslint-disable eslint-frontend-rules/top-level-const-snake */
3
4import { cva, type VariantProps } from 'class-variance-authority';
5import { X } from 'lucide-react';
6import { ComponentProps, createContext, useCallback, useContext, useState } from 'react';
7
8import { cn } from '@/lib/utils';
9
10/*
11 * UX4G toast: max-width 350px, font-size 0.875rem, border-radius 0.5rem,
12 * border 1px solid neutral-200,
13 * shadow: 0px 4px 6px -2px rgba(33,33,33,0.03), 0px 12px 16px -4px rgba(33,33,33,0.08).
14 * Header: padding 0.75rem, NO border-bottom. Body: padding 0.75rem.
15 */
16const TOAST_VARIANTS = cva(
17 'pointer-events-auto relative flex w-[350px] max-w-full items-center justify-between overflow-hidden rounded-lg border p-3 text-sm shadow-lg transition-all',
18 {
19 variants: {
20 theme: {
21 default: 'bg-neutral-0 text-neutral border-neutral-200',
22 primary: 'bg-primary text-neutral-0 border-transparent',
23 secondary: 'bg-secondary text-neutral-0 border-transparent',
24 success: 'bg-success text-neutral-0 border-transparent',
25 danger: 'bg-danger text-neutral-0 border-transparent',
26 warning: 'bg-warning text-neutral-0 border-transparent',
27 info: 'bg-info text-neutral-0 border-transparent',
28 },
29 },
30 defaultVariants: {
31 theme: 'default',
32 },
33 },
34);
35
36type TToastTheme = NonNullable<VariantProps<typeof TOAST_VARIANTS>['theme']>;
37
38interface IToast {
39 id: string;
40 title?: string;
41 description?: string;
42 theme?: TToastTheme;
43 duration?: number;
44}
45
46interface IToastContext {
47 toasts: IToast[];
48 addToast: (toast: Omit<IToast, 'id'>) => void;
49 removeToast: (id: string) => void;
50}
51
52const ToastContext = createContext<IToastContext>({
53 toasts: [],
54 addToast: () => {},
55 removeToast: () => {},
56});
57
58/** Context provider that manages toast state. */
59function ToastProvider({ children }: { children: React.ReactNode }) {
60 const [toasts, setToasts] = useState<IToast[]>([]);
61
62 const addToast = useCallback((toast: Omit<IToast, 'id'>) => {
63 const id = Math.random().toString(36).slice(2);
64 setToasts(prev => [...prev, { ...toast, id }]);
65
66 if (toast.duration !== 0) {
67 setTimeout(() => {
68 setToasts(prev => prev.filter(t => t.id !== id));
69 }, toast.duration ?? 5000);
70 }
71 }, []);
72
73 const removeToast = useCallback((id: string) => {
74 setToasts(prev => prev.filter(t => t.id !== id));
75 }, []);
76
77 return (
78 <ToastContext.Provider value={{ toasts, addToast, removeToast }}>
79// … truncated

What it pulls in

npm packages

  • class-variance-authority
  • lucide-react

Other registry items

  • https://indiacn.in/r/theme.json

Files it writes

  • components/ui/toast.tsx

Facts

Registry
indiacn
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-13
Last confirmed
yesterday

Go to the source

indiacn.in krishnaagarwal1506/Indiacn-ui on GitHub Raw registry item This item as JSON

More from indiacn

All 26 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionindiacnComponentsFree2 deps
AlertalertindiacnComponentsFree2 deps
BadgebadgeindiacnComponentsFree1 dep
BreadcrumbbreadcrumbindiacnComponentsFree1 dep
ButtonbuttonindiacnComponentsFree3 deps
Button Groupbutton-groupindiacnComponentsFreeno deps
CardcardindiacnComponentsFree1 dep
ChipchipindiacnComponentsFree2 deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex