8-bit Table
8bitcn/tableFreeComponent
A simple 8-bit table component
Install it
npx shadcn@latest add https://www.8bitcn.com/r/table.jsonSource
1"use client";23import type * as React from "react";45import { type VariantProps, cva } from "class-variance-authority";67import { cn } from "@/lib/utils";89import {10 Table as ShadcnTable,11 TableBody as ShadcnTableBody,12 TableCaption as ShadcnTableCaption,13 TableCell as ShadcnTableCell,14 TableFooter as ShadcnTableFooter,15 TableHead as ShadcnTableHead,16 TableHeader as ShadcnTableHeader,17 TableRow as ShadcnTableRow,18} from "@/components/ui/table";1920import "@/components/ui/8bit/styles/retro.css";2122export const tableVariants = cva("", {23 variants: {24 variant: {25 default: "p-4 py-2.5 border-y-6 border-foreground dark:border-ring",26 borderless: "",27 },28 font: {29 normal: "",30 retro: "retro",31 },32 },33 defaultVariants: {34 font: "retro",35 variant: "default",36 },37});3839function Table({40 className,41 font,42 variant,43 ...props44}: React.ComponentProps<"table"> & {45 font?: VariantProps<typeof tableVariants>["font"];46 variant?: VariantProps<typeof tableVariants>["variant"];47}) {48 return (49 <div50 className={cn(51 "relative flex justify-center w-fit",52 tableVariants({ font, variant })53 )}54 >55 <ShadcnTable className={className} {...props} />5657 {variant !== "borderless" && (58 <div59 className="absolute inset-0 border-x-6 -mx-1.5 border-foreground dark:border-ring pointer-events-none"60 aria-hidden="true"61 />62 )}63 </div>64 );65}6667function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {68 return (69 <ShadcnTableHeader70 className={cn(className, "border-b-4 border-foreground dark:border-ring")}71 {...props}72 />73 );74}7576function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {77 return <ShadcnTableBody className={cn(className)} {...props} />;78}7980function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {81 return <ShadcnTableFooter className={cn(className)} {...props} />;82}8384function TableRow({ className, ...props }: React.ComponentProps<"tr">) {85 return (86 <ShadcnTableRow87 className={cn(88 className,89 "border-dashed border-b-4 border-foreground dark:border-ring"90 )}91 {...props}92 />93 );94}9596function TableHead({ className, ...props }: React.ComponentProps<"th">) {97 return <ShadcnTableHead className={cn(className)} {...props} />;98}99100function TableCell({ className, ...props }: React.ComponentProps<"td">) {101// … truncated
What it pulls in
Other registry items
Files it writes
More from 8bitcn
All 121 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| 8-bit Accordionaccordion | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Alertalert | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Alert Dialogalert-dialog | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Avataravatar | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Badgebadge | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Breadcrumbbreadcrumb | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Buttonbutton | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Button Groupbutton-group | 8bitcn | Components | Free | no deps · 4 files |
