Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat(design-system): remove table head hover in design system (#51452)

kemal.earth6119ea1eb510
diff --git a/apps/studio/components/ui/DataTable/DataTableInfinite.tsx b/apps/studio/components/ui/DataTable/DataTableInfinite.tsx
index b56a4b991cc..c2b77c2094c 100644
--- a/apps/studio/components/ui/DataTable/DataTableInfinite.tsx
+++ b/apps/studio/components/ui/DataTable/DataTableInfinite.tsx
@@ -92,7 +92,7 @@ export function DataTableInfinite<TData, TValue, TMeta>({
)}
>
<TableHeader className="sticky top-0 z-1">
- <TableRow className={cn(TableRowClassName, 'bg-surface-75')}>
+ <TableRow className={cn(TableRowClassName, 'bg-surface-75 hover:bg-surface-75')}>
{headers.map((header) => {
const sort = header.column.getIsSorted()
const canResize = header.column.getCanResize()
diff --git a/packages/ui/src/components/shadcn/ui/table.tsx b/packages/ui/src/components/shadcn/ui/table.tsx
index f0948c89ff7..295686e4407 100644
--- a/packages/ui/src/components/shadcn/ui/table.tsx
+++ b/packages/ui/src/components/shadcn/ui/table.tsx
@@ -36,7 +36,16 @@ const TableBody = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
- <tbody ref={ref} className={cn('[&_tr:last-child]:border-0', className)} {...props} />
+ <tbody
+ ref={ref}
+ className={cn(
+ '[&_tr:last-child]:border-0',
+ // :where() keeps this at lower specificity than a row's own hover:* class, so rows can opt out (e.g. loading/empty states)
+ '[:where(&)>tr]:hover:bg-surface-200',
+ className
+ )}
+ {...props}
+ />
))
TableBody.displayName = 'TableBody'
@@ -52,10 +61,7 @@ const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTML
({ className, ...props }, ref) => (
<tr
ref={ref}
- className={cn(
- 'border-b group data-[state=selected]:bg-muted hover:bg-surface-200',
- className
- )}
+ className={cn('border-b group data-[state=selected]:bg-muted', className)}
{...props}
/>
)