Files
blitzkit/packages/website/src/components/StickyTableRoot.tsx
T

21 lines
526 B
TypeScript
Raw Normal View History

2024-07-02 20:07:16 -05:00
import { Table } from '@radix-ui/themes';
2024-09-23 10:49:54 -05:00
import type { RootProps } from '@radix-ui/themes/src/components/table.js';
2024-07-02 20:07:16 -05:00
import { useEffect, useRef } from 'react';
2024-07-12 19:23:15 -05:00
export function StickyTableRoot({ style, ...props }: RootProps) {
2024-07-02 20:07:16 -05:00
const table = useRef<HTMLTableElement>(null);
useEffect(() => {
table.current
?.querySelector('table')
?.style.setProperty('overflow', 'auto');
}, []);
2024-07-12 19:23:15 -05:00
return (
<Table.Root
{...props}
ref={table}
style={{ overflow: 'hidden', ...style }}
/>
);
2024-07-02 20:07:16 -05:00
}