# Building a Drawer Component

Essay by Emil Kowalski (https://emilkowal.ski)

My experience building a drawer component for React.

Topics: Components, Motion
Source: https://emilkowal.ski/ui/building-a-drawer-component

## For agents

Nothing to install. This is a reference: cite it, or fetch the source when
the reasoning matters.

Read it at: https://emilkowal.ski/ui/building-a-drawer-component

The full text is not reproduced here. It belongs to its author. What is
above is the author's own summary and the topics it covers.

Skills in this library that act on the same ground:

- emil-design-eng (https://www.stackskills.dev/md/emil-design-eng): The design-engineering house style behind Sonner and Vaul.
- animate (https://www.stackskills.dev/md/animate): Builds an animation from scratch, decisions in the order that matters.
- review-animations (https://www.stackskills.dev/md/review-animations): Reviews your motion strictly, against Emil's rules.
- improve-animations (https://www.stackskills.dev/md/improve-animations): Audits every animation in a codebase and hands back prioritised plans.
- find-animation-opportunities (https://www.stackskills.dev/md/find-animation-opportunities): Finds where motion would genuinely help, and says what not to animate.

## The short version

Vaul started because Apple's iOS sheet feels natural and the web had no real equivalent, and because the drawer Vercel was using lacked drag-to-dismiss. Emil built it on Radix Dialog so focus management and accessibility came for free, then kept a near-identical API so it would feel familiar. The write-up is honest about the hard parts. Dragging went laggy past roughly twenty list items because the drag position was set through an inherited CSS variable, which recalculated styles for every child, and writing the transform straight onto the element fixed it. Momentum, damping at the top and making a scrollable sheet draggable each get their own section.

## Verification

- Source link: Resolved (HTTP 200) (pass)
- Reading copy: Plain markdown for agents at /md/building-a-drawer-component (pass)
- Attribution: Credited to Emil Kowalski (pass)

Full page: https://www.stackskills.dev/library/building-a-drawer-component
