HomeDocsComponentsBlocksChartsThemes
Introduction
  • Introduction
  • Installation
  • Themes
  • Artwork
  • llms.txt
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Brand SVG
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Form Guide
  • Hover Card
  • Icon Tile
  • Image Export
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • League Table
  • Marquee
  • Match Score
  • Meter
  • Multi Select
  • Native Select
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat
  • Stat Tabs
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
AI
  • Message Scroller
  • Message
  • Bubble
  • Marker
  • Attachment
  • Questionnaire
  • Composer
  • Reasoning
  • Tool Call
  • Approval Card
  • Citations
Blocks
  • Airtable
  • Airtable Kanban
  • CRM
  • ClickUp List
  • ClickUp Kanban
  • Repeatable Group
  • Command Palette
  • App Shell
  • Record Files
  • Settings Shell
  • Help Panel
  • Note Editor
  • Email Drafts
  • Task List
  • Notifications Panel
  • Dual Pane Sidebar
  • Team Members Panel
  • Mix Pack Builder
  • Record Picker and Date Quick-pick
  • Record List
  • Record Page
  • Sign In and Sign Up
  • Availability Scheduler
  • AI Chat
  • AI Assistant
  • Voice Message
  • Action Bar
  • Notion
  • Banking
  • Lineup Builder
  • Sports Score
  • Standings
  • Strava
  • Sheets
  • Notices
  • Settings
  • Billing
Templates
  • Sign In Page
  • Upload Page
  • Showcase Onboarding
  • Agreement Sign
  • Email
  • Email Composer
  • Share Dialog
  • Integrations
  • Transactions
  • Analytics
Utilities
  • motion
  • sounds
  • scroll-fade
  • shimmer
Another UI. Built on shadcn/ui with Phosphor icons.

Responsive Dialog

PreviousNext

A bottom drawer on phones and a dialog on wider screens, written once with one set of parts.

UI SDKBase UIReact AriaRadix UI

Installation#

pnpm dlx shadcn@latest add https://anotherui.dev/r/responsive-dialog.json

Usage#

import {
  ResponsiveDialog,
  ResponsiveDialogBody,
  ResponsiveDialogClose,
  ResponsiveDialogContent,
  ResponsiveDialogDescription,
  ResponsiveDialogFooter,
  ResponsiveDialogHeader,
  ResponsiveDialogTitle,
  ResponsiveDialogTrigger,
} from "@/components/ui/responsive-dialog"
<ResponsiveDialog>
  <ResponsiveDialogTrigger asChild>
    <Button>Transfer money</Button>
  </ResponsiveDialogTrigger>
  <ResponsiveDialogContent>
    <ResponsiveDialogHeader>
      <ResponsiveDialogTitle>Transfer money</ResponsiveDialogTitle>
      <ResponsiveDialogDescription>Move money between your accounts.</ResponsiveDialogDescription>
    </ResponsiveDialogHeader>
    <ResponsiveDialogBody>{/* form */}</ResponsiveDialogBody>
    <ResponsiveDialogFooter>
      <ResponsiveDialogClose asChild>
        <Button variant="outline">Cancel</Button>
      </ResponsiveDialogClose>
      <Button>Transfer</Button>
    </ResponsiveDialogFooter>
  </ResponsiveDialogContent>
</ResponsiveDialog>

Drawer or dialog#

Under 768px wide it opens as a Drawer from the bottom, which can be swiped down to close. From 768px up it opens as a centred Dialog. Change the width with breakpoint.

Body gets side padding and scrolls on the drawer, and sits in the dialog's own padding on desktop. Footer stacks its buttons on the drawer and lines them up on the right on desktop.

Close buttons#

The dialog shows a close button in the corner. The drawer has a handle instead. Pass showCloseButton={false} to hide the one on the dialog, or pass your own button as closeButton. Add closeOnDrawer to show your button on the drawer too.

Content with a banner#

For content that opens on its own banner instead of a header, like a player or contact card, set banner on the content. The parts sit with no gap and the drawer starts closer to the handle. ResponsiveDialogBannerClose is a white close button that sits on a dark banner. Keep a title and description for screen readers with className="sr-only".

Props#

  • ResponsiveDialog. Takes open, defaultOpen and onOpenChange like Dialog. breakpoint sets the width in pixels where it turns into a dialog. sounds plays the open and close cues, on by default. repositionInputs is passed to the drawer.
  • ResponsiveDialogContent. showCloseButton, closeButton and closeOnDrawer control the close button. banner is for content that opens on a banner. drawerClassName and dialogClassName style one mode only.
  • Other parts. Trigger, Header, Title, Description, Body, Footer and Close. Each renders the Drawer or Dialog part for the current mode and keeps its data-slot.
ResizableRich Text Editor

On This Page

InstallationUsageDrawer or dialogClose buttonsContent with a bannerProps