Shift handoff
Add a task to the handoff checklist and track how much of the shift is ready.
Installation
Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/task-board.json
Usage
import { Cyber } from "@/components/ui/cyber"
import Recipe from "@/components/recipes/task-board"
export default function App() {
return (
<Cyber>
<Recipe />
</Cyber>
)
}
Source
"use client"
import { useRef, useState } from "react"
import { Plus } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Checkbox, CheckboxGroup } from "@/components/ui/checkbox"
import { Progress } from "@/components/ui/progress"
import { TextField } from "@/components/ui/text-field"
import "./recipe-layout.css"
const initialTasks = [
{ id: "weather", title: "Check the coastal forecast" },
{ id: "battery", title: "Charge the spare beacon" },
{ id: "handoff", title: "Brief the morning shift" },
]
export default function TaskBoard() {
const [tasks, setTasks] = useState(initialTasks)
const [complete, setComplete] = useState<string[]>(["weather"])
const [draft, setDraft] = useState("")
const sequence = useRef(0)
return (
<div className="sink-stack">
<Progress label="Shift readiness" value={complete.length} max={tasks.length} />
<CheckboxGroup label="Handoff checklist" value={complete} onValueChange={setComplete}>
{tasks.map(task => <Checkbox key={task.id} label={task.title} value={task.id} />)}
</CheckboxGroup>
<form className="sink-stack" onSubmit={event => {
event.preventDefault()
const title = draft.trim()
if (!title) return
const task = { id: `added-${++sequence.current}`, title }
setTasks(previous => [...previous, task])
setDraft("")
}}>
<TextField label="New checklist item" placeholder="Log a handoff task" maxLength={72} value={draft} onValueChange={setDraft} />
<div className="sink-row"><Button size="sm" type="submit" disabled={!draft.trim()}><Plus aria-hidden /> Add task</Button></div>
</form>
</div>
)
}
Components in this recipe
- Checkbox — A cut box that fills and marks when checked, with an indeterminate state.
- Progress — A segmented bar with a percentage readout, and an indeterminate state.
- Text field — A labelled text input in a cut frame, with a hint, an error and an optional icon.