Checkbox
Done Drawer
A task list where finished items move into a collapsed "Done" drawer: the active list stays short and nothing disappears.
- checkbox
- tasks
- progress
- details
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/checkbox-014?lang=en
Section launch
2 из 5Готово: 2
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 "checkbox-014" (Done 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/checkbox-014.json
Registry item: https://vibeui.ru/r/checkbox-014.json
Installs to: components/vibeui/checkbox-014.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 task list where finished items move into a collapsed "Done" drawer: the active list stays short and nothing disappears.
A checklist with a progress bar where completed tasks collect in a collapsed "Done" drawer. The active list never grows, and finished work can be reopened and unticked. Zero dependencies, one file.
## 3. How to use it
import { Checkbox014 } from "@/components/vibeui/checkbox-014"
<Checkbox014
title="Section launch"
tasks={tasks}
defaultDone={["1"]}
onChange={setDone}
/>
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-checkbox-014-* palette — do not swap it for your theme tokens
- the native <details> for finished tasks: collapsing and keyboard support come free
- the ability to untick a finished task — otherwise a wrong tap is irreversible
- the progress bar with role="progressbar" and aria-valuenow: the ratio matters more than the list
- the "all tasks are done" line instead of blank space when nothing is active
- the strike-through inside the Done drawer: there the text reads as history, not as work
## 6. You may change
- the tasks array and the initial defaultDone
- title — the list's name
- the onChange handler
- the accent through the accent prop — the tick and the bar colour
## 7. Rules
- Rows moving on tick is deliberate: if it gets in the way use checkbox-007, where the order is fixed.
- The component persists nothing: state lives until reload.
- Keep the Done drawer collapsed: open by default it defeats the point.
- 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/checkbox-014.jsonhttps://vibeui.ru/r/checkbox-014.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-checkbox-014-*. Клиентский: "use client". Задачи делятся на два списка по состоянию, выполненные лежат в нативном <details> — сворачивание работает без JS и доступно с клавиатуры. Сверху полоса прогресса: span с шириной в процентах и role="progressbar" с aria-valuenow. Маркер <summary> убран, стрелка нарисована псевдоэлементом.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
"use client"
import { useState } from "react"
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Checkbox014Task = {
id: string
text: string
}
export type Checkbox014Props = Omit<
ComponentPropsWithoutRef<"section">,
"children" | "onChange" | "title"
> & {
title?: string
tasks?: Checkbox014Task[]
defaultDone?: string[]
onChange?: (done: string[]) => void
accent?: string
}
// Идея компонента: выполненные задачи не остаются в общем списке, а уезжают
// в свёрнутый блок «Готово» под ним. Активный список остаётся коротким, но
// сделанное никуда не пропадает — его можно раскрыть и снять галочку.
// Сверху полоса прогресса: доля выполненного видна без счёта в уме.
const STYLES = `
:where([data-vibeui-block="checkbox-014"]){
--vibeui-checkbox-014-bg:oklch(1 0 0);
--vibeui-checkbox-014-fg:oklch(0.22 0.014 265);
--vibeui-checkbox-014-muted:oklch(0.57 0.014 265);
--vibeui-checkbox-014-border:oklch(0.9 0.006 265);
--vibeui-checkbox-014-track:oklch(0.94 0.005 265);
--vibeui-checkbox-014-accent:oklch(0.56 0.14 150);
--vibeui-checkbox-014-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="checkbox-014"]{
display:block;width:100%;max-width:21rem;box-sizing:border-box;
padding:0.9375rem;border:1px solid var(--vibeui-checkbox-014-border);border-radius:0.9375rem;
background:var(--vibeui-checkbox-014-bg);
font-family:var(--vibeui-checkbox-014-font);color:var(--vibeui-checkbox-014-fg);
}
[data-vibeui-block="checkbox-014"] [data-part="head"]{
display:flex;align-items:baseline;justify-content:space-between;gap:0.5rem;
}
[data-vibeui-block="checkbox-014"] [data-part="title"]{margin:0;font-size:0.9375rem;font-weight:650}
[data-vibeui-block="checkbox-014"] [data-part="ratio"]{
font-size:0.75rem;color:var(--vibeui-checkbox-014-muted);font-variant-numeric:tabular-nums;
}
[data-vibeui-block="checkbox-014"] [data-part="track"]{
display:block;height:0.3125rem;margin:0.5rem 0 0.625rem;border-radius:9999px;overflow:hidden;
background:var(--vibeui-checkbox-014-track);
}
[data-vibeui-block="checkbox-014"] [data-part="fill"]{
display:block;height:100%;border-radius:9999px;
background:var(--vibeui-checkbox-014-accent);
transition:width .25s ease;
}
[data-vibeui-block="checkbox-014"] ul{margin:0;padding:0;list-style:none}
[data-vibeui-block="checkbox-014"] label{
display:flex;align-items:center;gap:0.625rem;
min-height:2rem;font-size:0.875rem;cursor:pointer;
}
[data-vibeui-block="checkbox-014"] input{
appearance:none;position:relative;flex:none;cursor:pointer;
width:1.125rem;height:1.125rem;margin:0;box-sizing:border-box;
border:1.5px solid var(--vibeui-checkbox-014-border);border-radius:0.375rem;
background:var(--vibeui-checkbox-014-bg);
transition:background-color .15s ease,border-color .15s ease;
}
[data-vibeui-block="checkbox-014"] input:checked{border-color:transparent;background:var(--vibeui-checkbox-014-accent)}
[data-vibeui-block="checkbox-014"] input:checked::after{
content:"";position:absolute;left:50%;top:50%;
width:0.25rem;height:0.4375rem;margin:-0.3125rem 0 0 -0.125rem;
border-right:2px solid oklch(0.99 0.01 150);border-bottom:2px solid oklch(0.99 0.01 150);
transform:rotate(45deg);
}
[data-vibeui-block="checkbox-014"] input:focus-visible{outline:2px solid var(--vibeui-checkbox-014-accent);outline-offset:2px}
[data-vibeui-block="checkbox-014"] [data-part="empty"]{
margin:0.25rem 0;font-size:0.8125rem;color:var(--vibeui-checkbox-014-muted);
}
/* Готовое живёт в <details>: свёрнуто по умолчанию, раскрывается без
единой строки JS и остаётся доступным с клавиатуры. */
[data-vibeui-block="checkbox-014"] details{
margin-top:0.625rem;padding-top:0.625rem;
border-top:1px solid var(--vibeui-checkbox-014-border);
}
[data-vibeui-block="checkbox-014"] summary{
cursor:pointer;font-size:0.75rem;font-weight:650;color:var(--vibeui-checkbox-014-muted);
list-style:none;
}
[data-vibeui-block="checkbox-014"] summary::-webkit-details-marker{display:none}
[data-vibeui-block="checkbox-014"] summary::before{
content:"▸";display:inline-block;width:0.875rem;
transition:transform .15s ease;
}
[data-vibeui-block="checkbox-014"] details[open] summary::before{transform:rotate(90deg)}
[data-vibeui-block="checkbox-014"] summary:focus-visible{outline:2px solid var(--vibeui-checkbox-014-accent);outline-offset:2px;border-radius:0.25rem}
[data-vibeui-block="checkbox-014"] details label span{
text-decoration:line-through;color:var(--vibeui-checkbox-014-muted);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="checkbox-014"] *{animation:none!important;transition:none!important}}
`
const DEFAULT_TASKS: Checkbox014Task[] = [
{ id: "1", text: "Собрать требования" },
{ id: "2", text: "Нарисовать макет" },
{ id: "3", text: "Согласовать с командой" },
{ id: "4", text: "Написать компонент" },
{ id: "5", text: "Проверить на телефоне" },
]
/**
* Список задач, где выполненное уезжает в свёрнутый блок «Готово»,
* а сверху идёт полоса прогресса. Один файл, ноль зависимостей.
*/
export function Checkbox014({
title = "Запуск раздела",
tasks = DEFAULT_TASKS,
defaultDone = ["1", "2"],
onChange,
accent,
className,
style,
...props
}: Checkbox014Props) {
const [done, setDone] = useState<string[]>(defaultDone)
const palette = {
...(accent ? { "--vibeui-checkbox-014-accent": accent } : null),
...style,
} as CSSProperties
const toggle = (id: string) => {
const next = done.includes(id)
? done.filter((item) => item !== id)
: [...done, id]
setDone(next)
onChange?.(next)
}
const open = tasks.filter((task) => !done.includes(task.id))
const closed = tasks.filter((task) => done.includes(task.id))
const percent = tasks.length ? (closed.length / tasks.length) * 100 : 0
return (
<>
<style href="vibeui-checkbox-014" precedence="medium">
{STYLES}
</style>
<section
{...props}
data-vibeui-block="checkbox-014"
className={className}
style={palette}
aria-label={title}
>
<div data-part="head">
<h3 data-part="title">{title}</h3>
<span data-part="ratio" role="status">
{closed.length} из {tasks.length}
</span>
</div>
<span
data-part="track"
role="progressbar"
aria-valuenow={closed.length}
aria-valuemin={0}
aria-valuemax={tasks.length}
>
<span data-part="fill" style={{ width: `${percent}%` }} />
</span>
{open.length === 0 ? (
<p data-part="empty">Все задачи выполнены.</p>
) : (
<ul>
{open.map((task) => (
<li key={task.id}>
<label>
<input
type="checkbox"
checked={false}
onChange={() => toggle(task.id)}
/>
<span>{task.text}</span>
</label>
</li>
))}
</ul>
)}
{closed.length > 0 ? (
<details>
<summary>Готово: {closed.length}</summary>
<ul>
{closed.map((task) => (
<li key={task.id}>
<label>
<input
type="checkbox"
checked
onChange={() => toggle(task.id)}
/>
<span>{task.text}</span>
</label>
</li>
))}
</ul>
</details>
) : null}
</section>
</>
)
}