Skip to main content

Table

The Table component is a structured way to display data in rows and columns, with support for various styles and features.

Basic Usage

import { Table, ThemeProvider } from "@carton-org/react-neumorphism";

interface User {
name: string;
age: number;
email: string;
}

const MyComponent = () => {
const columns = ["Name", "Age", "Email"];

const users: User[] = [
{ name: "John Doe", age: 30, email: "[email protected]" },
{ name: "Jane Smith", age: 25, email: "[email protected]" },
];

return <Table<User> columns={columns} data={data} />;
};

Live Example

nameageemail
John Doe30[email protected]
Jane Smith25[email protected]

Props

NameTypeDescriptionRequiredDefault Value
columnsArray<string>Array of column definitions with headers and data accessorsYes-
dataArray<T>Array of data objects to display in the tableYes-
size"xs" | "sm" | "md" | "lg" | "xl"Size of the table cellsNo"sm"
insetbooleanWhether to apply inset styling to the tableNotrue
tableStyleReact.CSSPropertiesCustom styles for the table containerNo-
tableColumnLabelStyleReact.CSSPropertiesCustom styles for the table column headersNo-
tableRowValueStyleReact.CSSPropertiesCustom styles for the table row valuesNo-