list
kibo-ui-registry/listFreeComponent
List views are a great way to show a list of tasks grouped by status and ranked by priority.
Live preview
live · rendered by the registry
Rendered by Kibo UI Registry on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.kibo-ui.com/r/list.jsonSource
1"use client";23import {4 DndContext,5 type DragEndEvent,6 rectIntersection,7 useDraggable,8 useDroppable,9} from "@dnd-kit/core";10import { restrictToVerticalAxis } from "@dnd-kit/modifiers";11import type { ReactNode } from "react";12import { cn } from "@/lib/utils";1314export type { DragEndEvent } from "@dnd-kit/core";1516type Status = {17 id: string;18 name: string;19 color: string;20};2122type Feature = {23 id: string;24 name: string;25 startAt: Date;26 endAt: Date;27 status: Status;28};2930export type ListItemsProps = {31 children: ReactNode;32 className?: string;33};3435export const ListItems = ({ children, className }: ListItemsProps) => (36 <div className={cn("flex flex-1 flex-col gap-2 p-3", className)}>37 {children}38 </div>39);4041export type ListHeaderProps =42 | {43 children: ReactNode;44 }45 | {46 name: Status["name"];47 color: Status["color"];48 className?: string;49 };5051export const ListHeader = (props: ListHeaderProps) =>52 "children" in props ? (53 props.children54 ) : (55 <div56 className={cn(57 "flex shrink-0 items-center gap-2 bg-foreground/5 p-3",58 props.className59 )}60 >61 <div62 className="h-2 w-2 rounded-full"63 style={{ backgroundColor: props.color }}64 />65 <p className="m-0 font-semibold text-sm">{props.name}</p>66 </div>67 );6869export type ListGroupProps = {70 id: Status["id"];71 children: ReactNode;72 className?: string;73};7475export const ListGroup = ({ id, children, className }: ListGroupProps) => {76 const { setNodeRef, isOver } = useDroppable({ id });7778 return (79 <div80 className={cn(81 "bg-secondary transition-colors",82 isOver && "bg-foreground/10",83 className84 )}85 ref={setNodeRef}86 >87 {children}88 </div>89 );90};9192export type ListItemProps = Pick<Feature, "id" | "name"> & {93 readonly index: number;94 readonly parent: string;95 readonly children?: ReactNode;96 readonly className?: string;97};9899export const ListItem = ({100 id,101 name,102 index,103 parent,104 children,105 className,106}: ListItemProps) => {107 const { attributes, listeners, setNodeRef, transform, isDragging } =108 useDraggable({109 id,110 data: { index, parent },111 });112113 return (114 <div115 className={cn(116 "flex cursor-grab items-center gap-2 rounded-md border bg-background p-2 shadow-sm",117 isDragging && "cursor-grabbing",118 className119 )}120 style={{121 transform: transform122// … truncated
What it pulls in
npm packages
Files it writes
More from Kibo UI Registry
All 41 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| announcementannouncement | Kibo UI Registry | Components | Free | no deps | |
| avatar-stackavatar-stack | Kibo UI Registry | Components | Free | no deps | |
| bannerbanner | Kibo UI Registry | Components | Free | 2 deps | |
| calendarcalendar | Kibo UI Registry | Components | Free | 3 deps | |
| choiceboxchoicebox | Kibo UI Registry | Components | Free | 2 deps | |
| code-blockcode-block | Kibo UI Registry | Components | Free | 5 deps · 2 files | |
| color-pickercolor-picker | Kibo UI Registry | Components | Free | 3 deps | |
| comboboxcombobox | Kibo UI Registry | Components | Free | 2 deps |
