Files
blitzkit/src/components/StickyTableRoot.tsx
T
2024-07-12 19:23:15 -05:00

24 lines
538 B
TypeScript

'use client';
import { Table } from '@radix-ui/themes';
import { RootProps } from '@radix-ui/themes/dist/cjs/components/table';
import { useEffect, useRef } from 'react';
export function StickyTableRoot({ style, ...props }: RootProps) {
const table = useRef<HTMLTableElement>(null);
useEffect(() => {
table.current
?.querySelector('table')
?.style.setProperty('overflow', 'auto');
}, []);
return (
<Table.Root
{...props}
ref={table}
style={{ overflow: 'hidden', ...style }}
/>
);
}