ตารางข้อมูล
DataTable
A complete data table from columns and rows: search, criteria and filter chips, sortable headings, paging, row selection with bulk actions, a total row, and the loading, error, first-use and no-results states. At phone width each row becomes a labelled block. Pass all rows and the table searches, sorts and pages them itself. For a list the core API pages, pass total and handle onSortChange, search.onChange and onPageChange with a new query.
ใช้แสดงรายการข้อมูลทุกแบบ หน้าจอส่งคอลัมน์และแถวเป็นข้อมูล แล้วตารางจัดการค้นหา เรียงลำดับ แบ่งหน้า เลือกหลายแถว แถวรวม และสถานะต่าง ๆ เอง หน้าจอไม่ต้องเขียน <table> หรือคลาสของแนวทางการออกแบบ ถ้าทุกแถวอยู่ในหน้าจอแล้ว ส่ง rows ทั้งหมด ถ้า API ของ core แบ่งหน้าให้ ส่ง total และรับการเปลี่ยนแปลงเพื่อดึงข้อมูลใหม่
import { DataTable } from "@bsru/ui";ตัวอย่าง
ตารางจากข้อมูลอย่างเดียว
ส่งคอลัมน์และแถวทั้งหมด ตารางค้นหา เรียง และแบ่งหน้าเอง kind บอกวิธีแสดงค่า: money แสดงทศนิยมสองตำแหน่ง date แสดงปีพุทธศักราช badge แปลงค่าเป็นป้ายสถานะ ตารางข้อมูลด้านล่างแสดงสามแถวแรกจาก 23 แถว
พบ 23 คำขอ
| ผู้ขาย | |||||
|---|---|---|---|---|---|
| PR-2570-0023 | เครื่องฉายภาพ | ห้างหุ้นส่วน สมมติV-0002 | 11 พ.ย. 2569 | 43,400.00 | รออนุมัติ |
| PR-2570-0022 | ค่าเช่าซอฟต์แวร์ | บริษัท ทดสอบ จำกัดV-0001 | 8 ต.ค. 2569 | 69,250.00 | ไม่อนุมัติ |
| PR-2570-0021 | หมึกพิมพ์ | ร้าน ตัวอย่างการค้าV-0003 | 5 ธ.ค. 2569 | 17,750.00 | ร่าง |
| PR-2570-0020 | โต๊ะและเก้าอี้ห้องเรียน | ห้างหุ้นส่วน สมมติV-0002 | 2 พ.ย. 2569 | 90,750.00 | อนุมัติแล้ว |
| PR-2570-0019 | จ้างซ่อมเครื่องปรับอากาศ | บริษัท ทดสอบ จำกัดV-0001 | 27 ต.ค. 2569 | 46,500.00 | รออนุมัติ |
| PR-2570-0018 | วัสดุสำนักงาน | ร้าน ตัวอย่างการค้าV-0003 | 24 ธ.ค. 2569 | 22,750.00 | อนุมัติแล้ว |
| PR-2570-0017 | ครุภัณฑ์คอมพิวเตอร์โน้ตบุ๊ก 5 เครื่อง | ห้างหุ้นส่วน สมมติV-0002 | 21 พ.ย. 2569 | 154,000.00 | รออนุมัติ |
| PR-2570-0016 | จ้างทำความสะอาด | บริษัท ทดสอบ จำกัดV-0001 | 18 ต.ค. 2569 | 98,750.00 | ไม่อนุมัติ |
| PR-2570-0015 | เครื่องฉายภาพ | ร้าน ตัวอย่างการค้าV-0003 | 15 ธ.ค. 2569 | 41,400.00 | ร่าง |
| PR-2570-0014 | ค่าเช่าซอฟต์แวร์ | ห้างหุ้นส่วน สมมติV-0002 | 12 พ.ย. 2569 | 67,250.00 | อนุมัติแล้ว |
| รวมทุกหน้า | 1,486,700.00 | ||||
const columns: DataColumn<Request>[] = [
{ key: "no", label: "เลขที่", sortable: true, opens: true },
{ key: "item", label: "รายการ", sortable: true },
{
key: "vendor",
label: "ผู้ขาย",
sub: "vendorCode",
hideOnPhone: true,
},
{ key: "date", label: "วันที่", kind: "date", sortable: true },
{
key: "amount",
label: "วงเงิน (บาท)",
kind: "money",
sortable: true,
total: true,
},
{
key: "status",
label: "สถานะ",
kind: "badge",
sortable: true,
badges: {
draft: { tone: "draft", label: "ร่าง", icon: Pencil },
pending: { tone: "pending", label: "รออนุมัติ", icon: Clock },
approved: { tone: "approved", label: "อนุมัติแล้ว", icon: Check },
rejected: { tone: "rejected", label: "ไม่อนุมัติ", icon: X },
},
},
];
<DataTable
caption="คำขอซื้อขอจ้าง"
columns={columns}
rows={rows}
rowKey="no"
search={{ placeholder: "ค้นหาเลขที่ รายการ หรือผู้ขาย" }}
defaultSort={{ key: "no", dir: "desc" }}
noun="คำขอ"
/>| Prop | ค่าในตัวอย่างนี้ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|---|
| caption* จำเป็น | "คำขอซื้อขอจ้าง" | string | Names the table for screen readers, such as คำขอซื้อขอจ้าง. |
| columns* จำเป็น | รายการ 6 รายการ[
{ key: "no", label: "เลขที่", sortable: true, opens: true },
{ key: "item", label: "รายการ", sortable: true },
{
key: "vendor",
label: "ผู้ขาย",
sub: "vendorCode",
hideOnPhone: true,
},
{ key: "date", label: "วันที่", kind: "date", sortable: true },
{
key: "amount",
label: "วงเงิน (บาท)",
kind: "money",
sortable: true,
total: true,
},
{
key: "status",
label: "สถานะ",
kind: "badge",
sortable: true,
badges: {
draft: { tone: "draft", label: "ร่าง", icon: Pencil },
pending: { tone: "pending", label: "รออนุมัติ", icon: Clock },
approved: { tone: "approved", label: "อนุมัติแล้ว", icon: Check },
rejected: { tone: "rejected", label: "ไม่อนุมัติ", icon: X },
},
},
] | readonly DataColumn<R>[] | — |
| rowKey* จำเป็น | "no" | keyof R & string | The field that identifies a row, such as no. Selection and onOpen use its value. |
| search | { placeholder: "ค้นหาเลขที่ รายการ หรือผู้ขาย" } | TableSearch | Shows a search box. Without total, the table searches the searchable columns itself. |
| defaultSort | { key: "no", dir: "desc" } | TableSort | The sort on first render, when the table keeps it. |
| noun | "คำขอ" | string | The record name in the result count, such as รายการ or คำขอ. |
| rows* จำเป็น | รายการ 3 รายการ[
{
no: "PR-2570-0001",
item: [
"ครุภัณฑ์คอมพิวเตอร์โน้ตบุ๊ก 5 เครื่อง",
"Notebook computers, 5 units",
],
unit: "หน่วยงาน ก",
vendor: "บริษัท ทดสอบ จำกัด",
vendorCode: "V-0001",
date: "2026-10-01",
amount: 150000,
status: "pending",
},
{
no: "PR-2570-0002",
item: ["วัสดุสำนักงาน", "Office supplies"],
unit: "หน่วยงาน ข",
vendor: "ห้างหุ้นส่วน สมมติ",
vendorCode: "V-0002",
date: "2026-11-04",
amount: 18750,
status: "approved",
},
{
no: "PR-2570-0003",
item: ["จ้างซ่อมเครื่องปรับอากาศ", "Air conditioner repair"],
unit: "หน่วยงาน ค",
vendor: "ร้าน ตัวอย่างการค้า",
vendorCode: "V-0003",
date: "2026-12-07",
amount: 42500,
status: "draft",
},
] | readonly R[] | All rows. With total set, only the rows of the current page. |
| onSortChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: TableSort) => void | Hears every sort change. Go back to page 1. |
| onPageChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onPageSizeChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onOpen | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => void | Opens a row, from the value in an opens column and a quick-view button. Use for a drawer. |
| openHref | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The URL of a row's record page. The value in an opens column becomes a link. |
| openLabel | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The quick-view button's accessible name for a row. ดูรายละเอียด and the row key by default. |
เลือกหลายแถวและเปิดรายการ
selection เพิ่มช่องเลือกในทุกแถวและแถบคำสั่งเมื่อมีแถวที่เลือก onRun ได้รับรหัสของทุกแถวที่เลือก onOpen ทำให้ค่าในคอลัมน์ที่มี opens กดได้ และเพิ่มปุ่มดูรายละเอียด ได้รับแถวนั้น หน้าจอเก็บแถวไว้ใน state แล้วแสดงใน Drawer ลองกดเลขที่หรือปุ่มดูรายละเอียด ใช้ openHref แทนเมื่อเปิดเป็นหน้าใหม่
พบ 23 คำขอ
| ผู้ขาย | จัดการ | ||||||
|---|---|---|---|---|---|---|---|
| ครุภัณฑ์คอมพิวเตอร์โน้ตบุ๊ก 5 เครื่อง | บริษัท ทดสอบ จำกัดV-0001 | 1 ต.ค. 2569 | 150,000.00 | รออนุมัติ | |||
| วัสดุสำนักงาน | ห้างหุ้นส่วน สมมติV-0002 | 4 พ.ย. 2569 | 18,750.00 | อนุมัติแล้ว | |||
| จ้างซ่อมเครื่องปรับอากาศ | ร้าน ตัวอย่างการค้าV-0003 | 7 ธ.ค. 2569 | 42,500.00 | ร่าง | |||
| โต๊ะและเก้าอี้ห้องเรียน | บริษัท ทดสอบ จำกัดV-0001 | 10 ต.ค. 2569 | 86,750.00 | ไม่อนุมัติ | |||
| หมึกพิมพ์ | ห้างหุ้นส่วน สมมติV-0002 | 13 พ.ย. 2569 | 13,750.00 | รออนุมัติ | |||
| ค่าเช่าซอฟต์แวร์ | ร้าน ตัวอย่างการค้าV-0003 | 16 ธ.ค. 2569 | 65,250.00 | อนุมัติแล้ว | |||
| เครื่องฉายภาพ | บริษัท ทดสอบ จำกัดV-0001 | 19 ต.ค. 2569 | 39,400.00 | รออนุมัติ | |||
| จ้างทำความสะอาด | ห้างหุ้นส่วน สมมติV-0002 | 22 พ.ย. 2569 | 96,750.00 | อนุมัติแล้ว | |||
| ครุภัณฑ์คอมพิวเตอร์โน้ตบุ๊ก 5 เครื่อง | ร้าน ตัวอย่างการค้าV-0003 | 25 ธ.ค. 2569 | 152,000.00 | ร่าง | |||
| วัสดุสำนักงาน | บริษัท ทดสอบ จำกัดV-0001 | 28 ต.ค. 2569 | 20,750.00 | ไม่อนุมัติ | |||
| รวมทุกหน้า | 1,486,700.00 | ||||||
const columns: DataColumn<Request>[] = [
{ key: "no", label: "เลขที่", sortable: true, opens: true },
{ key: "item", label: "รายการ", sortable: true },
{
key: "vendor",
label: "ผู้ขาย",
sub: "vendorCode",
hideOnPhone: true,
},
{ key: "date", label: "วันที่", kind: "date", sortable: true },
{
key: "amount",
label: "วงเงิน (บาท)",
kind: "money",
sortable: true,
total: true,
},
{
key: "status",
label: "สถานะ",
kind: "badge",
sortable: true,
badges: {
draft: { tone: "draft", label: "ร่าง", icon: Pencil },
pending: { tone: "pending", label: "รออนุมัติ", icon: Clock },
approved: { tone: "approved", label: "อนุมัติแล้ว", icon: Check },
rejected: { tone: "rejected", label: "ไม่อนุมัติ", icon: X },
},
},
];
const actions: BulkAction[] = [
{ label: "ส่งออก", icon: Download, onRun: (keys) => exportRequests(keys) },
];
// The row the drawer shows, or null while it's closed.
const [opened, setOpened] = useState<Request | null>(null);
<DataTable
caption="คำขอซื้อขอจ้าง"
columns={columns}
rows={rows}
rowKey="no"
search={{ placeholder: "ค้นหาเลขที่ รายการ หรือผู้ขาย" }}
selection={{ actions }}
onOpen={setOpened}
noun="คำขอ"
/>
<Drawer
open={opened !== null}
onClose={() => setOpened(null)}
title={opened?.no ?? ""}
summary={opened && {
title: opened.item,
// The same badge as the status column: { tone, icon, label } for this status.
status: badges[opened.status],
figure: { label: "วงเงิน", value: money(opened.amount), unit: "บาท" },
}}
>
{opened ? (
<RecordSection title="รายละเอียด">
<FieldList fields={requestFields(opened)} />
</RecordSection>
) : null}
</Drawer>| Prop | ค่าในตัวอย่างนี้ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|---|
| caption* จำเป็น | "คำขอซื้อขอจ้าง" | string | Names the table for screen readers, such as คำขอซื้อขอจ้าง. |
| columns* จำเป็น | รายการ 6 รายการ[
{ key: "no", label: "เลขที่", sortable: true, opens: true },
{ key: "item", label: "รายการ", sortable: true },
{
key: "vendor",
label: "ผู้ขาย",
sub: "vendorCode",
hideOnPhone: true,
},
{ key: "date", label: "วันที่", kind: "date", sortable: true },
{
key: "amount",
label: "วงเงิน (บาท)",
kind: "money",
sortable: true,
total: true,
},
{
key: "status",
label: "สถานะ",
kind: "badge",
sortable: true,
badges: {
draft: { tone: "draft", label: "ร่าง", icon: Pencil },
pending: { tone: "pending", label: "รออนุมัติ", icon: Clock },
approved: { tone: "approved", label: "อนุมัติแล้ว", icon: Check },
rejected: { tone: "rejected", label: "ไม่อนุมัติ", icon: X },
},
},
] | readonly DataColumn<R>[] | — |
| rowKey* จำเป็น | "no" | keyof R & string | The field that identifies a row, such as no. Selection and onOpen use its value. |
| search | { placeholder: "ค้นหาเลขที่ รายการ หรือผู้ขาย" } | TableSearch | Shows a search box. Without total, the table searches the searchable columns itself. |
| selection | ออบเจกต์ 1 ฟิลด์{ actions: [{ label: "ส่งออก", icon: Download }] } | TableSelection | Adds a checkbox to each row, and a bar of actions while any row is chosen. |
| noun | "คำขอ" | string | The record name in the result count, such as รายการ or คำขอ. |
| rows* จำเป็น | รายการ 3 รายการ[
{
no: "PR-2570-0001",
item: [
"ครุภัณฑ์คอมพิวเตอร์โน้ตบุ๊ก 5 เครื่อง",
"Notebook computers, 5 units",
],
unit: "หน่วยงาน ก",
vendor: "บริษัท ทดสอบ จำกัด",
vendorCode: "V-0001",
date: "2026-10-01",
amount: 150000,
status: "pending",
},
{
no: "PR-2570-0002",
item: ["วัสดุสำนักงาน", "Office supplies"],
unit: "หน่วยงาน ข",
vendor: "ห้างหุ้นส่วน สมมติ",
vendorCode: "V-0002",
date: "2026-11-04",
amount: 18750,
status: "approved",
},
{
no: "PR-2570-0003",
item: ["จ้างซ่อมเครื่องปรับอากาศ", "Air conditioner repair"],
unit: "หน่วยงาน ค",
vendor: "ร้าน ตัวอย่างการค้า",
vendorCode: "V-0003",
date: "2026-12-07",
amount: 42500,
status: "draft",
},
] | readonly R[] | All rows. With total set, only the rows of the current page. |
| onSortChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: TableSort) => void | Hears every sort change. Go back to page 1. |
| onPageChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onPageSizeChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onOpen | setOpened | (row: R) => void | Opens a row, from the value in an opens column and a quick-view button. Use for a drawer. |
| openHref | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The URL of a row's record page. The value in an opens column becomes a link. |
| openLabel | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The quick-view button's accessible name for a row. ดูรายละเอียด and the row key by default. |
เงื่อนไขค้นหาและชิปตัวกรอง
หน้าจอเก็บตัวกรองไว้เอง กรองแถว แล้วส่งชิปของตัวกรองที่ใช้อยู่ panel คือแบบฟอร์มเงื่อนไขที่สร้างจากคอมโพเนนต์ของไลบรารี แสดงใต้ปุ่มเงื่อนไขค้นหา
พบ 8 คำขอ
สถานะ
| ผู้ขาย | |||||
|---|---|---|---|---|---|
| PR-2570-0001 | ครุภัณฑ์คอมพิวเตอร์โน้ตบุ๊ก 5 เครื่อง | บริษัท ทดสอบ จำกัดV-0001 | 1 ต.ค. 2569 | 150,000.00 | รออนุมัติ |
| PR-2570-0005 | หมึกพิมพ์ | ห้างหุ้นส่วน สมมติV-0002 | 13 พ.ย. 2569 | 13,750.00 | รออนุมัติ |
| PR-2570-0007 | เครื่องฉายภาพ | บริษัท ทดสอบ จำกัดV-0001 | 19 ต.ค. 2569 | 39,400.00 | รออนุมัติ |
| PR-2570-0011 | จ้างซ่อมเครื่องปรับอากาศ | ห้างหุ้นส่วน สมมติV-0002 | 3 พ.ย. 2569 | 44,500.00 | รออนุมัติ |
| PR-2570-0013 | หมึกพิมพ์ | บริษัท ทดสอบ จำกัดV-0001 | 9 ต.ค. 2569 | 15,750.00 | รออนุมัติ |
| PR-2570-0017 | ครุภัณฑ์คอมพิวเตอร์โน้ตบุ๊ก 5 เครื่อง | ห้างหุ้นส่วน สมมติV-0002 | 21 พ.ย. 2569 | 154,000.00 | รออนุมัติ |
| PR-2570-0019 | จ้างซ่อมเครื่องปรับอากาศ | บริษัท ทดสอบ จำกัดV-0001 | 27 ต.ค. 2569 | 46,500.00 | รออนุมัติ |
| PR-2570-0023 | เครื่องฉายภาพ | ห้างหุ้นส่วน สมมติV-0002 | 11 พ.ย. 2569 | 43,400.00 | รออนุมัติ |
| รวมทุกหน้า | 507,300.00 | ||||
const [statuses, setStatuses] = useState<string[]>(["pending"]);
const shown = statuses.length ? rows.filter((r) => statuses.includes(r.status)) : rows;
const chips: FilterChip[] = statuses.map((s) => ({
key: s,
label: statusLabel(s),
onRemove: () => setStatuses(statuses.filter((v) => v !== s)),
}));
<DataTable
caption="คำขอซื้อขอจ้าง"
columns={columns}
rows={shown}
rowKey="no"
search={{ placeholder: "ค้นหาเลขที่ รายการ หรือผู้ขาย" }}
filters={{
chips,
onClearAll: () => setStatuses([]),
panel: (
<Select multiple label="สถานะ" placeholder="ทุกสถานะ"
options={statusOptions} value={statuses} onChange={setStatuses} />
),
}}
noun="คำขอ"
/>| Prop | ค่าในตัวอย่างนี้ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|---|
| caption* จำเป็น | "คำขอซื้อขอจ้าง" | string | Names the table for screen readers, such as คำขอซื้อขอจ้าง. |
| columns* จำเป็น | รายการ 6 รายการ[
{ key: "no", label: "เลขที่", sortable: true, opens: true },
{ key: "item", label: "รายการ", sortable: true },
{
key: "vendor",
label: "ผู้ขาย",
sub: "vendorCode",
hideOnPhone: true,
},
{ key: "date", label: "วันที่", kind: "date", sortable: true },
{
key: "amount",
label: "วงเงิน (บาท)",
kind: "money",
sortable: true,
total: true,
},
{
key: "status",
label: "สถานะ",
kind: "badge",
sortable: true,
badges: {
draft: { tone: "draft", label: "ร่าง", icon: Pencil },
pending: { tone: "pending", label: "รออนุมัติ", icon: Clock },
approved: { tone: "approved", label: "อนุมัติแล้ว", icon: Check },
rejected: { tone: "rejected", label: "ไม่อนุมัติ", icon: X },
},
},
] | readonly DataColumn<R>[] | — |
| rowKey* จำเป็น | "no" | keyof R & string | The field that identifies a row, such as no. Selection and onOpen use its value. |
| search | { placeholder: "ค้นหาเลขที่ รายการ หรือผู้ขาย" } | TableSearch | Shows a search box. Without total, the table searches the searchable columns itself. |
| filters | ออบเจกต์ 1 ฟิลด์{ chips: [{ key: "pending", label: "รออนุมัติ" }] } | TableFilters | Shows filter chips, and a criteria panel when it has one. The screen filters the rows. |
| noun | "คำขอ" | string | The record name in the result count, such as รายการ or คำขอ. |
| rows* จำเป็น | รายการ 3 รายการ[
{
no: "PR-2570-0001",
item: [
"ครุภัณฑ์คอมพิวเตอร์โน้ตบุ๊ก 5 เครื่อง",
"Notebook computers, 5 units",
],
unit: "หน่วยงาน ก",
vendor: "บริษัท ทดสอบ จำกัด",
vendorCode: "V-0001",
date: "2026-10-01",
amount: 150000,
status: "pending",
},
{
no: "PR-2570-0002",
item: ["วัสดุสำนักงาน", "Office supplies"],
unit: "หน่วยงาน ข",
vendor: "ห้างหุ้นส่วน สมมติ",
vendorCode: "V-0002",
date: "2026-11-04",
amount: 18750,
status: "approved",
},
{
no: "PR-2570-0003",
item: ["จ้างซ่อมเครื่องปรับอากาศ", "Air conditioner repair"],
unit: "หน่วยงาน ค",
vendor: "ร้าน ตัวอย่างการค้า",
vendorCode: "V-0003",
date: "2026-12-07",
amount: 42500,
status: "draft",
},
] | readonly R[] | All rows. With total set, only the rows of the current page. |
| onSortChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: TableSort) => void | Hears every sort change. Go back to page 1. |
| onPageChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onPageSizeChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onOpen | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => void | Opens a row, from the value in an opens column and a quick-view button. Use for a drawer. |
| openHref | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The URL of a row's record page. The value in an opens column becomes a link. |
| openLabel | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The quick-view button's accessible name for a row. ดูรายละเอียด and the row key by default. |
รายการที่ API ของ core แบ่งหน้า
ส่ง total เมื่อ API แบ่งหน้าให้ ตารางจะแสดงแถวตามที่ได้รับ และแจ้งการค้นหา (หลังหยุดพิมพ์ครู่หนึ่ง) การเรียง หน้า และจำนวนต่อหน้า ให้หน้าจอดึงข้อมูลใหม่ totals คือยอดรวมจาก API ตัวอย่างนี้จำลองการรอ API ครึ่งวินาที
กำลังโหลด
| ผู้ขาย | |||||
|---|---|---|---|---|---|
const [q, setQ] = useState("");
const [sort, setSort] = useState<TableSort>();
const [page, setPage] = useState(1);
const [size, setSize] = useState(10);
// Fetches GET /api/requests?q=&sort=&page=&size= again whenever these change.
const result = useRequests({ q, sort, page, size });
<DataTable
caption="คำขอซื้อขอจ้าง"
columns={columns}
rows={result?.rows ?? []}
rowKey="no"
total={result?.total ?? 0}
totals={{ amount: result?.sum ?? 0 }}
status={result ? "ready" : "loading"}
search={{ placeholder: "ค้นหาเลขที่ รายการ หรือผู้ขาย", value: q, onChange: setQ }}
sort={sort}
onSortChange={setSort}
page={page}
onPageChange={setPage}
pageSize={size}
onPageSizeChange={setSize}
noun="คำขอ"
/>| Prop | ค่าในตัวอย่างนี้ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|---|
| caption* จำเป็น | "คำขอซื้อขอจ้าง" | string | Names the table for screen readers, such as คำขอซื้อขอจ้าง. |
| columns* จำเป็น | รายการ 6 รายการ[
{ key: "no", label: "เลขที่", sortable: true, opens: true },
{ key: "item", label: "รายการ", sortable: true },
{
key: "vendor",
label: "ผู้ขาย",
sub: "vendorCode",
hideOnPhone: true,
},
{ key: "date", label: "วันที่", kind: "date", sortable: true },
{
key: "amount",
label: "วงเงิน (บาท)",
kind: "money",
sortable: true,
total: true,
},
{
key: "status",
label: "สถานะ",
kind: "badge",
sortable: true,
badges: {
draft: { tone: "draft", label: "ร่าง", icon: Pencil },
pending: { tone: "pending", label: "รออนุมัติ", icon: Clock },
approved: { tone: "approved", label: "อนุมัติแล้ว", icon: Check },
rejected: { tone: "rejected", label: "ไม่อนุมัติ", icon: X },
},
},
] | readonly DataColumn<R>[] | — |
| rowKey* จำเป็น | "no" | keyof R & string | The field that identifies a row, such as no. Selection and onOpen use its value. |
| rows* จำเป็น | รายการ 3 รายการ[
{
no: "PR-2570-0001",
item: [
"ครุภัณฑ์คอมพิวเตอร์โน้ตบุ๊ก 5 เครื่อง",
"Notebook computers, 5 units",
],
unit: "หน่วยงาน ก",
vendor: "บริษัท ทดสอบ จำกัด",
vendorCode: "V-0001",
date: "2026-10-01",
amount: 150000,
status: "pending",
},
{
no: "PR-2570-0002",
item: ["วัสดุสำนักงาน", "Office supplies"],
unit: "หน่วยงาน ข",
vendor: "ห้างหุ้นส่วน สมมติ",
vendorCode: "V-0002",
date: "2026-11-04",
amount: 18750,
status: "approved",
},
{
no: "PR-2570-0003",
item: ["จ้างซ่อมเครื่องปรับอากาศ", "Air conditioner repair"],
unit: "หน่วยงาน ค",
vendor: "ร้าน ตัวอย่างการค้า",
vendorCode: "V-0003",
date: "2026-12-07",
amount: 42500,
status: "draft",
},
] | readonly R[] | All rows. With total set, only the rows of the current page. |
| total | 23 | number | How many rows match on the server, for a list the core API pages. The table then shows rows as given. |
| totals | { amount: 1734000 } | Readonly<Partial<Record<keyof R & string, number>>> | Totals from the core API for a paged list, by column key. Without total, the table adds up total columns itself. |
| status | "ready" | "ready" | "loading" | "error" ค่าที่ใช้ได้: "ready""loading""error" | loading shows placeholder rows, error shows the error. ready by default. |
| page | 1 | number | The page shown, from 1, when the screen keeps it. |
| pageSize | 10 | number | Rows per page, when the screen keeps it. 10 by default. |
| onSortChange | setSort | (next: TableSort) => void | Hears every sort change. Go back to page 1. |
| onPageChange | setPage | (next: number) => void | — |
| onPageSizeChange | setSize | (next: number) => void | — |
| onOpen | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => void | Opens a row, from the value in an opens column and a quick-view button. Use for a drawer. |
| openHref | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The URL of a row's record page. The value in an opens column becomes a link. |
| openLabel | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The quick-view button's accessible name for a row. ดูรายละเอียด and the row key by default. |
กำลังโหลด
status loading แสดงแถวโครงร่างตามคอลัมน์จริง และซ่อนตัวแบ่งหน้าและยอดรวม
กำลังโหลด
| ผู้ขาย | |||||
|---|---|---|---|---|---|
const columns: DataColumn<Request>[] = [
{ key: "no", label: "เลขที่", sortable: true, opens: true },
{ key: "item", label: "รายการ", sortable: true },
{
key: "vendor",
label: "ผู้ขาย",
sub: "vendorCode",
hideOnPhone: true,
},
{ key: "date", label: "วันที่", kind: "date", sortable: true },
{
key: "amount",
label: "วงเงิน (บาท)",
kind: "money",
sortable: true,
total: true,
},
{
key: "status",
label: "สถานะ",
kind: "badge",
sortable: true,
badges: {
draft: { tone: "draft", label: "ร่าง", icon: Pencil },
pending: { tone: "pending", label: "รออนุมัติ", icon: Clock },
approved: { tone: "approved", label: "อนุมัติแล้ว", icon: Check },
rejected: { tone: "rejected", label: "ไม่อนุมัติ", icon: X },
},
},
];
<DataTable
caption="คำขอซื้อขอจ้าง"
columns={columns}
rows={rows}
rowKey="no"
search={{ placeholder: "ค้นหาเลขที่ รายการ หรือผู้ขาย" }}
status="loading"
/>| Prop | ค่าในตัวอย่างนี้ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|---|
| caption* จำเป็น | "คำขอซื้อขอจ้าง" | string | Names the table for screen readers, such as คำขอซื้อขอจ้าง. |
| columns* จำเป็น | รายการ 6 รายการ[
{ key: "no", label: "เลขที่", sortable: true, opens: true },
{ key: "item", label: "รายการ", sortable: true },
{
key: "vendor",
label: "ผู้ขาย",
sub: "vendorCode",
hideOnPhone: true,
},
{ key: "date", label: "วันที่", kind: "date", sortable: true },
{
key: "amount",
label: "วงเงิน (บาท)",
kind: "money",
sortable: true,
total: true,
},
{
key: "status",
label: "สถานะ",
kind: "badge",
sortable: true,
badges: {
draft: { tone: "draft", label: "ร่าง", icon: Pencil },
pending: { tone: "pending", label: "รออนุมัติ", icon: Clock },
approved: { tone: "approved", label: "อนุมัติแล้ว", icon: Check },
rejected: { tone: "rejected", label: "ไม่อนุมัติ", icon: X },
},
},
] | readonly DataColumn<R>[] | — |
| rows* จำเป็น | [] | readonly R[] | All rows. With total set, only the rows of the current page. |
| rowKey* จำเป็น | "no" | keyof R & string | The field that identifies a row, such as no. Selection and onOpen use its value. |
| status | "loading" | "ready" | "loading" | "error" ค่าที่ใช้ได้: "ready""loading""error" | loading shows placeholder rows, error shows the error. ready by default. |
| onSortChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: TableSort) => void | Hears every sort change. Go back to page 1. |
| onPageChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onPageSizeChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onOpen | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => void | Opens a row, from the value in an opens column and a quick-view button. Use for a drawer. |
| openHref | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The URL of a row's record page. The value in an opens column becomes a link. |
| openLabel | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The quick-view button's accessible name for a row. ดูรายละเอียด and the row key by default. |
โหลดไม่สำเร็จ
status error แสดงสิ่งที่เกิดขึ้น สิ่งที่ควรทำ และรหัสอ้างอิงสำหรับผู้ดูแลระบบ onRetry เพิ่มปุ่มลองอีกครั้ง
โหลดรายการไม่สำเร็จ
| ผู้ขาย | |||||
|---|---|---|---|---|---|
โหลดรายการไม่สำเร็จ ลองอีกครั้ง ถ้ายังไม่สำเร็จ แจ้งผู้ดูแลระบบพร้อมรหัสอ้างอิง รหัสอ้างอิง | |||||
const columns: DataColumn<Request>[] = [
{ key: "no", label: "เลขที่", sortable: true, opens: true },
{ key: "item", label: "รายการ", sortable: true },
{
key: "vendor",
label: "ผู้ขาย",
sub: "vendorCode",
hideOnPhone: true,
},
{ key: "date", label: "วันที่", kind: "date", sortable: true },
{
key: "amount",
label: "วงเงิน (บาท)",
kind: "money",
sortable: true,
total: true,
},
{
key: "status",
label: "สถานะ",
kind: "badge",
sortable: true,
badges: {
draft: { tone: "draft", label: "ร่าง", icon: Pencil },
pending: { tone: "pending", label: "รออนุมัติ", icon: Clock },
approved: { tone: "approved", label: "อนุมัติแล้ว", icon: Check },
rejected: { tone: "rejected", label: "ไม่อนุมัติ", icon: X },
},
},
];
<DataTable
caption="คำขอซื้อขอจ้าง"
columns={columns}
rows={rows}
rowKey="no"
status="error"
error={{
title: "โหลดรายการไม่สำเร็จ",
body: "ลองอีกครั้ง ถ้ายังไม่สำเร็จ แจ้งผู้ดูแลระบบพร้อมรหัสอ้างอิง",
correlationId: "c0ffee00-0000-4000-8000-000000000001",
onRetry: reload,
}}
/>| Prop | ค่าในตัวอย่างนี้ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|---|
| status | "error" | "ready" | "loading" | "error" ค่าที่ใช้ได้: "ready""loading""error" | loading shows placeholder rows, error shows the error. ready by default. |
| error | ออบเจกต์ 3 ฟิลด์{
title: "โหลดรายการไม่สำเร็จ",
body: "ลองอีกครั้ง ถ้ายังไม่สำเร็จ แจ้งผู้ดูแลระบบพร้อมรหัสอ้างอิง",
correlationId: "c0ffee00-0000-4000-8000-000000000001",
} | TableError | What to say when status is error. |
| onSortChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: TableSort) => void | Hears every sort change. Go back to page 1. |
| onPageChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onPageSizeChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onOpen | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => void | Opens a row, from the value in an opens column and a quick-view button. Use for a drawer. |
| openHref | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The URL of a row's record page. The value in an opens column becomes a link. |
| openLabel | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The quick-view button's accessible name for a row. ดูรายละเอียด and the row key by default. |
ยังไม่มีข้อมูล
เมื่อไม่มีแถวเลยและไม่มีการค้นหาหรือตัวกรอง empty แทนที่ทั้งตาราง ส่ง action เฉพาะผู้ที่มีสิทธิ์สร้างรายการ
ยังไม่มีคำขอซื้อขอจ้าง
คำขอที่คุณสร้างหรือที่รอคุณอนุมัติจะแสดงที่นี่
const columns: DataColumn<Request>[] = [
{ key: "no", label: "เลขที่", sortable: true, opens: true },
{ key: "item", label: "รายการ", sortable: true },
{
key: "vendor",
label: "ผู้ขาย",
sub: "vendorCode",
hideOnPhone: true,
},
{ key: "date", label: "วันที่", kind: "date", sortable: true },
{
key: "amount",
label: "วงเงิน (บาท)",
kind: "money",
sortable: true,
total: true,
},
{
key: "status",
label: "สถานะ",
kind: "badge",
sortable: true,
badges: {
draft: { tone: "draft", label: "ร่าง", icon: Pencil },
pending: { tone: "pending", label: "รออนุมัติ", icon: Clock },
approved: { tone: "approved", label: "อนุมัติแล้ว", icon: Check },
rejected: { tone: "rejected", label: "ไม่อนุมัติ", icon: X },
},
},
];
<DataTable
caption="คำขอซื้อขอจ้าง"
columns={columns}
rows={rows}
rowKey="no"
empty={{
title: "ยังไม่มีคำขอซื้อขอจ้าง",
body: "คำขอที่คุณสร้างหรือที่รอคุณอนุมัติจะแสดงที่นี่",
icon: ClipboardList,
action: {
label: "สร้างคำขอ",
icon: Plus,
tone: "primary",
onClick: createRequest,
},
}}
/>| Prop | ค่าในตัวอย่างนี้ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|---|
| rows* จำเป็น | [] | readonly R[] | All rows. With total set, only the rows of the current page. |
| empty | ออบเจกต์ 4 ฟิลด์{
title: "ยังไม่มีคำขอซื้อขอจ้าง",
body: "คำขอที่คุณสร้างหรือที่รอคุณอนุมัติจะแสดงที่นี่",
icon: ClipboardList,
action: { label: "สร้างคำขอ", icon: Plus, tone: "primary" },
} | TableEmpty | What to show when there are no records at all, and nobody is searching or filtering. |
| onSortChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: TableSort) => void | Hears every sort change. Go back to page 1. |
| onPageChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onPageSizeChange | ไม่ได้ส่งในตัวอย่างนี้ | (next: number) => void | — |
| onOpen | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => void | Opens a row, from the value in an opens column and a quick-view button. Use for a drawer. |
| openHref | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The URL of a row's record page. The value in an opens column becomes a link. |
| openLabel | ไม่ได้ส่งในตัวอย่างนี้ | (row: R) => string | The quick-view button's accessible name for a row. ดูรายละเอียด and the row key by default. |
props ทั้งหมด
ตัวอย่างด้านบนใช้ props เพียงบางตัว ตารางนี้แสดงทุกตัวที่คอมโพเนนต์รับ พร้อมค่าเริ่มต้นและค่าที่ใช้ได้
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| caption* จำเป็น | string | — | Names the table for screen readers, such as คำขอซื้อขอจ้าง. |
| columns* จำเป็น | readonly DataColumn<R>[] | — | — |
| rows* จำเป็น | readonly R[] | — | All rows. With total set, only the rows of the current page. |
| rowKey* จำเป็น | keyof R & string | — | The field that identifies a row, such as no. Selection and onOpen use its value. |
| search | TableSearch | — | Shows a search box. Without total, the table searches the searchable columns itself. |
| filters | TableFilters | — | Shows filter chips, and a criteria panel when it has one. The screen filters the rows. |
| sort | TableSort | — | The sort in use, when the screen keeps it. |
| defaultSort | TableSort | — | The sort on first render, when the table keeps it. |
| onSortChange | (next: TableSort) => void | — | Hears every sort change. Go back to page 1. |
| page | number | — | The page shown, from 1, when the screen keeps it. |
| onPageChange | (next: number) => void | — | — |
| pageSize | number | — | Rows per page, when the screen keeps it. 10 by default. |
| onPageSizeChange | (next: number) => void | — | — |
| pageSizes | readonly number[] | PAGE_SIZES | The page sizes people can choose. |
| total | number | — | How many rows match on the server, for a list the core API pages. The table then shows rows as given. |
| totals | Readonly<Partial<Record<keyof R & string, number>>> | — | Totals from the core API for a paged list, by column key. Without total, the table adds up total columns itself. |
| totalLabel | string | — | Labels the total row. รวมทุกหน้า by default. |
| selection | TableSelection | — | Adds a checkbox to each row, and a bar of actions while any row is chosen. |
| onOpen | (row: R) => void | — | Opens a row, from the value in an opens column and a quick-view button. Use for a drawer. |
| openHref | (row: R) => string | — | The URL of a row's record page. The value in an opens column becomes a link. |
| openLabel | (row: R) => string | — | The quick-view button's accessible name for a row. ดูรายละเอียด and the row key by default. |
| status | "ready" | "loading" | "error" | "ready" | loading shows placeholder rows, error shows the error. ready by default. |
| error | TableError | — | What to say when status is error. |
| empty | TableEmpty | — | What to show when there are no records at all, and nobody is searching or filtering. |
| noun | string | — | The record name in the result count, such as รายการ or คำขอ. |
ชนิดข้อมูล
DataColumn
One column of a DataTable. The table reads the value from each row by key, and formats it by kind.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| key* จำเป็น | keyof R & string | — | The row field to show. It also names the column when sorting, and in a server query. |
| label* จำเป็น | string | — | The heading, already in the screen language. At phone width it labels the value in each row. |
| kind | ColumnKind ค่าที่ใช้ได้: "text""number""money""date""badge" | — | text by default. A text value may be a string or a Text pair. number and money take numbers, and money shows two decimals. date takes an ISO date such as 2026-11-02. badge looks the value up in badges. |
| sortable | boolean | — | People can sort by this column. |
| searchable | boolean | — | The search box looks in this column. Text columns are searched unless this is false. |
| badges | Readonly<Record<string, BadgeStyle>> | — | For a badge column: how each value shows, such as { pending: { tone: "pending", label: "รออนุมัติ" } }. |
| sub | keyof R & string | — | Another row field, shown as a smaller second line, such as a vendor code under the vendor name. |
| opens | boolean | — | The value opens the row, through the table's onOpen or openHref. Usually the record number. |
| total | boolean | — | Adds the column up in the total row. For number and money columns. |
| hideOnPhone | boolean | — | Hides the column at phone width, where each row becomes a block. |
Text
A string in both languages. Thai comes first because it is the default.
type Text = readonly [th: string, en: string];ColumnKind
How a column shows its value.
type ColumnKind = "text" | "number" | "money" | "date" | "badge";BadgeStyle
How a badge column shows one value, such as pending.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| tone* จำเป็น | BadgeTone ค่าที่ใช้ได้: "draft""pending""approved""paid""request""rejected""line" | — | — |
| label* จำเป็น | string | — | The badge text, already in the screen language. |
| icon | LucideIcon | — | — |
BadgeTone
The state a badge reports. Each one has its own colour. line is for facts that aren't a state.
type BadgeTone = "draft" | "pending" | "approved" | "paid" | "request" | "rejected" | "line";TableSearch
The search box above the table.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| placeholder* จำเป็น | string | — | Says what can be searched, such as ค้นหาเลขที่หรือรายการ. It is also the box's accessible name. |
| value | string | — | The search text, when the screen keeps it. |
| onChange | (q: string) => void | — | Hears the search text. With total set, it comes after a short pause, ready for a query to the core API. |
TableFilters
The filters in use, and the criteria panel that sets them.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| chips* จำเป็น | readonly FilterChip[] | — | The filters in use, one chip each. Removing one should go back to page 1. |
| onClearAll* จำเป็น | () => void | — | Called by Clear all. Remove every filter, but keep the search text. |
| panel | ReactNode | — | The criteria form, built from the library's fields, shown under a Search criteria button. |
FilterChip
One filter in use, shown as a chip.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| key* จำเป็น | string | — | Unique among the chips, such as status-pending. |
| label* จำเป็น | string | — | What the filter is, already in the screen language and formatted, such as a date range. |
| onRemove* จำเป็น | () => void | — | Called when the chip's remove button is pressed. Remove the filter and go back to page 1. |
TableSort
The column a table is sorted by, and which way.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| key* จำเป็น | string | — | — |
| dir* จำเป็น | SortDir ค่าที่ใช้ได้: "asc""desc" | — | — |
SortDir
The sort direction: asc for A to Z and smallest first, desc for the reverse.
type SortDir = "asc" | "desc";TableSelection
Row selection, with actions on the chosen rows.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| selected | readonly string[] | — | The chosen rows' keys, when the screen keeps them. |
| onChange | (keys: string[]) => void | — | Hears the chosen keys after every change. |
| actions* จำเป็น | readonly BulkAction[] | — | The actions on the chosen rows, such as Export. |
BulkAction
An action on the chosen rows, shown in the bar above the table while any row is chosen.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| label* จำเป็น | string | — | The button text, already in the screen language. |
| icon | LucideIcon | — | — |
| tone | "primary" | "secondary" | "danger" | — | secondary by default. |
| onRun* จำเป็น | (keys: string[]) => void | — | Gets the keys of every chosen row, across all pages. |
TableError
What the table shows instead of rows when they failed to load.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| title* จำเป็น | string | — | What happened, in a short sentence. |
| body* จำเป็น | string | — | What to do next. |
| correlationId | string | — | The Correlation ID of the failed request, so support can trace it. |
| onRetry | () => void | — | Called by Try again. Leave out when trying again can't help. |
TableEmpty
What the table shows when nothing exists yet, before anyone has created a record.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| title* จำเป็น | string | — | Says there are no records yet, such as ยังไม่มีคำขอซื้อขอจ้าง. |
| body* จำเป็น | string | — | Says what will appear here, and how it gets here. |
| icon | LucideIcon | — | A Lucide icon for the kind of record. |
| action | TableAction | — | The button that creates the first record. Leave out for people who may not create one. |
TableAction
A button the table shows, such as Try again or Create request.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| label* จำเป็น | string | — | The button text, already in the screen language. |
| icon | LucideIcon | — | — |
| tone | "primary" | "secondary" | "danger" | — | secondary by default. Use primary for the one main action, and danger for one that deletes. |
| onClick* จำเป็น | () => void | — | — |
ข้อควรปฏิบัติ
- ข้อความทั้งหมด เช่น หัวคอลัมน์และป้ายสถานะ ส่งมาในภาษาของหน้าจอ ค่าแบบข้อความอาจเป็นคู่ Text [ไทย, อังกฤษ] ได้
- rowKey ต้องไม่ซ้ำกันในทุกแถว เพราะการเลือกและการเปิดรายการใช้ค่านี้
- เงินคำนวณที่เซิร์ฟเวอร์เสมอ ตารางแสดงผลเท่านั้น ยอดรวมของรายการที่แบ่งหน้าต้องมาจาก API ผ่าน totals
- เมื่อเปลี่ยนการค้นหา การเรียง ตัวกรอง หรือจำนวนต่อหน้า ให้กลับไปหน้า 1 ตารางทำเองเมื่อเก็บสถานะเอง
- บนหน้าจอโทรศัพท์ แต่ละแถวเป็นบล็อกที่มีป้ายชื่อตามหัวคอลัมน์ คอลัมน์รองใช้ hideOnPhone
ซอร์สโค้ด: ui/src/table.tsx