# Shift handoff

Add a task to the handoff checklist and track how much of the shift is ready.

[View Shift handoff on CyberSpec](https://www.cyberspec.dev/sink/task-board)

## 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.

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/task-board.json
```

## Usage

```tsx
import { Cyber } from "@/components/ui/cyber"
import Recipe from "@/components/recipes/task-board"

export default function App() {
  return (
    <Cyber>
      <Recipe />
    </Cyber>
  )
}
```

## Source

```tsx
"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](https://www.cyberspec.dev/components/sidebar/checkbox.md) — A cut box that fills and marks when checked, with an indeterminate state.
- [Progress](https://www.cyberspec.dev/components/sidebar/progress.md) — A segmented bar with a percentage readout, and an indeterminate state.
- [Text field](https://www.cyberspec.dev/components/sidebar/text-field.md) — A labelled text input in a cut frame, with a hint, an error and an optional icon.
- [Button](https://www.cyberspec.dev/components/sidebar/button.md) — A cut-corner button with a raised tab, five tones, and a press flash. Enable the cipher prop to scramble the label and briefly tear the frame on hover.

## Resources

- [All kitchen sink recipes](https://www.cyberspec.dev/sink.md)
- [Recipe source on GitHub](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/recipes/task-board.tsx)
- [Recipe layout stylesheet](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/recipes/recipe-layout.css)
- [Shadcn registry item](https://www.cyberspec.dev/r/task-board.json)
