Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

style: sticky table headers

Brad Barbin2e1d4b522b30
diff --git a/apps/carbon/app/components/Grid/Grid.tsx b/apps/carbon/app/components/Grid/Grid.tsx
index d56b722ef4..1e6a571954 100644
--- a/apps/carbon/app/components/Grid/Grid.tsx
+++ b/apps/carbon/app/components/Grid/Grid.tsx
@@ -340,8 +340,8 @@ const Grid = <T extends object>({
ref={tableContainerRef}
onKeyDown={onKeyDown}
>
- <Table>
- <Thead>
+ <Table className="absolute">
+ <Thead className="sticky top-0 z-10">
{table.getHeaderGroups().map((headerGroup) => (
<Tr key={headerGroup.id} className="h-10">
{headerGroup.headers.map((header) => {
diff --git a/apps/carbon/app/components/Table/Table.tsx b/apps/carbon/app/components/Table/Table.tsx
index f8bf781f1f..dda9bdbc5d 100644
--- a/apps/carbon/app/components/Table/Table.tsx
+++ b/apps/carbon/app/components/Table/Table.tsx
@@ -462,7 +462,7 @@ const Table = <T extends object>({
/>
<div
- className="w-full h-full bg-card"
+ className="w-full h-full bg-card overflow-x-auto"
style={{ contain: "strict" }}
ref={tableContainerRef}
onKeyDown={editMode ? onKeyDown : undefined}
@@ -475,8 +475,8 @@ const Table = <T extends object>({
>
{/* Pinned left columns */}
{withColumnOrdering ? (
- <TableBase className="bg-background border-r-4 border-border sticky left-0 z-50">
- <Thead>
+ <TableBase className="bg-background border-r-4 border-border relative">
+ <Thead className="sticky top-0 z-10">
{table.getLeftHeaderGroups().map((headerGroup) => (
<Tr key={headerGroup.id} className="h-10">
{headerGroup.headers.map((header) => {
@@ -589,8 +589,8 @@ const Table = <T extends object>({
) : null}
{/* Unpinned columns */}
- <TableBase>
- <Thead>
+ <TableBase className="relative">
+ <Thead className="sticky top-0 z-10">
{(withColumnOrdering
? table.getCenterHeaderGroups()
: table.getHeaderGroups()