Shopify Polaris
JS behaviour
Resource List
Every resource is a card row with thumbnail, title, attributes and an actions menu — listing products and customers in the native tongue of Shopify admin.
Real scenarios
The component as it is used in a product — not a specimen grid.
The shelf and its kebab menus
Open a row menu: «Duplicate» really clones the product, «Delete» really removes it — clear the shelf and the Polaris Empty State steps in with its CTA.
Products
4 of 12
No products on the shelf
Everything you listed has been deleted. Bring the starter product back to keep browsing.
Row variants
Without media the row densifies; compact mode trims the padding; low stock earns a warning count.
Gift card, digital
SKU: GC-99 · $10.00 · always in stock
Oversized tee, ecru
TS-OS · $18.00
3 left
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| media | thumbnail | '48px' | A rounded 48px thumbnail opening each row; dropping it densifies the list. |
| actions | menu | 'kebab' | The row-end kebab menu: edit, duplicate, delete — outside taps close it. |
| badge | tone | 'success' | The resource's status badge: green for active, gray for draft. |
Snippet
<ul class="plrl" x-data="{ open: null }">
<li>
<img class="plrl-media" src="…" alt="">
<div><b>Soy candle, minimal</b><small>SKU: CS-220 · $24.00</small></div>
<span class="plrl-badge">Active</span>
<button class="plrl-kebab" x-on:click="open = open ? null : 1">⋯</button>
<div class="plrl-menu" x-show="open === 1" x-on:click.outside="open = null">
<button>Duplicate</button><button>Delete</button>
</div>
</li>
</ul>
<style>
.plrl { border-radius: 12px; background: #FFF; box-shadow: 0 1px 4px #00000012; }
.plrl > li { display: flex; align-items: center; gap: 12px; padding: 12px 16px;
border-block-start: 1px solid #E3E3E3; }
.plrl-media { inline-size: 48px; block-size: 48px; border-radius: 8px; }
.plrl-kebab + .plrl-menu { position: absolute; inset-inline-end: 16px; border-radius: 8px;
background: #FFF; box-shadow: 0 4px 16px #00000022; }
</style>
// resources/js/Pages/Products/Index.tsx — Inertia wraps the React
// snippet; duplicate/delete can post through router and reload props.
import { Head, Link, router } from '@inertiajs/react';
import ResourceList from '@/components/polaris/ResourceList';
export default function ProductsIndex() {
return (
<>
<Head title="Products" />
<Link href="/products/create">New product</Link>
{/* The kebab menu calls router.post(`/products/${id}/duplicate`) */}
<ResourceList />
</>
);
}
import { useState } from 'react';
import '@nabuxai/ui-core/css';
type Product = { id: number; name: string; sku: string; price: string; tone: 'active' | 'draft' };
const START: Product[] = [
{ id: 1, name: 'Soy candle, minimal', sku: 'CD-220', price: '$24.00', tone: 'active' },
{ id: 2, name: 'Ceramic mug, 350 ml', sku: 'MG-350', price: '$19.50', tone: 'draft' },
];
export default function ResourceList() {
const [prods, setProds] = useState(START);
const [open, setOpen] = useState<number | null>(null);
const dup = (p: Product) =>
setProds((l) => [...l, { ...p, id: Date.now(), name: `${p.name} (copy)`, tone: 'draft' }]);
const del = (id: number) => setProds((l) => l.filter((p) => p.id !== id));
return (
<ul className="plrl">
{prods.map((p) => (
<li key={p.id}>
<span className="plrl-body"><b>{p.name}</b><small>SKU: {p.sku} · {p.price}</small></span>
<span className="plrl-badge" data-tone={p.tone}>{p.tone === 'active' ? 'Active' : 'Draft'}</span>
<button className="plrl-kebab" aria-expanded={open === p.id} onClick={() => setOpen(open === p.id ? null : p.id)}>⋯</button>
{open === p.id && (
<div className="plrl-menu" role="menu">
<button onClick={() => { dup(p); setOpen(null); }}>Duplicate</button>
<button data-danger onClick={() => { del(p.id); setOpen(null); }}>Delete</button>
</div>
)}
</li>
))}
<style>{`
.plrl { border-radius: 12px; background: #FFF; box-shadow: 0 1px 4px #00000012; }
.plrl > li { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
border-block-start: 1px solid #E3E3E3; }
.plrl-kebab + .plrl-menu { position: absolute; inset-inline-end: 16px; border-radius: 8px;
background: #FFF; box-shadow: 0 4px 16px #00000022; }
`}</style>
</ul>
);
}
<!-- ResourceList.vue -->
<script setup lang="ts">
import { ref } from 'vue';
import '@nabuxai/ui-core/css';
interface Product { id: number; name: string; sku: string; price: string; tone: 'active' | 'draft' }
const prods = ref<Product[]>([
{ id: 1, name: 'Soy candle, minimal', sku: 'CD-220', price: '$24.00', tone: 'active' },
{ id: 2, name: 'Ceramic mug, 350 ml', sku: 'MG-350', price: '$19.50', tone: 'draft' },
]);
const open = ref<number | null>(null);
const dup = (p: Product) =>
prods.value.push({ ...p, id: Date.now(), name: `${p.name} (copy)`, tone: 'draft' });
const del = (id: number) => (prods.value = prods.value.filter((p) => p.id !== id));
</script>
<template>
<ul class="plrl">
<li v-for="p in prods" :key="p.id">
<span class="plrl-body"><b>{{ p.name }}</b><small>SKU: {{ p.sku }} · {{ p.price }}</small></span>
<span class="plrl-badge" :data-tone="p.tone">{{ p.tone === 'active' ? 'Active' : 'Draft' }}</span>
<button class="plrl-kebab" :aria-expanded="open === p.id" @click="open = open === p.id ? null : p.id">⋯</button>
<div v-if="open === p.id" class="plrl-menu" role="menu">
<button @click="dup(p); open = null">Duplicate</button>
<button data-danger @click="del(p.id); open = null">Delete</button>
</div>
</li>
</ul>
</template>
<style scoped>
.plrl { border-radius: 12px; background: #fff; box-shadow: 0 1px 4px #00000012; }
.plrl > li { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
border-block-start: 1px solid #e3e3e3; }
.plrl-kebab + .plrl-menu { position: absolute; inset-inline-end: 16px; border-radius: 8px;
background: #fff; box-shadow: 0 4px 16px #00000022; }
</style>
<!-- ResourceList.svelte -->
<script lang="ts">
import '@nabuxai/ui-core/css';
interface Product { id: number; name: string; sku: string; price: string; tone: 'active' | 'draft' }
let prods = $state<Product[]>([
{ id: 1, name: 'Soy candle, minimal', sku: 'CD-220', price: '$24.00', tone: 'active' },
{ id: 2, name: 'Ceramic mug, 350 ml', sku: 'MG-350', price: '$19.50', tone: 'draft' },
]);
let open = $state<number | null>(null);
const dup = (p: Product) =>
prods.push({ ...p, id: Date.now(), name: `${p.name} (copy)`, tone: 'draft' });
const del = (id: number) => (prods = prods.filter((p) => p.id !== id));
</script>
<ul class="plrl">
{#each prods as p (p.id)}
<li>
<span class="plrl-body"><b>{p.name}</b><small>SKU: {p.sku} · {p.price}</small></span>
<span class="plrl-badge" data-tone={p.tone}>{p.tone === 'active' ? 'Active' : 'Draft'}</span>
<button class="plrl-kebab" aria-expanded={open === p.id} onclick={() => (open = open === p.id ? null : p.id)}>⋯</button>
{#if open === p.id}
<div class="plrl-menu" role="menu">
<button onclick={() => { dup(p); open = null; }}>Duplicate</button>
<button data-danger onclick={() => { del(p.id); open = null; }}>Delete</button>
</div>
{/if}
</li>
{/each}
</ul>
<style>
.plrl { border-radius: 12px; background: #fff; box-shadow: 0 1px 4px #00000012; }
.plrl > li { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
border-block-start: 1px solid #e3e3e3; }
.plrl-kebab + .plrl-menu { position: absolute; inset-inline-end: 16px; border-radius: 8px;
background: #fff; box-shadow: 0 4px 16px #00000022; }
</style>