Shopify Polaris
JS behaviour
Index Table
Shopify admin's merchant-data table: per-row checkboxes, a bulk-actions bar that appears on first selection, and pinned pagination — the birthplace of at-scale order and product management.
Real scenarios
The component as it is used in a product — not a specimen grid.
Pick a row — the bar rises
Tick any order: the bulk bar slides over the header with a real count. «Archive» deletes the picked rows, pagination really pages, and the header checkbox goes indeterminate.
Recent orders
6 orders
1 selected
| Order | Date | Customer | Total | Status | |
|---|---|---|---|---|---|
| No orders left — archive emptied the table | |||||
Page 1 of 2
Row variants & status pills
Product rows carry a thumbnail, picked rows sit on the brand tint, and every status is a subdued pill of its own tone.
Soy candle, minimalSKU: CD-220
media
Ceramic mug, 350 mlSKU: MG-350
picked
Paid
Pending
Refunded
Fulfilling
status pills
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| selection | state | '[]' | The selected-rows array; its first member raises the bulk-actions bar. |
| --plit-green | color | '#008060' | Shopify's brand green for the primary action and bulk bar; on dark it becomes #00A97F. |
| pagination | behaviour | 'pinned' | Pagination pins to the table footer and never scrolls away with the rows. |
| status | badge | 'paid · pending' | Per-row status badges on subdued tints of their own tone: green, amber, red. |
Snippet
<div class="plit" x-data="{ sel: [] }">
<label><input type="checkbox" x-on:click="toggleAll()"> All</label>
<table>
<tr><td><input type="checkbox" x-on:click="sel.push(1001)"></td><td>#1001 · Istanbul</td>…</tr>
</table>
<div class="plit-bulk" x-show="sel.length">
<span x-text="sel.length + ' selected'"></span>
<button>Fulfill</button>
</div>
</div>
<style>
.plit { border-radius: 12px; background: #FFF; box-shadow: 0 1px 4px #00000012; }
.plit-bulk { position: absolute; inset-inline: 12px; inset-block-end: 52px;
display: flex; gap: 8px; padding: 10px 14px; border-radius: 8px;
background: #1A3B34; color: #F1F7F4; animation: plit-rise .2s ease-out; }
@keyframes plit-rise { from { translate: 0 100%; opacity: 0; } }
</style>
// resources/js/Pages/Orders/Index.tsx — the Inertia page mounts the
// React snippet; app.tsx owns the CSS import and the Provider.
import { Head, Link } from '@inertiajs/react';
import IndexTable from '@/components/polaris/IndexTable';
export default function OrdersIndex() {
return (
<>
<Head title="Orders" />
<Link href="/orders/create">Create order</Link>
{/* Fulfill/Archive in the bulk bar post via router, then reload props */}
<IndexTable />
</>
);
}
import { useState } from 'react';
import '@nabuxai/ui-core/css';
const ORDERS = [
{ id: 1001, no: '#1001', cust: 'Elif Kaya · Istanbul', sum: '$86.00' },
{ id: 1002, no: '#1002', cust: 'Jonas Weber · Berlin', sum: '$24.00' },
{ id: 1003, no: '#1003', cust: 'Mia Rossi · Milan', sum: '$132.50' },
];
export default function IndexTable() {
const [sel, setSel] = useState<number[]>([]);
const toggle = (id: number) =>
setSel((s) => (s.includes(id) ? s.filter((i) => i !== id) : [...s, id]));
return (
<div className="plit">
{sel.length > 0 && (
<div className="plit-bulk">
<span>{sel.length} selected</span>
<button onClick={() => setSel([])}>Fulfill</button>
</div>
)}
<table>
<tbody>
{ORDERS.map((r) => (
<tr key={r.id} data-picked={sel.includes(r.id) || undefined}>
<td>
<input type="checkbox" checked={sel.includes(r.id)} aria-label={`Select ${r.no}`} onChange={() => toggle(r.id)} />
</td>
<td>{r.no}</td><td>{r.cust}</td><td>{r.sum}</td>
</tr>
))}
</tbody>
</table>
<style>{`
.plit { position: relative; border-radius: 12px; background: #FFF; box-shadow: 0 1px 4px #00000012; }
.plit-bulk { position: absolute; inset-inline: 12px; inset-block-end: 52px; display: flex; gap: 8px;
padding: 10px 14px; border-radius: 8px; background: #1A3B34; color: #F1F7F4; }
`}</style>
</div>
);
}
<!-- IndexTable.vue -->
<script setup lang="ts">
import { ref } from 'vue';
import '@nabuxai/ui-core/css';
interface Order { id: number; no: string; cust: string; sum: string }
const orders: Order[] = [
{ id: 1001, no: '#1001', cust: 'Elif Kaya · Istanbul', sum: '$86.00' },
{ id: 1002, no: '#1002', cust: 'Jonas Weber · Berlin', sum: '$24.00' },
];
const sel = ref<number[]>([]);
const toggle = (id: number) =>
(sel.value = sel.value.includes(id) ? sel.value.filter((i) => i !== id) : [...sel.value, id]);
</script>
<template>
<div class="plit">
<div v-if="sel.length" class="plit-bulk">
<span>{{ sel.length }} selected</span>
<button @click="sel = []">Fulfill</button>
</div>
<table>
<tbody>
<tr v-for="r in orders" :key="r.id" :data-picked="sel.includes(r.id) ? '' : null">
<td><input type="checkbox" :checked="sel.includes(r.id)" :aria-label="`Select ${r.no}`" @change="toggle(r.id)" /></td>
<td>{{ r.no }}</td><td>{{ r.cust }}</td><td>{{ r.sum }}</td>
</tr>
</tbody>
</table>
</div>
</template>
<style scoped>
.plit { position: relative; border-radius: 12px; background: #fff; box-shadow: 0 1px 4px #00000012; }
.plit-bulk { position: absolute; inset-inline: 12px; inset-block-end: 52px; display: flex; gap: 8px;
padding: 10px 14px; border-radius: 8px; background: #1a3b34; color: #f1f7f4; }
</style>
<!-- IndexTable.svelte -->
<script lang="ts">
import '@nabuxai/ui-core/css';
interface Order { id: number; no: string; cust: string; sum: string }
const orders: Order[] = [
{ id: 1001, no: '#1001', cust: 'Elif Kaya · Istanbul', sum: '$86.00' },
{ id: 1002, no: '#1002', cust: 'Jonas Weber · Berlin', sum: '$24.00' },
];
let sel = $state<number[]>([]);
const toggle = (id: number) =>
(sel = sel.includes(id) ? sel.filter((i) => i !== id) : [...sel, id]);
</script>
<div class="plit">
{#if sel.length > 0}
<div class="plit-bulk">
<span>{sel.length} selected</span>
<button onclick={() => (sel = [])}>Fulfill</button>
</div>
{/if}
<table>
<tbody>
{#each orders as r (r.id)}
<tr data-picked={sel.includes(r.id) || undefined}>
<td><input type="checkbox" checked={sel.includes(r.id)} aria-label="Select {r.no}" onchange={() => toggle(r.id)} /></td>
<td>{r.no}</td><td>{r.cust}</td><td>{r.sum}</td>
</tr>
{/each}
</tbody>
</table>
</div>
<style>
.plit { position: relative; border-radius: 12px; background: #fff; box-shadow: 0 1px 4px #00000012; }
.plit-bulk { position: absolute; inset-inline: 12px; inset-block-end: 52px; display: flex; gap: 8px;
padding: 10px 14px; border-radius: 8px; background: #1a3b34; color: #f1f7f4; }
</style>