Ai Task List
smoothui-registry/ai-task-listFreeComponent
Live agent plan with nested steps, a drawn checkmark on completion and a travelling underline on whatever is running.
Install it
npx shadcn@latest add https://www.smoothui.dev/r/ai-task-list.jsonSource
1"use client";23import { cn } from "@/lib/utils";4import { motion, useReducedMotion } from "motion/react";5import { Fragment } from "react";67const SPRING_DEFAULT = {8 bounce: 0.1,9 duration: 0.25,10 type: "spring" as const,11};12const EASE_IN_OUT = [0.645, 0.045, 0.355, 1] as const;13const CHECK_PATH = "M 3.5 7.5 L 6 10 L 10.5 4.5";14const BOX_SIZE = 14;15const UNDERLINE_SECONDS = 1.4;1617export type AITaskStatus = "pending" | "running" | "done" | "failed";1819export type AITask = {20 /** Nested sub-steps, one level. */21 children?: AITask[];22 id: string;23 label: string;24 /** Short right-aligned note, e.g. "12/12" or "3 files". */25 note?: string;26 status: AITaskStatus;27};2829export type AITaskListProps = {30 className?: string;31 /** Heading text. The counts are derived, never passed in. */32 label?: string;33 tasks: AITask[];34};3536const flatten = (tasks: AITask[]): AITask[] =>37 tasks.flatMap((task) => [task, ...flatten(task.children ?? [])]);3839const SUCCESS_COLOR = "oklch(72% 0.17 150)";40const DANGER_COLOR = "oklch(63% 0.21 25)";4142const boxStroke = (status: AITaskStatus): string => {43 if (status === "failed") {44 return DANGER_COLOR;45 }46 if (status === "done") {47 return SUCCESS_COLOR;48 }49 return "currentColor";50};5152const TaskBox = ({53 status,54 shouldReduceMotion,55}: {56 shouldReduceMotion: boolean;57 status: AITaskStatus;58}) => {59 const isDone = status === "done";60 const isFailed = status === "failed";6162 return (63 <span className="mt-0.5 flex size-3.5 shrink-0 items-center justify-center">64 <svg65 aria-hidden="true"66 className="size-3.5"67 viewBox={`0 0 ${BOX_SIZE} ${BOX_SIZE}`}68 >69 <motion.rect70 animate={{71 fillOpacity: isDone ? 0.12 : 0,72 stroke: boxStroke(status),73 }}74 fill={isFailed ? DANGER_COLOR : SUCCESS_COLOR}75 height={12}76 rx={3.5}77 strokeWidth={1.4}78 transition={shouldReduceMotion ? { duration: 0 } : { duration: 0.2 }}79 width={12}80 x={1}81 y={1}82 />83 {isDone && (84 // Drawn, not faded: a check that draws itself reads as the act of85 // ticking the box rather than a state that was always there.86 // Drawn with a CSS keyframe rather than a motion value.87 //88 // Neither motion's `pathLength` shorthand nor an explicit89 // `strokeDashoffset` animation resolved on these paths — the dash90// … truncated
What it pulls in
npm packages
Files it writes
More from SmoothUI Registry
All 178 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Agent Avataragent-avatar | SmoothUI Registry | Components | Free | no deps | |
| Ai Approvalai-approval | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Artifactai-artifact | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Branchai-branch | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Citationai-citation | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Context Meterai-context-meter | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Conversationai-conversation | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Coreai-core | SmoothUI Registry | Components | Free | 1 dep |
