Data Grid Skeleton
tablecn/data-grid-skeletonFreeComponent
A composable skeleton component for the data grid with toolbar and grid parts
Install it
npx shadcn@latest add https://tablecn.com/r/data-grid-skeleton.jsonSource
1import type * as React from "react";2import { Skeleton } from "@/components/ui/skeleton";3import { cn } from "@/lib/utils";45interface DivProps extends React.ComponentProps<"div"> {}67function DataGridSkeleton({ className, ...props }: DivProps) {8 return (9 <div10 data-slot="grid-skeleton"11 className={cn(12 "flex h-[calc(100dvh-(--spacing(16)))] w-full flex-col gap-4 has-[>[data-slot=grid-skeleton-toolbar]]:h-[calc(100dvh-(--spacing(20)))]",13 className,14 )}15 {...props}16 />17 );18}1920interface DataGridSkeletonToolbarProps extends DivProps {21 align?: "start" | "center" | "end";22 actionCount?: number;23}2425function DataGridSkeletonToolbar({26 align = "end",27 actionCount = 4,28 className,29 ...props30}: DataGridSkeletonToolbarProps) {31 return (32 <div33 data-slot="grid-skeleton-toolbar"34 className={cn(35 "flex items-center gap-2",36 {37 "justify-start": align === "start",38 "justify-center": align === "center",39 "justify-end": align === "end",40 },41 className,42 )}43 {...props}44 >45 {Array.from({ length: actionCount }).map((_, i) => (46 <Skeleton key={i} className="h-7 w-20 shrink-0" />47 ))}48 </div>49 );50}5152function DataGridSkeletonGrid({ className, ...props }: DivProps) {53 return (54 <Skeleton55 data-slot="grid-skeleton-grid"56 className={cn("flex-1", className)}57 {...props}58 />59 );60}6162export { DataGridSkeleton, DataGridSkeletonGrid, DataGridSkeletonToolbar };
What it pulls in
Other registry items
Files it writes
More from tablecn
All 13 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Data Griddata-grid | tablecn | Components | Free | 4 deps · 21 files | |
| Data Grid Filter Menudata-grid-filter-menu | tablecn | Components | Free | 2 deps · 8 files | |
| Data Grid Keyboard Shortcutsdata-grid-keyboard-shortcuts | tablecn | Components | Free | 1 dep · 2 files | |
| Data Grid Row Height Menudata-grid-row-height-menu | tablecn | Components | Free | 2 deps | |
| Data Grid Select Columndata-grid-select-column | tablecn | Components | Free | 1 dep | |
| Data Grid Sort Menudata-grid-sort-menu | tablecn | Components | Free | 2 deps · 4 files | |
| Data Grid View Menudata-grid-view-menu | tablecn | Components | Free | 2 deps · 2 files | |
| Data Tabledata-table | tablecn | Components | Free | 3 deps · 17 files |
