Bulk bar
Appears at the bottom of the table when one or more rows are selected.
Open in FigmaUsage
import { BulkBar } from '@pilar-amoda/ui/bulk-bar';States
count drives Single and Multiple (“1 dipilih”, “12 dipilih”); processing disables the chip and Export and shows the spinner. Fixed, 24 above the bottom edge, centered by default.
'use client';
import { BulkBar } from '@pilar-amoda/ui/bulk-bar';
const noop = () => undefined;
/** Single, Multiple and Processing. In an app the bar is position="fixed" (the default). */
export const BulkBarStates = () => (
<div className="flex flex-col items-start gap-4">
<BulkBar
position="inline"
count={1}
onClear={noop}
onExport={noop}
onAllocate={noop}
data-testid="barSingle_BulkBar"
/>
<BulkBar
position="inline"
count={12}
onClear={noop}
onExport={noop}
onAllocate={noop}
data-testid="barMultiple_BulkBar"
/>
<BulkBar
position="inline"
count={1}
processing
onClear={noop}
onExport={noop}
onAllocate={noop}
data-testid="barProcessing_BulkBar"
/>
</div>
);With a selection
The bar hides when nothing is selected; the × chip clears the selection.
Renovasi Gudang Cikarang
Renovasi Kantor Pusat
Pengadaan Rak Teluk Naga
'use client';
import { useState } from 'react';
import { BulkBar } from '@pilar-amoda/ui/bulk-bar';
import { Checkbox } from '@pilar-amoda/ui/checkbox';
const requestOrders = [
{ id: 'RO-1026-0004', name: 'Renovasi Gudang Cikarang' },
{ id: 'RO-1026-0007', name: 'Renovasi Kantor Pusat' },
{ id: 'RO-1026-0009', name: 'Pengadaan Rak Teluk Naga' },
] as const;
/** Select rows to show the bar; × clears the selection; the main action shows Processing. */
export const BulkBarInteractive = () => {
const [selected, setSelected] = useState<readonly string[]>(['RO-1026-0004', 'RO-1026-0007']);
const [processing, setProcessing] = useState(false);
const toggle = (id: string, checked: boolean) => {
setSelected((current) => (checked ? [...current, id] : current.filter((item) => item !== id)));
};
const allocate = () => {
setProcessing(true);
setTimeout(() => {
setProcessing(false);
setSelected([]);
}, 1500);
};
return (
<div className="flex w-full flex-col items-center gap-6">
<div className="text-pilar-xs flex flex-col gap-3 self-start">
{requestOrders.map((ro) => (
<div key={ro.id} className="flex items-center gap-3">
<Checkbox
aria-label={`Pilih ${ro.name}`}
checked={selected.includes(ro.id)}
disabled={processing}
onCheckedChange={(checked) => {
toggle(ro.id, checked);
}}
data-testid={`chkRo_${ro.id}`}
/>
{ro.name}
</div>
))}
</div>
<BulkBar
position="inline"
count={selected.length}
processing={processing}
onClear={() => {
setSelected([]);
}}
onExport={() => undefined}
onAllocate={allocate}
data-testid="barSelection_BulkBar"
/>
</div>
);
};Do and don't
Do: show the selected count and a way to clear it.
Don't: put more than two actions in the bar.