BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/fluid-functionalism/dialog

Dialog

fluid-functionalism/dialog
FreeComponent

Animated modal dialog with spring-based scale and opacity transitions. Built on Radix UI Dialog with overlay, header, footer, title, and description sub-components.

Install it

npx shadcn@latest add https://fluidfunctionalism.com/r/dialog.json

Source

registry/radix/dialog.tsxfluidfunctionalism.com/r/dialog.json · first 6 KB
1"use client";
2
3import {
4 createContext,
5 forwardRef,
6 useContext,
7 useEffect,
8 useState,
9 type ComponentPropsWithoutRef,
10 type HTMLAttributes,
11} from "react";
12import * as DialogPrimitive from "@radix-ui/react-dialog";
13import { motion } from "framer-motion";
14import { cn } from "@/lib/utils";
15import { useIcon } from "@/lib/icon-context";
16import { spring, exitFallbackMs } from "@/lib/springs";
17import { useShape } from "@/lib/shape-context";
18import { SurfaceProvider, useSurface } from "@/lib/surface-context";
19import { surfaceClasses } from "@/lib/surface-classes";
20import { Button } from "@/components/ui/button";
21
22const DIALOG_OFFSET = 4;
23
24const DialogOpenContext = createContext(false);
25
26function Dialog({
27 children,
28 open: controlledOpen,
29 defaultOpen,
30 onOpenChange,
31 ...props
32}: DialogPrimitive.DialogProps) {
33 // Internal state always tracks changes, and the consumer's onOpenChange is
34 // notified alongside it — a listener must not replace state handling, or an
35 // uncontrolled dialog with an onOpenChange prop could never open. The Root
36 // below is always controlled by `open`, so defaultOpen seeds our state
37 // instead of being forwarded.
38 const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen ?? false);
39 const open = controlledOpen ?? uncontrolledOpen;
40 const handleOpenChange = (next: boolean) => {
41 setUncontrolledOpen(next);
42 onOpenChange?.(next);
43 };
44
45 return (
46 <DialogOpenContext.Provider value={open}>
47 <DialogPrimitive.Root open={open} onOpenChange={handleOpenChange} {...props}>
48 {children}
49 </DialogPrimitive.Root>
50 </DialogOpenContext.Provider>
51 );
52}
53
54const DialogTrigger = DialogPrimitive.Trigger;
55const DialogClose = DialogPrimitive.Close;
56
57interface DialogContentProps
58 extends ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
59 size?: "sm" | "lg";
60 /** Portal target. When set, the overlay and panel render inside this element
61 * (positioned `absolute`) instead of covering the viewport (`fixed`). Pair
62 * with a `position: relative; overflow: hidden` container — and usually
63 * `<Dialog modal={false}>` — to scope a dialog to a bounded region, e.g. a
64 * docs preview. Defaults to the document body / full-viewport behaviour. */
65 container?: HTMLElement | null;
66}
67
68const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>(
69 ({ className, children, size = "sm", container, ...props }, ref) => {
70 const XIcon = useIcon("x");
71// … truncated

What it pulls in

npm packages

  • framer-motion
  • @radix-ui/react-dialog
  • lucide-react

Other registry items

  • utils
  • https://www.fluidfunctionalism.com/r/springs.json
  • https://www.fluidfunctionalism.com/r/shape-context.json
  • https://www.fluidfunctionalism.com/r/surface-context.json
  • https://www.fluidfunctionalism.com/r/surface-classes.json
  • https://www.fluidfunctionalism.com/r/icon-context.json
  • https://www.fluidfunctionalism.com/r/button.json

Files it writes

  • registry/radix/dialog.tsx

Facts

Registry
fluid-functionalism
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

fluidfunctionalism.com mickadesign/fluid-functionalism on GitHub Raw registry item This item as JSON

More from fluid-functionalism

All 53 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionfluid-functionalismComponentsFree3 deps
Accordion (Base UI)accordion-basefluid-functionalismComponentsFree3 deps
Ask User Questionsask-user-questionsfluid-functionalismComponentsFree2 deps
Badgebadgefluid-functionalismComponentsFree1 dep
Buttonbuttonfluid-functionalismComponentsFree4 deps
Button (Base UI)button-basefluid-functionalismComponentsFree4 deps
Cardcardfluid-functionalismComponentsFree1 dep
Chat Messagechat-messagefluid-functionalismComponentsFree1 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