Table

Displays data in a tabular format.
Name
Email
Role
John Walton
Engineering
Sarah Chandler
Design
Susan Best
Product
Properties
No properties to configure
Example
Source Code
Installation
"use client";

import React from "react";
import { Table } from "@/subframe/components/Table";
import { Badge } from "@/subframe/components/Badge";
import { DropdownMenu } from "@/subframe/components/DropdownMenu";
import * as SubframeCore from "@subframe/core";
import { IconButton } from "@/subframe/components/IconButton";

function TableExample() {
  return (
    <Table
      header={
        <Table.HeaderRow>
          <Table.HeaderCell>Name</Table.HeaderCell>
          <Table.HeaderCell>Email</Table.HeaderCell>
          <Table.HeaderCell>Role</Table.HeaderCell>
        </Table.HeaderRow>
      }
    >
      <Table.Row>
        <Table.Cell>
          <span className="whitespace-nowrap text-body-bold font-body-bold text-neutral-700">
            John Walton
          </span>
        </Table.Cell>
        <Table.Cell>
          <span className="whitespace-nowrap text-body font-body text-neutral-500">
            [email protected]
          </span>
        </Table.Cell>
        <Table.Cell>
          <Badge>Engineering</Badge>
        </Table.Cell>
        <Table.Cell>
          <div className="flex grow shrink-0 basis-0 items-center justify-end">
            <SubframeCore.DropdownMenu.Root>
              <SubframeCore.DropdownMenu.Trigger asChild={true}>
                <IconButton
                  size="medium"
                  icon="FeatherMoreHorizontal"
                  onClick={(event: React.MouseEvent<HTMLButtonElement>) => {}}
                />
              </SubframeCore.DropdownMenu.Trigger>
              <SubframeCore.DropdownMenu.Portal>
                <SubframeCore.DropdownMenu.Content
                  side="bottom"
                  align="end"
                  sideOffset={8}
                  asChild={true}
                >
                  <DropdownMenu />
                </SubframeCore.DropdownMenu.Content>
              </SubframeCore.DropdownMenu.Portal>
            </SubframeCore.DropdownMenu.Root>
          </div>
        </Table.Cell>
      </Table.Row>
      <Table.Row>
        <Table.Cell>
          <span className="whitespace-nowrap text-body-bold font-body-bold text-neutral-700">
            Sarah Chandler
          </span>
        </Table.Cell>
        <Table.Cell>
          <span className="whitespace-nowrap text-body font-body text-neutral-500">
            [email protected]
          </span>
        </Table.Cell>
        <Table.Cell>
          <Badge variant="warning">Design</Badge>
        </Table.Cell>
        <Table.Cell>
          <div className="flex grow shrink-0 basis-0 items-center justify-end">
            <SubframeCore.DropdownMenu.Root>
              <SubframeCore.DropdownMenu.Trigger asChild={true}>
                <IconButton
                  size="medium"
                  icon="FeatherMoreHorizontal"
                  onClick={(event: React.MouseEvent<HTMLButtonElement>) => {}}
                />
              </SubframeCore.DropdownMenu.Trigger>
              <SubframeCore.DropdownMenu.Portal>
                <SubframeCore.DropdownMenu.Content
                  side="bottom"
                  align="end"
                  sideOffset={8}
                  asChild={true}
                >
                  <DropdownMenu />
                </SubframeCore.DropdownMenu.Content>
              </SubframeCore.DropdownMenu.Portal>
            </SubframeCore.DropdownMenu.Root>
          </div>
        </Table.Cell>
      </Table.Row>
      <Table.Row>
        <Table.Cell>
          <span className="whitespace-nowrap text-body-bold font-body-bold text-neutral-700">
            Susan Best
          </span>
        </Table.Cell>
        <Table.Cell>
          <span className="whitespace-nowrap text-body font-body text-neutral-500">
            [email protected]
          </span>
        </Table.Cell>
        <Table.Cell>
          <Badge variant="success">Product</Badge>
        </Table.Cell>
        <Table.Cell>
          <div className="flex grow shrink-0 basis-0 items-center justify-end">
            <SubframeCore.DropdownMenu.Root>
              <SubframeCore.DropdownMenu.Trigger asChild={true}>
                <IconButton
                  size="medium"
                  icon="FeatherMoreHorizontal"
                  onClick={(event: React.MouseEvent<HTMLButtonElement>) => {}}
                />
              </SubframeCore.DropdownMenu.Trigger>
              <SubframeCore.DropdownMenu.Portal>
                <SubframeCore.DropdownMenu.Content
                  side="bottom"
                  align="end"
                  sideOffset={8}
                  asChild={true}
                >
                  <DropdownMenu />
                </SubframeCore.DropdownMenu.Content>
              </SubframeCore.DropdownMenu.Portal>
            </SubframeCore.DropdownMenu.Root>
          </div>
        </Table.Cell>
      </Table.Row>
    </Table>
  );
}

export default TableExample;

Props

Table
Cell
Header Cell
Header Row
Row
Prop
Type
Default
Additional info
header
React.ReactNode
children
React.ReactNode