Shopify Polaris JS behaviour

Filters Bar

Applied filters become removable chips above the list with a one-click 'Clear all filters' — Shopify's grid toolbar with search, saved views and sorting in one bar.

Documentation

Real scenarios

The component as it is used in a product — not a specimen grid.

Filter, chip, sweep

Search as you type, open «Filters» and pick statuses or channels — each lands as a removable chip. One click on «Clear all filters» sweeps them, and the list underneath live-filters.

Payment status
Sales channel

6 results

Nothing matches these filters

Chip variants

Applied chips carry an ×, locked chips (store defaults) render dashed without one, and tone chips keep their status colour.

Paid removable
Shop default locked
At risk tone

Important props

Important props
Prop Type Default What it does
query search '' The bar's live search; the list filters as you type.
chip removable '×' Every applied filter is a chip with an ×; removing it lifts the filter at once.
clear-all action 'one-click' 'Clear all filters' only appears while chips exist and sweeps them in one click.

Snippet

<div class="plfl" x-data="{ q: '', chips: [] }">
    <div class="plfl-bar">
        <input x-model="q" placeholder="Search orders">
        <button x-on:click="panel = true">Filters</button>
    </div>
    <div class="plfl-chips">
        <template x-for="c in chips"><span class="plfl-chip" x-text="c" x-on:click="drop(c)">×</span></template>
        <button x-show="chips.length" x-on:click="chips = []">Clear all filters</button>
    </div>
</div>

<style>
.plfl-bar { display: flex; gap: 8px; }
.plfl-bar input { block-size: 36px; padding-inline: 12px; border: 1px solid #8A8A8A;
                  border-radius: 8px; background: #FFF; }
.plfl-chip { display: inline-flex; align-items: center; gap: 6px; block-size: 28px;
             padding-inline: 10px; border-radius: 8px; border: 1px solid #E3E3E3;
             background: #FFF; }
</style>
// resources/js/Pages/Orders/Browse.tsx — the query lives in URL
// search params so filters survive reloads and shareables.
import { Head, usePage } from '@inertiajs/react';
import FiltersBar from '@/components/polaris/FiltersBar';

export default function OrdersBrowse() {
  const { filters } = usePage().props; // { q: string, statuses: string[] }
  return (
    <>
      <Head title="Orders" />
      {/* The snippet reports chip changes; persist them per route */}
      <FiltersBar initialQuery={filters.q} initialChips={filters.statuses} />
    </>
  );
}
import { useState } from 'react';
import '@nabuxai/ui-core/css';

const STATUSES = ['Paid', 'Pending', 'Refunded'] as const;

export default function FiltersBar() {
  const [q, setQ] = useState('');
  const [chips, setChips] = useState<string[]>([]);
  const clearAll = () => { setQ(''); setChips([]); };

  return (
    <div className="plfl">
      <div className="plfl-bar">
        <input value={q} onChange={(e) => setQ(e.target.value)} placeholder="Search orders" aria-label="Search orders" />
        {STATUSES.map((s) => (
          <button key={s} onClick={() => setChips((c) => (c.includes(s) ? c : [...c, s]))}>{s}</button>
        ))}
      </div>
      <div className="plfl-chips">
        {q.trim() !== '' && (
          <span className="plfl-chip">Search: {q.trim()} <button aria-label="Remove search filter" onClick={() => setQ('')}>✕</button></span>
        )}
        {chips.map((c) => (
          <span key={c} className="plfl-chip">
            {c} <button aria-label={`Remove ${c}`} onClick={() => setChips((list) => list.filter((x) => x !== c))}>✕</button>
          </span>
        ))}
        {(chips.length > 0 || q.trim() !== '') && <button className="plfl-clear" onClick={clearAll}>Clear all filters</button>}
      </div>
      <style>{`
        .plfl-bar { display: flex; gap: 8px; }
        .plfl-bar input { block-size: 36px; padding-inline: 12px; border: 1px solid #8A8A8A;
                          border-radius: 8px; background: #FFF; }
        .plfl-chip { display: inline-flex; align-items: center; gap: 6px; block-size: 28px;
                     padding-inline: 10px; border-radius: 8px; border: 1px solid #E3E3E3; background: #FFF; }
      `}</style>
    </div>
  );
}
<!-- FiltersBar.vue -->
<script setup lang="ts">
import { ref } from 'vue';
import '@nabuxai/ui-core/css';

const STATUSES = ['Paid', 'Pending', 'Refunded'];
const q = ref('');
const chips = ref<string[]>([]);
const add = (s: string) => { if (!chips.value.includes(s)) chips.value.push(s); };
const drop = (c: string) => (chips.value = chips.value.filter((x) => x !== c));
const clearAll = () => { q.value = ''; chips.value = []; };
</script>

<template>
  <div class="plfl">
    <div class="plfl-bar">
      <input v-model="q" placeholder="Search orders" aria-label="Search orders" />
      <button v-for="s in STATUSES" :key="s" @click="add(s)">{{ s }}</button>
    </div>
    <div class="plfl-chips">
      <span v-if="q.trim()" class="plfl-chip">Search: {{ q.trim() }} <button aria-label="Remove search filter" @click="q = ''">✕</button></span>
      <span v-for="c in chips" :key="c" class="plfl-chip">{{ c }} <button :aria-label="`Remove ${c}`" @click="drop(c)">✕</button></span>
      <button v-if="chips.length || q.trim()" class="plfl-clear" @click="clearAll">Clear all filters</button>
    </div>
  </div>
</template>

<style scoped>
.plfl-bar { display: flex; gap: 8px; }
.plfl-bar input { block-size: 36px; padding-inline: 12px; border: 1px solid #8a8a8a;
                  border-radius: 8px; background: #fff; }
.plfl-chip { display: inline-flex; align-items: center; gap: 6px; block-size: 28px;
             padding-inline: 10px; border-radius: 8px; border: 1px solid #e3e3e3; background: #fff; }
</style>
<!-- FiltersBar.svelte -->
<script lang="ts">
  import '@nabuxai/ui-core/css';

  const STATUSES = ['Paid', 'Pending', 'Refunded'];
  let q = $state('');
  let chips = $state<string[]>([]);
  const add = (s: string) => { if (!chips.includes(s)) chips.push(s); };
  const drop = (c: string) => (chips = chips.filter((x) => x !== c));
  const clearAll = () => { q = ''; chips = []; };
</script>

<div class="plfl">
  <div class="plfl-bar">
    <input bind:value={q} placeholder="Search orders" aria-label="Search orders" />
    {#each STATUSES as s (s)}<button onclick={() => add(s)}>{s}</button>{/each}
  </div>
  <div class="plfl-chips">
    {#if q.trim()}<span class="plfl-chip">Search: {q.trim()} <button aria-label="Remove search filter" onclick={() => (q = '')}>✕</button></span>{/if}
    {#each chips as c (c)}<span class="plfl-chip">{c} <button aria-label="Remove {c}" onclick={() => drop(c)}>✕</button></span>{/each}
    {#if chips.length || q.trim()}<button class="plfl-clear" onclick={clearAll}>Clear all filters</button>{/if}
  </div>
</div>

<style>
.plfl-bar { display: flex; gap: 8px; }
.plfl-bar input { block-size: 36px; padding-inline: 12px; border: 1px solid #8a8a8a;
                  border-radius: 8px; background: #fff; }
.plfl-chip { display: inline-flex; align-items: center; gap: 6px; block-size: 28px;
             padding-inline: 10px; border-radius: 8px; border: 1px solid #e3e3e3; background: #fff; }
</style>