Lewati ke konten
MarkasUI
Ketik untuk mencari

    Panduan

    MarkasUI

    Form

    Feedback

    Overlay

    Navigasi

    Data

    Section

    Animasi

    Latar

    Tombol

    Template

    Halaman

    Table

    Tabel data dari kolom dan baris, dengan opsi garis tiap sel, baris selang-seling, ukuran ringkas, dan baris footer. Digulir horizontal di layar sempit.

    Stock report
    Item In stock Value
    Paper A4 420 $1,890.00
    Stapler 86 $688.00
    Sticky notes 640 $960.00
    Total 1146 $3,538.00
    Stock report
    ItemIn stockValue
    Paper A4420$1,890.00
    Stapler86$688.00
    Sticky notes640$960.00
    Total1146$3,538.00
    Stock report
    ItemIn stockValue
    Paper A4420$1,890.00
    Stapler86$688.00
    Sticky notes640$960.00
    Total1146$3,538.00
    Recent orders
    OrderCustomerStatusTotal
    INV-1024Budi SantosoPaid$250.00
    INV-1025Siti AminahPending$85.00
    INV-1026Dewi LestariShipped$1,200.00
    Recent orders
    OrderCustomerStatusTotal
    INV-1024Budi SantosoPaid$250.00
    INV-1025Siti AminahPending$85.00
    INV-1026Dewi LestariShipped$1,200.00

    Table

    <x-markas.table
      caption="Stock report"
      bordered
      square
      :columns="[
        ['key' => 'item', 'label' => 'Item'],
        ['key' => 'stock', 'label' => 'In stock', 'align' => 'right'],
        ['key' => 'value', 'label' => 'Value', 'align' => 'right'],
      ]"
      :rows="[
        ['item' => 'Paper A4', 'stock' => 420, 'value' => '$1,890.00'],
        ['item' => 'Stapler', 'stock' => 86, 'value' => '$688.00'],
        ['item' => 'Sticky notes', 'stock' => 640, 'value' => '$960.00'],
      ]"
      :footer="['item' => 'Total', 'stock' => 1146, 'value' => '$3,538.00']"
    />
    import { Table } from "@/components/markas/Table";
    
    <Table
      caption="Stock report"
      bordered
      square
      columns={[
        { key: "item", label: "Item" },
        { key: "stock", label: "In stock", align: "right" },
        { key: "value", label: "Value", align: "right" },
      ]}
      rows={[
        { item: "Paper A4", stock: 420, value: "$1,890.00" },
        { item: "Stapler", stock: 86, value: "$688.00" },
        { item: "Sticky notes", stock: 640, value: "$960.00" },
      ]}
      footer={{ item: "Total", stock: 1146, value: "$3,538.00" }}
    />
    import Table from "@/components/markas/Table.vue";
    
    <Table
      caption="Stock report"
      bordered
      square
      :columns="[
        { key: 'item', label: 'Item' },
        { key: 'stock', label: 'In stock', align: 'right' },
        { key: 'value', label: 'Value', align: 'right' },
      ]"
      :rows="[
        { item: 'Paper A4', stock: 420, value: '$1,890.00' },
        { item: 'Stapler', stock: 86, value: '$688.00' },
        { item: 'Sticky notes', stock: 640, value: '$960.00' },
      ]"
      :footer="{ item: 'Total', stock: 1146, value: '$3,538.00' }"
    />
    <script lang="ts">
      import Table from "$lib/components/markas/Table.svelte";
    
      const columns = [
        { key: "code", label: "Order" },
        { key: "customer", label: "Customer" },
        { key: "status", label: "Status" },
        { key: "total", label: "Total", align: "right" as const },
      ];
      const rows = [
        {
          code: "INV-1024",
          customer: "Budi Santoso",
          status: "Paid",
          total: "$250.00",
        },
        {
          code: "INV-1025",
          customer: "Siti Aminah",
          status: "Pending",
          total: "$85.00",
        },
        {
          code: "INV-1026",
          customer: "Dewi Lestari",
          status: "Shipped",
          total: "$1,200.00",
        },
      ];
    </script>
    
    <Table caption="Recent orders" {columns} {rows} />
    ---
    import Table from "@/components/markas/Table.astro";
    
    const columns = [
      { key: "code", label: "Order" },
      { key: "customer", label: "Customer" },
      { key: "status", label: "Status" },
      { key: "total", label: "Total", align: "right" as const },
    ];
    const rows = [
      {
        code: "INV-1024",
        customer: "Budi Santoso",
        status: "Paid",
        total: "$250.00",
      },
      {
        code: "INV-1025",
        customer: "Siti Aminah",
        status: "Pending",
        total: "$85.00",
      },
      {
        code: "INV-1026",
        customer: "Dewi Lestari",
        status: "Shipped",
        total: "$1,200.00",
      },
    ];
    ---
    
    <Table caption="Recent orders" columns={columns} rows={rows} />
    import { Component } from "@angular/core";
    import { Table } from "./markas/table.component";
    
    @Component({
      selector: "markas-example",
      imports: [Table],
      template: `
        <div
          markas-table
          caption="Recent orders"
          [columns]="columns"
          [rows]="rows"
        ></div>
      `,
    })
    export default class TableExample {
      protected readonly columns = [
        { key: "code", label: "Order" },
        { key: "customer", label: "Customer" },
        { key: "status", label: "Status" },
        { key: "total", label: "Total", align: "right" as const },
      ];
      protected readonly rows = [
        {
          code: "INV-1024",
          customer: "Budi Santoso",
          status: "Paid",
          total: "$250.00",
        },
        {
          code: "INV-1025",
          customer: "Siti Aminah",
          status: "Pending",
          total: "$85.00",
        },
        {
          code: "INV-1026",
          customer: "Dewi Lestari",
          status: "Shipped",
          total: "$1,200.00",
        },
      ];
    }

    Contoh

    Badge status

    Invoices
    Invoice Customer Status Amount
    INV-1024 Budi Santoso Paid $250.00
    INV-1025 Siti Aminah Pending $85.00
    INV-1026 John Carter Overdue $1,200.00
    INV-1027 Dewi Lestari Draft $40.00
    Invoices
    InvoiceCustomerStatusAmount
    INV-1024Budi SantosoPaid$250.00
    INV-1025Siti AminahPending$85.00
    INV-1026John CarterOverdue$1,200.00
    INV-1027Dewi LestariDraft$40.00
    Invoices
    InvoiceCustomerStatusAmount
    INV-1024Budi SantosoPaid$250.00
    INV-1025Siti AminahPending$85.00
    INV-1026John CarterOverdue$1,200.00
    INV-1027Dewi LestariDraft$40.00
    Invoices
    InvoiceCustomerStatusAmount
    INV-1024Budi SantosoPaid$250.00
    INV-1025Siti AminahPending$85.00
    INV-1026John CarterOverdue$1,200.00
    INV-1027Dewi LestariDraft$40.00
    Invoices
    InvoiceCustomerStatusAmount
    INV-1024Budi SantosoPaid$250.00
    INV-1025Siti AminahPending$85.00
    INV-1026John CarterOverdue$1,200.00
    INV-1027Dewi LestariDraft$40.00

    Kolom angka

    Sales by product
    Product Units Price Revenue
    Wireless mouse 1240 $24.00 $29,760.00
    USB-C hub 860 $39.00 $33,540.00
    Laptop stand 312 $59.00 $18,408.00
    Desk mat 95 $18.50 $1,757.50
    Sales by product
    ProductUnitsPriceRevenue
    Wireless mouse1240$24.00$29,760.00
    USB-C hub860$39.00$33,540.00
    Laptop stand312$59.00$18,408.00
    Desk mat95$18.50$1,757.50
    Sales by product
    ProductUnitsPriceRevenue
    Wireless mouse1240$24.00$29,760.00
    USB-C hub860$39.00$33,540.00
    Laptop stand312$59.00$18,408.00
    Desk mat95$18.50$1,757.50
    Sales by product
    ProductUnitsPriceRevenue
    Wireless mouse1240$24.00$29,760.00
    USB-C hub860$39.00$33,540.00
    Laptop stand312$59.00$18,408.00
    Desk mat95$18.50$1,757.50
    Sales by product
    ProductUnitsPriceRevenue
    Wireless mouse1240$24.00$29,760.00
    USB-C hub860$39.00$33,540.00
    Laptop stand312$59.00$18,408.00
    Desk mat95$18.50$1,757.50

    Caption terlihat

    Team members
    Name Role Joined
    Sarah Miller Owner Jan 12, 2025
    Budi Santoso Editor Mar 3, 2025
    Siti Aminah Viewer Aug 21, 2025
    Team members
    NameRoleJoined
    Sarah MillerOwnerJan 12, 2025
    Budi SantosoEditorMar 3, 2025
    Siti AminahViewerAug 21, 2025
    Team members
    NameRoleJoined
    Sarah MillerOwnerJan 12, 2025
    Budi SantosoEditorMar 3, 2025
    Siti AminahViewerAug 21, 2025
    Team members
    NameRoleJoined
    Sarah MillerOwnerJan 12, 2025
    Budi SantosoEditorMar 3, 2025
    Siti AminahViewerAug 21, 2025
    Team members
    NameRoleJoined
    Sarah MillerOwnerJan 12, 2025
    Budi SantosoEditorMar 3, 2025
    Siti AminahViewerAug 21, 2025

    Keadaan kosong

    Invoices
    Invoice Customer Status Amount

    No invoices yet

    Invoices you create will show up here.

    Invoices
    InvoiceCustomerStatusAmount

    No invoices yet

    Invoices you create will show up here.

    Invoices
    InvoiceCustomerStatusAmount

    No invoices yet

    Invoices you create will show up here.

    Invoices
    InvoiceCustomerStatusAmount

    No invoices yet

    Invoices you create will show up here.

    Invoices
    InvoiceCustomerStatusAmount

    No invoices yet

    Invoices you create will show up here.

    Grid bergaris dengan total

    Stock report
    Item In stock Reserved Value
    Paper A4 80gsm 420 60 $1,890.00
    Ballpoint pen 1,150 200 $575.00
    Stapler 86 12 $688.00
    Sticky notes 640 90 $960.00
    Whiteboard marker 310 45 $465.00
    Total 2,606 407 $4,578.00
    Stock report
    ItemIn stockReservedValue
    Paper A4 80gsm42060$1,890.00
    Ballpoint pen1,150200$575.00
    Stapler8612$688.00
    Sticky notes64090$960.00
    Whiteboard marker31045$465.00
    Total2,606407$4,578.00
    Stock report
    ItemIn stockReservedValue
    Paper A4 80gsm42060$1,890.00
    Ballpoint pen1,150200$575.00
    Stapler8612$688.00
    Sticky notes64090$960.00
    Whiteboard marker31045$465.00
    Total2,606407$4,578.00
    Stock report
    ItemIn stockReservedValue
    Paper A4 80gsm42060$1,890.00
    Ballpoint pen1,150200$575.00
    Stapler8612$688.00
    Sticky notes64090$960.00
    Whiteboard marker31045$465.00
    Total2,606407$4,578.00
    Stock report
    ItemIn stockReservedValue
    Paper A4 80gsm42060$1,890.00
    Ballpoint pen1,150200$575.00
    Stapler8612$688.00
    Sticky notes64090$960.00
    Whiteboard marker31045$465.00
    Total2,606407$4,578.00

    Baris selang-seling

    Team members
    Name Role Location
    Rani Wulandari Designer Jakarta
    Budi Santoso Engineer Bandung
    Siti Aminah Product manager Surabaya
    Agus Pratama Engineer Yogyakarta
    Dewi Lestari Support Denpasar
    Team members
    NameRoleLocation
    Rani WulandariDesignerJakarta
    Budi SantosoEngineerBandung
    Siti AminahProduct managerSurabaya
    Agus PratamaEngineerYogyakarta
    Dewi LestariSupportDenpasar
    Team members
    NameRoleLocation
    Rani WulandariDesignerJakarta
    Budi SantosoEngineerBandung
    Siti AminahProduct managerSurabaya
    Agus PratamaEngineerYogyakarta
    Dewi LestariSupportDenpasar
    Team members
    NameRoleLocation
    Rani WulandariDesignerJakarta
    Budi SantosoEngineerBandung
    Siti AminahProduct managerSurabaya
    Agus PratamaEngineerYogyakarta
    Dewi LestariSupportDenpasar
    Team members
    NameRoleLocation
    Rani WulandariDesignerJakarta
    Budi SantosoEngineerBandung
    Siti AminahProduct managerSurabaya
    Agus PratamaEngineerYogyakarta
    Dewi LestariSupportDenpasar

    Ringkas

    Recent transactions
    Date Invoice Customer Method Amount
    Nov 1 INV-2041 Budi Santoso Card $120.00
    Nov 1 INV-2042 Siti Aminah Transfer $86.50
    Nov 2 INV-2043 Agus Pratama Card $42.00
    Nov 3 INV-2044 Dewi Lestari Wallet $310.00
    Nov 4 INV-2045 Rani Wulandari Transfer $58.25
    Nov 4 INV-2046 Joko Widodo Card $19.90
    Recent transactions
    DateInvoiceCustomerMethodAmount
    Nov 1INV-2041Budi SantosoCard$120.00
    Nov 1INV-2042Siti AminahTransfer$86.50
    Nov 2INV-2043Agus PratamaCard$42.00
    Nov 3INV-2044Dewi LestariWallet$310.00
    Nov 4INV-2045Rani WulandariTransfer$58.25
    Nov 4INV-2046Joko WidodoCard$19.90
    Recent transactions
    DateInvoiceCustomerMethodAmount
    Nov 1INV-2041Budi SantosoCard$120.00
    Nov 1INV-2042Siti AminahTransfer$86.50
    Nov 2INV-2043Agus PratamaCard$42.00
    Nov 3INV-2044Dewi LestariWallet$310.00
    Nov 4INV-2045Rani WulandariTransfer$58.25
    Nov 4INV-2046Joko WidodoCard$19.90
    Recent transactions
    DateInvoiceCustomerMethodAmount
    Nov 1INV-2041Budi SantosoCard$120.00
    Nov 1INV-2042Siti AminahTransfer$86.50
    Nov 2INV-2043Agus PratamaCard$42.00
    Nov 3INV-2044Dewi LestariWallet$310.00
    Nov 4INV-2045Rani WulandariTransfer$58.25
    Nov 4INV-2046Joko WidodoCard$19.90
    Recent transactions
    DateInvoiceCustomerMethodAmount
    Nov 1INV-2041Budi SantosoCard$120.00
    Nov 1INV-2042Siti AminahTransfer$86.50
    Nov 2INV-2043Agus PratamaCard$42.00
    Nov 3INV-2044Dewi LestariWallet$310.00
    Nov 4INV-2045Rani WulandariTransfer$58.25
    Nov 4INV-2046Joko WidodoCard$19.90

    Instalasi

    npx markasui@latest add table

    Pemakaian

    <x-markas.table
        caption="Daftar pesanan terbaru"
        label="Tabel pesanan"
        :columns="[
            ['key' => 'kode', 'label' => 'Pesanan'],
            ['key' => 'pelanggan', 'label' => 'Pelanggan'],
            ['key' => 'total', 'label' => 'Total', 'align' => 'right'],
        ]"
        :rows="$orders->map(fn ($o) => ['kode' => $o->code, 'pelanggan' => $o->customer, 'total' => $o->total_label])->all()"
    />
    import { Table } from "@/components/markas/Table";
    
    <Table
      caption="Daftar pesanan terbaru"
      label="Tabel pesanan"
      columns={[
        { key: "kode", label: "Pesanan" },
        { key: "status", label: "Status" },
        { key: "total", label: "Total", align: "right" },
      ]}
      rows={orders}
      renderCell={(row, key) =>
        key === "status" ? <Badge>{row.status}</Badge> : undefined
      }
    />;
    <template>
      <Table
        caption="Daftar pesanan terbaru"
        label="Tabel pesanan"
        :columns="[
          { key: 'kode', label: 'Pesanan' },
          { key: 'status', label: 'Status' },
          { key: 'total', label: 'Total', align: 'right' },
        ]"
        :rows="orders"
      >
        <template #cell-status="{ row }">
          <Badge>{{ row.status }}</Badge>
        </template>
      </Table>
    </template>
    <script lang="ts">
      import Badge from "$lib/components/markas/Badge.svelte";
      import Table, { type TableRow } from "$lib/components/markas/Table.svelte";
    
      const columns = [
        { key: "code", label: "Order" },
        { key: "status", label: "Status" },
        { key: "total", label: "Total", align: "right" as const },
      ];
    </script>
    
    {#snippet status(row: TableRow)}
      <Badge>{row.status}</Badge>
    {/snippet}
    
    <Table caption="Recent orders" {columns} rows={orders} cells={{ status }} />

    cells memetakan key kolom ke snippet yang menerima baris. Kolom lain menampilkan nilai teks.

    ---
    import Badge from "@/components/markas/Badge.astro";
    import Table, { type TableRow } from "@/components/markas/Table.astro";
    ---
    
    <Table caption="Recent orders" columns={columns} rows={orders}>
      {
        (row: TableRow, key: string) =>
          key === "status" && <Badge>{row.status}</Badge>
      }
    </Table>

    Function child dijalankan untuk setiap sel. Kembalikan kosong untuk memakai nilai teks.

    import { Component } from "@angular/core";
    import { Badge } from "./markas/badge.component";
    import { Table, type TableColumn } from "./markas/table.component";
    
    @Component({
      selector: "app-orders",
      imports: [Badge, Table],
      template: `
        <div
          markas-table
          caption="Recent orders"
          [columns]="columns"
          [rows]="orders"
          [cells]="{ status: statusCell }"
        ></div>
        <ng-template #statusCell let-row>
          <span markas-badge>{{ row.status }}</span>
        </ng-template>
      `,
    })
    export class Orders {
      columns: TableColumn[] = [
        { key: "code", label: "Order" },
        { key: "status", label: "Status" },
        { key: "total", label: "Total", align: "right" },
      ];
      orders = [{ code: "INV-1024", status: "Paid", total: "$250.00" }];
    }

    cells memetakan key kolom ke ng-template yang menerima baris sebagai let-row.

    • Blade hanya menampilkan nilai teks yang di-escape. Untuk sel berisi komponen lain, tulis tabel langsung memakai class yang sama, atau siapkan string di controller.
    • renderCell yang mengembalikan undefined memakai nilai teks bawaan, jadi cukup tangani kolom yang perlu diubah.
    • Tambahkan show-caption (Blade, Vue) atau showCaption (React) untuk menampilkan caption di atas tabel.
    • Sel tidak memotong baris (whitespace-nowrap). Di layar sempit tabel digulir horizontal di dalam pembungkusnya.
    • Isi rowKey (React dan Vue, misalnya rowKey="id") dengan nama field berisi id unik per baris saat baris bisa diurutkan, disaring, atau dihapus. Tanpa rowKey, key memakai indeks baris. Blade tidak membutuhkannya.
    • Nama region diambil dari label, lalu caption, lalu “Table” (default bahasa Inggris). Isi label atau caption dalam Bahasa Indonesia, misalnya label="Tabel pesanan".
    • Tambahkan bordered untuk grid kotak dengan garis di setiap sel, striped untuk latar baris selang-seling, dan size="sm" untuk padding lebih rapat dengan teks 13px di tabel padat.
    • Kirim baris total lewat footer, objek (array PHP di Blade) dengan key per kolom, misalnya :footer="['item' => 'Total', 'value' => '$4,578.00']" di Blade atau footer={{ item: "Total", value: "$4,578.00" }} di React. Hasilnya satu baris di tfoot dengan perataan sama seperti kolomnya.

    Props

    NamaTipeDefaultKeterangan
    columns{ key: string, label: string, align?: 'left' | 'center' | 'right' }[][]Daftar kolom. key menunjuk properti di setiap baris.
    rowsRecord<string, string | number>[][]Data baris. Di Blade berupa array PHP.
    captionstring-Judul tabel di elemen caption. Disembunyikan secara visual kecuali show-caption aktif.
    showCaptionbooleanfalseTampilkan caption di atas tabel.
    labelstringcaption or Tablearia-label untuk region pembungkus yang bisa digulir. Tanpa label dipakai caption, lalu "Table". Isi misalnya "Tabel pesanan" untuk situs berbahasa Indonesia.
    borderedbooleanfalseGaris di sekeliling setiap sel, termasuk header, agar tampak seperti grid kotak klasik. Header mendapat garis bawah yang lebih tegas.
    squarebooleanfalseSudut siku tanpa radius, seperti tabel spreadsheet klasik.
    stripedbooleanfalseBeri latar lembut pada baris genap.
    size'sm' | 'md'mdPadding sel. sm memakai padding lebih rapat dan teks 13px untuk data padat.
    footerRecord<string, string | number>-Satu baris footer opsional di tfoot, berisi nilai per key kolom, misalnya total. Key yang tidak ada menjadi sel kosong.
    rowKeystring-Nama field berisi id unik per baris (misalnya id), dipakai sebagai key React dan Vue agar baris tidak tertukar saat data diurutkan atau dihapus. Tanpa ini key memakai indeks. Blade tidak memakainya.
    renderCell / slot cell-<key> / cells(row, key) => ReactNode · slot { row } · Record<string, Snippet | TemplateRef>-Isi sel kustom. React memakai renderCell, Vue named slot cell-<key>, Svelte dan Angular peta cells berisi snippet atau ng-template per key kolom, Astro function child (row, key) yang mengembalikan markup atau kosong. Blade hanya teks.

    Aksesibilitas

    • Pembungkus memakai role region, aria-label, dan tabindex 0 agar tabel yang terpotong bisa difokus lalu digulir dengan panah.
    • Header kolom memakai th dengan scope col.
    • Caption tetap dibacakan screen reader walau disembunyikan secara visual.
    • Baris footer dirender di dalam tfoot sehingga screen reader membacakannya sebagai footer tabel.

    Komponen terkait

    Komponen data lain dengan class yang sama di setiap framework.