Skip to content
Overlays

Drawer

The same dialog, sliding in from any edge.

import
import { Drawer } from '@joshicodes/cock';

Sides

Keyboard

Esc
Closes, unless `dismissible` is false

Behaviour

  • Renders into `<body>` and positions itself against its trigger, so an `overflow: hidden` ancestor or a scrolling table cannot clip it.
  • Takes the modal props plus `side`.

API

Read out of the component sources at build time, so it matches the version you installed. Every component also takes class, merged through tailwind-merge so your utility wins.

Props of Drawer

PropTypeDefault
open bindable
booleanfalse
side
'left' | 'right' | 'top' | 'bottom''right'
title
string—
description
string—
size

Width for left/right, height for top/bottom.

string—
dismissible
booleantrue
class
string—

Snippets of Drawer

SnippetTypeDefault
children
Snippet—
footer
Snippet—

Events of Drawer

EventTypeDefault
onclose
() => void—

See also

cock. Yes, it stands for core component kit. We checked twice.