Home / Function/ Table() — supabase Function Reference

Table() — supabase Function Reference

Architecture documentation for the Table() function in Table.tsx from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/docs/components/Table.tsx lines 6–41

const Table = ({ children, ...props }: TableProps) => {
  const containerRef = useRef<HTMLDivElement>(null)
  const [showShadow, setShowShadow] = useState(true)

  const handleScroll = () => {
    const container = containerRef.current

    if (container) {
      const { scrollWidth, scrollLeft, offsetWidth } = container
      const isAtEnd = scrollWidth - scrollLeft - 2 < offsetWidth
      setShowShadow(!isAtEnd)
    }
  }

  useEffect(() => {
    const container = containerRef.current
    if (container) {
      container.addEventListener('scroll', handleScroll)
      return () => container.removeEventListener('scroll', handleScroll)
    }
  }, [])

  return (
    <div className="relative">
      <span
        className={cn(
          'block md:hidden absolute inset-0 left-auto w-5 bg-gradient-to-r from-transparent to-background transition-opacity opacity-100',
          !showShadow && 'opacity-0 duration-300'
        )}
      />
      <div ref={containerRef} className="w-full overflow-x-auto break-normal">
        <table {...props}>{children}</table>
      </div>
    </div>
  )
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free