Menu

Every panel in our app is a Sheet, and the Dialog file the CLI wrote has zero importers
📰

Every panel in our app is a Sheet, and the Dialog file the CLI wrote has zero importers

DEV Community: react·Daniel Pertu·14 days ago
#NUOWDjoN
#devtoreact#devto#dev#dialog#side
Reading 0:00
15s threshold

Nakodo has one modal shape. Editing a campaign's name, changing which campaign gets how many emails a day, reading a conversation, opening the menu on a phone: all of it slides in from the right. Nothing in the app opens in a centred box.

That was not a decision anybody wrote down. It became obvious when I counted the imports of the components in src/components/ui , the folder the shadcn CLI wrote and nothing else touches:

file lines importers

sheet.tsx 147 6

alert-dialog.tsx 199 3

dialog.tsx 168 0

scroll-area.tsx 54 0

tabs.tsx 89 0

separator.tsx 27 0

The three dialog-shaped files are a useful trio. The sheet is in constant use, the alert dialog is imported three times, and the plain dialog has never been imported at all.

A sheet is a dialog with different CSS

The first line of the file says so:

import { Dialog as SheetPrimitive } from " radix-ui "

Enter fullscreen mode

Exit fullscreen mode

There is no separate sheet primitive.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.