BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/Kibo UI Registry/dialog-stack

dialog-stack

kibo-ui-registry/dialog-stack
FreeComponent

Composable stacked dialogs, useful for creating a wizard, nested form or multi-step process. It provides a consistent layout and styling for each dialog, and includes navigation component.

Live preview

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

Install it

npx shadcn@latest add https://www.kibo-ui.com/r/dialog-stack.json

Source

index.tsxwww.kibo-ui.com/r/dialog-stack.json · first 6 KB
1"use client";
2
3import { useControllableState } from "@radix-ui/react-use-controllable-state";
4import { Portal } from "radix-ui";
5import type {
6 ButtonHTMLAttributes,
7 Dispatch,
8 HTMLAttributes,
9 MouseEvent,
10 MouseEventHandler,
11 ReactElement,
12 SetStateAction,
13} from "react";
14import {
15 Children,
16 cloneElement,
17 createContext,
18 useCallback,
19 useContext,
20 useEffect,
21 useState,
22} from "react";
23import { cn } from "@/lib/utils";
24
25type DialogStackContextType = {
26 activeIndex: number;
27 setActiveIndex: Dispatch<SetStateAction<number>>;
28 totalDialogs: number;
29 setTotalDialogs: Dispatch<SetStateAction<number>>;
30 isOpen: boolean;
31 setIsOpen: Dispatch<SetStateAction<boolean>>;
32 clickable: boolean;
33};
34
35const DialogStackContext = createContext<DialogStackContextType>({
36 activeIndex: 0,
37 setActiveIndex: () => {},
38 totalDialogs: 0,
39 setTotalDialogs: () => {},
40 isOpen: false,
41 setIsOpen: () => {},
42 clickable: false,
43});
44
45type DialogStackChildProps = {
46 index?: number;
47};
48
49export type DialogStackProps = HTMLAttributes<HTMLDivElement> & {
50 open?: boolean;
51 clickable?: boolean;
52 onOpenChange?: (open: boolean) => void;
53 defaultOpen?: boolean;
54};
55
56export const DialogStack = ({
57 children,
58 className,
59 open,
60 defaultOpen = false,
61 onOpenChange,
62 clickable = false,
63 ...props
64}: DialogStackProps) => {
65 const [activeIndex, setActiveIndex] = useState(0);
66 const [isOpen, setIsOpen] = useControllableState({
67 defaultProp: defaultOpen,
68 prop: open,
69 onChange: onOpenChange,
70 });
71
72 useEffect(() => {
73 if (onOpenChange && isOpen !== undefined) {
74 onOpenChange(isOpen);
75 }
76 }, [isOpen, onOpenChange]);
77
78 return (
79 <DialogStackContext.Provider
80 value={{
81 activeIndex,
82 setActiveIndex,
83 totalDialogs: 0,
84 setTotalDialogs: () => {},
85 isOpen: isOpen ?? false,
86 setIsOpen: (value) => setIsOpen(Boolean(value)),
87 clickable,
88 }}
89 >
90 <div className={className} {...props}>
91 {children}
92 </div>
93 </DialogStackContext.Provider>
94 );
95};
96
97export type DialogStackTriggerProps =
98 ButtonHTMLAttributes<HTMLButtonElement> & {
99 asChild?: boolean;
100 };
101
102export const DialogStackTrigger = ({
103 children,
104 className,
105 onClick,
106 asChild,
107 ...props
108}: DialogStackTriggerProps) => {
109 const context = useContext(DialogStackContext);
110
111 if (!context) {
112 throw new Error("DialogStackTrigger must be used within a DialogStack");
113 }
114
115// … truncated

What it pulls in

npm packages

  • @radix-ui/react-use-controllable-state
  • radix-ui

Files it writes

  • index.tsx

Facts

Registry
Kibo UI Registry
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

Docs on Kibo UI Registry www.kibo-ui.com Raw registry item This item as JSON

More from Kibo UI Registry

All 41 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
announcementannouncementKibo UI RegistryComponentsFreeno deps
avatar-stackavatar-stackKibo UI RegistryComponentsFreeno deps
bannerbannerKibo UI RegistryComponentsFree2 deps
calendarcalendarKibo UI RegistryComponentsFree3 deps
choiceboxchoiceboxKibo UI RegistryComponentsFree2 deps
code-blockcode-blockKibo UI RegistryComponentsFree5 deps · 2 files
color-pickercolor-pickerKibo UI RegistryComponentsFree3 deps
comboboxcomboboxKibo UI RegistryComponentsFree2 deps
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