Table from data prop
We provide the complete data as a single object for a single prop:
- The
captionproperty defines the table's title - The
headproperty is the array of headers. - The
bodyarray is the list of items. Each item is an array with bare values
const tableData: TableData = {
caption: "Some elements from periodic table",
head: ["Element position", "Atomic mass", "Symbol", "Element name"], // headers
body: [
// items
[6, 12.011, "C", "Carbon"],
[7, 14.007, "N", "Nitrogen"],
[39, 88.906, "Y", "Yttrium"],
[56, 137.33, "Ba", "Barium"],
[58, 140.12, "Ce", "Cerium"],
],
}
data prop
We provide such object to the data prop. Mantine then creates the markup automatically.
<Table data={tableData} />