Componentdata0.61 KB gzipZero dependencies

Table

Data table with dashed row dividers and mono headers.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add table

Or install the full npm package:

npm install bigbullui

Usage

tsx16 lines
import { Table, TableHead, TableBody, TableRow, TableCell, TableHeaderCell } from "@/components/ui/table"; <Table>  <TableHead>    <TableRow>      <TableHeaderCell>Seat</TableHeaderCell>      <TableHeaderCell>Status</TableHeaderCell>    </TableRow>  </TableHead>  <TableBody>    <TableRow>      <TableCell>A-12</TableCell>      <TableCell>Admitted</TableCell>    </TableRow>  </TableBody></Table>

Source code

table.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxtable.tsx124 lines
import * as React from "react";import { cn } from "./lib/utils"; export interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {  /** Additional CSS classes applied to the inner table element. */  className?: string;} export const Table = React.forwardRef<HTMLTableElement, TableProps>(  function Table({ className, ...props }, ref) {    return (      <div className="relative w-full overflow-auto rounded-lg border border-border bg-card">        <table ref={ref} className={cn("w-full caption-bottom text-sm", className)} {...props} />      </div>    );  });Table.displayName = "Table";

Props

PropTypeDescription
classNamestringAdditional CSS classes applied to the inner table element.