Skip to content

Dialog

FeedbackWeb + NativeMIT
View in Storybook

Accessible modal dialog with focus trap, animation, and portal rendering.

bun add @otfdashkit/ui

Preview

Dialog
Loading Storybook preview…

Code

import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '@otfdashkit/ui'
import { Button } from '@otfdashkit/ui'

export function Example() {
  return (
    <Dialog>
      <DialogTrigger asChild>
        <Button variant="outline">Create project</Button>
      </DialogTrigger>
      <DialogContent>
        <DialogHeader>
          <DialogTitle>New project</DialogTitle>
          <DialogDescription>Enter the details for your new project.</DialogDescription>
        </DialogHeader>
        <div className="space-y-3 py-4">
          <input
            className="w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
            placeholder="Project name"
          />
          <textarea
            className="w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring min-h-[80px]"
            placeholder="Description (optional)"
          />
        </div>
        <DialogFooter>
          <Button variant="outline">Cancel</Button>
          <Button>Create</Button>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  )
}

Free with the SDK. This component ships in @otfdashkit/ui under the MIT license.

Kit for this component

Everything Bundle$149 · 6 kits + 20 templates

Open a modal dialog for a confirmation or a short form.

See the kit