Skip to main content
ninna-ui

Table

Semantic HTML table with consistent styling.

import { Table } from "@ninna-ui/data-display"
pnpm add @ninna-ui/data-display

Requires @ninna-ui/core (auto-installed) + CSS setup.

View source

Usage

Import and use the Table component in your application.

import { Table } from "@ninna-ui/data-display";
export default function Example() {
return (
<Table>
<Table.Header>
<Table.Row>
<Table.Head>Name</Table.Head>
<Table.Head>Email</Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>Alice</Table.Cell>
<Table.Cell>alice@example.com</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
);
}

Basic

A basic table with header and body rows.

NameEmailRole
Alice Johnsonalice@example.comAdmin
Bob Smithbob@example.comEditor
Carol Whitecarol@example.comViewer

With Caption

Add a caption to describe the table content.

Team Members
NameRoleStatus
AliceAdminActive
BobEditorActive
CarolViewerInactive

API Reference

Props for the Table component and its sub-components.

Table (Root)

PropTypeDefaultDescription
children*ReactNode-Table sub-components (Header, Body, Footer, Caption)
classNamestring-Additional CSS classes

Table.Row

PropTypeDefaultDescription
children*ReactNode-Row cells (Head or Cell)
classNamestring-Additional CSS classes

Table.Head

PropTypeDefaultDescription
childrenReactNode-Header cell content
classNamestring-Additional CSS classes

Table.Cell

PropTypeDefaultDescription
childrenReactNode-Cell content
classNamestring-Additional CSS classes

Table.Caption

PropTypeDefaultDescription
children*ReactNode-Caption text
classNamestring-Additional CSS classes

Accessibility

  • Table uses native HTML <table> for full semantic support
  • Caption provides an accessible table description
  • Header cells use <th> with proper scope
  • Screen readers announce cell positions and header associations