Feedback
Action Drawer
A list of actions sliding up from the bottom under the thumb: a context menu at the screen edge is out of reach on a phone, large rows are not.
- drawer
- action sheet
- mobile
- dialog
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/drawer-002?lang=en
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "drawer-002" (Action Drawer) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/drawer-002.json
Registry item: https://vibeui.ru/r/drawer-002.json
Installs to: components/vibeui/drawer-002.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
A list of actions sliding up from the bottom under the thumb: a context menu at the screen edge is out of reach on a phone, large rows are not.
A bottom action drawer: a grabber, the object's name, large action rows and a separate cancel button below them. It rests on a native modal dialog, so focus trapping, the backdrop and Escape come from the browser. Zero dependencies, one file, its own palette.
## 3. How to use it
import { Drawer002 } from "@/components/vibeui/drawer-002"
<Drawer002
triggerLabel="Actions"
title="Project Vitrina"
actions={[{ label: "Rename" }, { label: "Delete", tone: "danger" }]}
/>
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- the local --vibeui-drawer-002-* palette — do not swap it for your theme tokens: the drawer must look the same in any project
- the native dialog with showModal: focus trapping, the backdrop and Escape cost hundreds of lines by hand
- the 3.25rem minimum row height: this sheet lives under a thumb, not under a cursor
- the separate Cancel card with a gap: a miss there has to be harmless, not land on delete
- the object name above the list — otherwise nothing says what the actions apply to
- marking the destructive action by tone, not by wording alone: colour warns before the word is read
## 6. You may change
- title — the object name above the list and the drawer's accessible name
- the actions array: label, hint and tone of each action
- triggerLabel and cancelLabel — the trigger and cancel wording
- the handlers: rows only close the sheet, the action itself belongs to the caller
- radii and card width through the palette variables
## 7. Rules
- More than six rows is a menu, not quick actions: move the rest to the object's page.
- Do not put the destructive action first: the top row catches the thumb most often.
- The grabber promises a gesture, but dragging is not implemented — add a handler if you expect swipe.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.For developers
npx shadcn@latest add https://vibeui.ru/r/drawer-002.jsonhttps://vibeui.ru/r/drawer-002.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-drawer-002-*. Клиентский: "use client" — нужен ref для showModal и close. Ящик прижат к низу нативным dialog с явным inset, поэтому margin:auto не требуется. Escape и клик по затемнению закрывают лист: первое даёт браузер, второе — сравнение event.target с самим dialog. Карта действий и кнопка отмены разделены зазором, у опасного действия свой тон через data-tone.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
"use client"
import { useRef } from "react"
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Drawer002Action = {
label: string
hint?: string
tone?: "neutral" | "danger"
}
export type Drawer002Props = Omit<
ComponentPropsWithoutRef<"div">,
"children" | "title"
> & {
triggerLabel?: string
title?: string
actions?: Drawer002Action[]
cancelLabel?: string
accent?: string
}
// Идея компонента: список действий, выезжающий снизу под большой палец.
// На телефоне контекстное меню у края экрана недостижимо, поэтому действия
// переезжают вниз крупными строками. Ручка сверху обещает жест, а нижняя
// кнопка «Отмена» отделена промежутком: промах по ней ничего не стоит.
const STYLES = `
:where([data-vibeui-block="drawer-002"]){
--vibeui-drawer-002-bg:oklch(1 0 0);
--vibeui-drawer-002-fg:oklch(0.21 0.014 265);
--vibeui-drawer-002-muted:oklch(0.55 0.014 265);
--vibeui-drawer-002-border:oklch(0.91 0.006 265);
--vibeui-drawer-002-accent:oklch(0.55 0.17 265);
--vibeui-drawer-002-danger:oklch(0.55 0.2 25);
--vibeui-drawer-002-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="drawer-002"]{
display:inline-block;font-family:var(--vibeui-drawer-002-font);color:var(--vibeui-drawer-002-fg);
}
[data-vibeui-block="drawer-002"] [data-part="trigger"]{
appearance:none;cursor:pointer;
height:2.25rem;padding:0 0.875rem;
border:1px solid var(--vibeui-drawer-002-border);border-radius:0.625rem;
background:var(--vibeui-drawer-002-bg);color:inherit;
font:inherit;font-size:0.8125rem;font-weight:600;
}
[data-vibeui-block="drawer-002"] [data-part="trigger"]:focus-visible{outline:2px solid var(--vibeui-drawer-002-accent);outline-offset:2px}
/* Ящик прижат к низу и не занимает экран целиком: сверху видно страницу. */
[data-vibeui-block="drawer-002"] dialog{
position:fixed;inset:auto 0 0 0;margin:0;
width:100%;max-width:100vw;max-height:85dvh;
padding:0;border:0;background:transparent;color:inherit;overflow:visible;
translate:0 100%;transition:translate .24s ease,overlay .24s allow-discrete,display .24s allow-discrete;
}
[data-vibeui-block="drawer-002"] dialog[open]{translate:0 0}
@starting-style{
[data-vibeui-block="drawer-002"] dialog[open]{translate:0 100%}
}
[data-vibeui-block="drawer-002"] dialog::backdrop{background:oklch(0.19 0.02 265 / 48%)}
[data-vibeui-block="drawer-002"] [data-part="panel"]{
display:flex;flex-direction:column;gap:0.5rem;box-sizing:border-box;
padding:0.375rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom,0px));
}
[data-vibeui-block="drawer-002"] [data-part="card"]{
display:flex;flex-direction:column;
background:var(--vibeui-drawer-002-bg);border-radius:1rem;
box-shadow:0 -18px 50px -28px oklch(0.2 0.02 265 / 60%);
overflow:hidden;
}
/* Ручка — обещание жеста: без неё лист выглядит окном, приклеенным к низу. */
[data-vibeui-block="drawer-002"] [data-part="grabber"]{
align-self:center;width:2.5rem;height:0.25rem;margin:0.625rem 0 0.25rem;
border-radius:9999px;background:var(--vibeui-drawer-002-border);flex:none;
}
[data-vibeui-block="drawer-002"] [data-part="title"]{
margin:0;padding:0.375rem 1rem 0.625rem;text-align:center;
font-size:0.8125rem;font-weight:600;color:var(--vibeui-drawer-002-muted);
}
[data-vibeui-block="drawer-002"] [data-part="list"]{
list-style:none;margin:0;padding:0;overflow-y:auto;
}
[data-vibeui-block="drawer-002"] [data-part="item"]+[data-part="item"]{
border-top:1px solid var(--vibeui-drawer-002-border);
}
/* Строка во всю ширину и высотой под палец: промахнуться почти невозможно. */
[data-vibeui-block="drawer-002"] [data-part="action"]{
appearance:none;border:0;cursor:pointer;width:100%;
display:flex;flex-direction:column;gap:0.125rem;
min-height:3.25rem;padding:0.6875rem 1rem;
background:transparent;color:inherit;font:inherit;text-align:left;
}
[data-vibeui-block="drawer-002"] [data-part="action"]:hover{background:oklch(0.97 0.003 265)}
[data-vibeui-block="drawer-002"] [data-part="action"]:focus-visible{outline:2px solid var(--vibeui-drawer-002-accent);outline-offset:-2px}
[data-vibeui-block="drawer-002"] [data-part="label"]{font-size:0.9375rem;font-weight:600}
[data-vibeui-block="drawer-002"] [data-part="hint"]{font-size:0.75rem;color:var(--vibeui-drawer-002-muted)}
[data-vibeui-block="drawer-002"] [data-part="action"][data-tone="danger"] [data-part="label"]{color:var(--vibeui-drawer-002-danger)}
/* Отмена отдельной картой: между ней и списком есть промах-зазор. */
[data-vibeui-block="drawer-002"] [data-part="cancel"]{
appearance:none;border:0;cursor:pointer;
height:3.25rem;border-radius:1rem;
background:var(--vibeui-drawer-002-bg);color:var(--vibeui-drawer-002-accent);
font:inherit;font-size:0.9375rem;font-weight:700;
box-shadow:0 -18px 50px -28px oklch(0.2 0.02 265 / 60%);
}
[data-vibeui-block="drawer-002"] [data-part="cancel"]:focus-visible{outline:2px solid var(--vibeui-drawer-002-accent);outline-offset:2px}
@media (prefers-reduced-motion:reduce){
[data-vibeui-block="drawer-002"] *{animation:none!important;transition:none!important}
[data-vibeui-block="drawer-002"] dialog{translate:0 0}
}
`
const DEFAULT_ACTIONS: Drawer002Action[] = [
{ label: "Поделиться ссылкой", hint: "Скопируется в буфер обмена" },
{ label: "Дублировать проект" },
{ label: "Переименовать" },
{
label: "Удалить проект",
hint: "Останется в корзине 30 дней",
tone: "danger",
},
]
/**
* Нижний ящик действий на телефоне: ручка, крупные строки, отдельная отмена.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Drawer002({
triggerLabel = "Действия",
title = "Проект «Витрина»",
actions = DEFAULT_ACTIONS,
cancelLabel = "Отмена",
accent,
className,
style,
...props
}: Drawer002Props) {
const drawer = useRef<HTMLDialogElement>(null)
const palette = {
...(accent ? { "--vibeui-drawer-002-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-drawer-002" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="drawer-002"
className={className}
style={palette}
>
<button
type="button"
data-part="trigger"
onClick={() => drawer.current?.showModal()}
>
{triggerLabel}
</button>
<dialog
ref={drawer}
aria-label={title}
onClick={(event) => {
if (event.target === drawer.current) {
drawer.current.close()
}
}}
>
<div data-part="panel">
<div data-part="card">
<span data-part="grabber" aria-hidden="true" />
<p data-part="title">{title}</p>
<ul data-part="list">
{actions.map((action) => (
<li key={action.label} data-part="item">
<button
type="button"
data-part="action"
data-tone={action.tone ?? "neutral"}
onClick={() => drawer.current?.close()}
>
<span data-part="label">{action.label}</span>
{action.hint ? (
<span data-part="hint">{action.hint}</span>
) : null}
</button>
</li>
))}
</ul>
</div>
<button
type="button"
data-part="cancel"
onClick={() => drawer.current?.close()}
>
{cancelLabel}
</button>
</div>
</dialog>
</div>
</>
)
}