BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/scificn/toast

Toast

scificn/toast
FreeComponent

Toast notifications with useToast hook. STATUS, WARNING, CRITICAL, INFO variants.

Live preview

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

Install it

npx shadcn@latest add https://www.scificn.dev/r/toast.json

Source

ui/toast/toast.tsxwww.scificn.dev/r/toast.json
1import * as React from 'react'
2import * as ToastPrimitive from '@radix-ui/react-toast'
3import { cn } from '@/lib/utils'
4import type { ToastVariant } from './use-toast'
5
6const ToastProvider = ToastPrimitive.Provider
7const ToastViewport = React.forwardRef<
8 React.ElementRef<typeof ToastPrimitive.Viewport>,
9 React.ComponentPropsWithoutRef<typeof ToastPrimitive.Viewport>
10>(({ className, ...props }, ref) => (
11 <ToastPrimitive.Viewport
12 ref={ref}
13 className={cn('fixed bottom-4 right-4 z-[9999] flex flex-col gap-2 w-80', className)}
14 {...props}
15 />
16))
17ToastViewport.displayName = ToastPrimitive.Viewport.displayName
18
19const variantStyles: Record<ToastVariant, { borderColor: string; symbol: string; glow: string }> = {
20 STATUS: { borderColor: 'var(--color-green)', symbol: '◈', glow: 'var(--glow-green)' },
21 WARNING: { borderColor: 'var(--color-amber)', symbol: '⚠', glow: 'var(--glow-amber)' },
22 CRITICAL: { borderColor: 'var(--color-red)', symbol: '✕', glow: 'var(--glow-red)' },
23 INFO: { borderColor: 'var(--color-blue)', symbol: 'ℹ', glow: 'var(--glow-blue)' },
24}
25
26export interface ToastProps
27 extends React.ComponentPropsWithoutRef<typeof ToastPrimitive.Root> {
28 variant?: ToastVariant
29}
30
31const Toast = React.forwardRef<
32 React.ElementRef<typeof ToastPrimitive.Root>,
33 ToastProps
34>(({ className, variant = 'STATUS', children, ...props }, ref) => {
35 const vs = variantStyles[variant]
36 return (
37 <ToastPrimitive.Root
38 ref={ref}
39 className={cn(
40 'relative flex items-start gap-3',
41 'border border-l-[3px] rounded-none',
42 'bg-[var(--surface-raised)]',
43 'p-3',
44 'font-mono',
45 'data-[state=open]:animate-in data-[state=open]:slide-in-from-right-full',
46 'data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right-full',
47 className
48 )}
49 style={{
50 borderColor: 'var(--border)',
51 borderLeftColor: vs.borderColor,
52 boxShadow: vs.glow,
53 }}
54 {...props}
55 >
56 <span
57 style={{
58 color: vs.borderColor,
59 fontSize: '0.8rem',
60 lineHeight: 1.5,
61 flexShrink: 0,
62 }}
63 >
64 {vs.symbol}
65 </span>
66 <div style={{ flex: 1, minWidth: 0 }}>{children}</div>
67 <ToastPrimitive.Close
68 style={{
69 background: 'transparent',
70 border: 'none',
71 color: 'var(--text-muted)',
72 cursor: 'pointer',
73// … truncated

What it pulls in

npm packages

  • @radix-ui/react-toast

Facts

Registry
scificn
Type
registry:ui
Access
Free
Files written
0
Licence
the repository states none
First indexed
2026-08-03
Last confirmed
yesterday

Go to the source

Docs on scificn www.scificn.dev baxy5/scificn-ui on GitHub Raw registry item This item as JSON

More from scificn

All 33 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AlertalertscificnComponentsFree1 dep
BadgebadgescificnComponentsFree1 dep
Bar Chartbar-chartscificnComponentsFreeno deps
BreadcrumbbreadcrumbscificnComponentsFreeno deps
ButtonbuttonscificnComponentsFree2 deps
CardcardscificnComponentsFreeno deps
CheckboxcheckboxscificnComponentsFree1 dep
DialogdialogscificnComponentsFree1 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