Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Table

    Data table built from columns and rows, with optional cell borders, striped rows, compact size, and a footer row. Scrolls horizontally on narrow screens.

    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",
        },
      ];
    }

    Examples

    Status badges

    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

    Numeric columns

    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

    Visible caption

    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

    Empty state

    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.

    Bordered grid with totals

    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

    Striped rows

    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

    Compact

    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

    Installation

    npx markasui@latest add table

    Usage

    <x-markas.table
        caption="Recent orders"
        :columns="[
            ['key' => 'code', 'label' => 'Order'],
            ['key' => 'customer', 'label' => 'Customer'],
            ['key' => 'total', 'label' => 'Total', 'align' => 'right'],
        ]"
        :rows="$orders->map(fn ($o) => ['code' => $o->code, 'customer' => $o->customer, 'total' => $o->total_label])->all()"
    />
    import { Table } from "@/components/markas/Table";
    
    <Table
      caption="Recent orders"
      columns={[
        { key: "code", label: "Order" },
        { 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="Recent orders"
        :columns="[
          { key: 'code', label: 'Order' },
          { 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 maps a column key to a snippet that receives the row. Other columns show the plain value.

    ---
    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>

    The function child runs for every cell. Return nothing to keep the plain value.

    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 maps a column key to an ng-template that receives the row as let-row.

    • Blade only shows escaped text values. For cells with other components, write the table by hand with the same classes, or prepare the string in the controller.
    • A renderCell that returns undefined falls back to the plain text value, so only handle the columns that need it.
    • Add show-caption (Blade, Vue) or showCaption (React) to show the caption above the table.
    • Cells do not wrap (whitespace-nowrap). On narrow screens the table scrolls horizontally inside its wrapper.
    • Set rowKey (React and Vue, such as rowKey="id") to a field with a unique id per row when rows can be sorted, filtered, or removed. Without rowKey, the key is the row index. Blade does not need it.
    • The region is named by label, then caption, then “Table”. Set label or caption in your site’s language.
    • Add bordered for a classic grid with lines around every cell, striped for alternating row backgrounds, and size="sm" for tighter padding with 13px text in dense tables.
    • Pass totals through footer, an object (a PHP array in Blade) keyed by column, such as :footer="['item' => 'Total', 'value' => '$4,578.00']" in Blade or footer={{ item: "Total", value: "$4,578.00" }} in React. It renders one row in tfoot with the same alignment as each column.

    Props

    NameTypeDefaultDescription
    columns{ key: string, label: string, align?: 'left' | 'center' | 'right' }[][]List of columns. key points to a property on each row.
    rowsRecord<string, string | number>[][]Row data. A PHP array in Blade.
    captionstring-Table title in the caption element. Visually hidden unless show-caption is set.
    showCaptionbooleanfalseShow the caption above the table.
    labelstringcaption or Tablearia-label of the scrollable region wrapper. Falls back to caption, then to Table.
    borderedbooleanfalseDraw lines around every cell, including the header, for a classic grid look. The header gets a stronger bottom line.
    squarebooleanfalseSquare corners with no radius, like a classic spreadsheet table.
    stripedbooleanfalseGive even rows a subtle background.
    size'sm' | 'md'mdCell padding. sm uses tighter padding and 13px text for dense data.
    footerRecord<string, string | number>-Optional single footer row in tfoot, with a value per column key, such as totals. Missing keys render as empty cells.
    rowKeystring-Name of the field holding a unique id per row (such as id), used as the React and Vue key so rows do not get mixed up when data is sorted or removed. Without it the key is the index. Not used in Blade.
    renderCell / slot cell-<key> / cells(row, key) => ReactNode · slot { row } · Record<string, Snippet | TemplateRef>-Custom cell content. React uses renderCell, Vue the named slot cell-<key>, Svelte and Angular a cells map of snippets or ng-templates per column key, Astro a function child (row, key) that returns markup or nothing. Blade is text only.

    Accessibility

    • The wrapper uses role region, an aria-label, and tabindex 0, so a clipped table can be focused and scrolled with the arrow keys.
    • Column headers use th with scope col.
    • The caption is still read by screen readers when visually hidden.
    • The footer row is rendered inside tfoot, so screen readers announce it as the table footer.

    Related components

    More data components with the same classes in every framework.