Table
nexvyn/tableFreeComponent
A composable data table with semantic markup and a per-row hover highlight that dims into the active row.
Live preview
live · rendered by the registry
Rendered by nexvyn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.nexvyn.dev/r/table.jsonSource
1'use client'23import {4 forwardRef,5 type HTMLAttributes,6 type TdHTMLAttributes,7 type ThHTMLAttributes,8} from 'react'9import { cn } from '@/lib/utils'1011export type TableProps = HTMLAttributes<HTMLTableElement>1213export const Table = forwardRef<HTMLTableElement, TableProps>(({ className, ...props }, ref) => (14 <div className="relative w-full overflow-x-auto">15 <table ref={ref} className={cn('w-full text-[13px] border-collapse', className)} {...props} />16 </div>17))18Table.displayName = 'Table'1920export type TableHeaderProps = HTMLAttributes<HTMLTableSectionElement>2122export const TableHeader = forwardRef<HTMLTableSectionElement, TableHeaderProps>(23 ({ className, ...props }, ref) => <thead ref={ref} className={cn(className)} {...props} />,24)25TableHeader.displayName = 'TableHeader'2627export type TableBodyProps = HTMLAttributes<HTMLTableSectionElement>2829export const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(30 ({ className, ...props }, ref) => <tbody ref={ref} className={cn(className)} {...props} />,31)32TableBody.displayName = 'TableBody'3334export interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {35 isBodyRow?: boolean36}3738export const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(39 ({ isBodyRow, className, ...props }, ref) => (40 <tr41 ref={ref}42 className={cn(43 'group/row border-b border-border/60 transition-colors duration-(--motion-dur-fast) motion-reduce:transition-none',44 isBodyRow && 'hover:bg-muted',45 className,46 )}47 {...props}48 />49 ),50)51TableRow.displayName = 'TableRow'5253export type TableHeadProps = ThHTMLAttributes<HTMLTableCellElement>5455export const TableHead = forwardRef<HTMLTableCellElement, TableHeadProps>(56 ({ className, ...props }, ref) => (57 <th58 ref={ref}59 scope="col"60 className={cn('px-3 py-2 text-start font-semibold text-foreground', className)}61 {...props}62 />63 ),64)65TableHead.displayName = 'TableHead'6667export type TableCellProps = TdHTMLAttributes<HTMLTableCellElement>6869export const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(70 ({ className, ...props }, ref) => (71 <td72 ref={ref}73 className={cn(74 'px-3 py-2 text-start text-muted-foreground transition-colors duration-(--motion-dur-fast) motion-reduce:transition-none group-hover/row:text-foreground',75 className,76 )}77 {...props}78 />79 ),80)81TableCell.displayName = 'TableCell'8283// … truncated
Files it writes
More from nexvyn
All 33 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Badgebadge | nexvyn | Components | Free | 2 deps · 2 files | |
| Bars Themebars-theme | nexvyn | Components | Free | 1 dep · 3 files | |
| Bounce Sidebarbounce-sidebar | nexvyn | Components | Free | 1 dep · 2 files | |
| Breadcrumbsbreadcrumbs | nexvyn | Components | Free | 1 dep · 2 files | |
| Checkboxcheckbox | nexvyn | Components | Free | 1 dep · 3 files | |
| Clipboard Fieldclipboard-field | nexvyn | Components | Free | no deps · 2 files | |
| Color Pickercolor-picker | nexvyn | Components | Free | no deps · 16 files | |
| Comboboxcombobox | nexvyn | Components | Free | 1 dep · 2 files |
