Range Select Guard

Range Select Guard is a copy-paste React component that stops shift-click selected thousand rows before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/range-select-guard
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsShift-click selected thousand rows

Was this component page useful?

How do I install Range Select Guard?

pnpm dlx shadcn@latest add @bollard/range-select-guard

The files land in your project. They're yours to edit.

How do I use Range Select Guard in React?

range-select-guard-usage.tsx
import { RangeSelectGuard, type RangeRow } from "@/components/ui/range-select-guard"

<RangeSelectGuard label="Invoices" rows={rows} pageSize={6} value={selected} onValueChange={setSelected} />

What input mistakes does Range Select Guard catch?

  • Shift-click ranges much larger than intended
  • Rows hidden by the filter: skipped and reported
  • Selected rows on pages never opened
  • Selected rows that a filter now hides, with deselect

What props does Range Select Guard accept?

RangeSelectGuard props
PropTypeDefault
rows* (required)

Every row in display order, including ones the current filter hides.

RangeRow[]—
pageSize

Rows per page.

number10
value

Controlled selected ids.

string[]—
defaultValue

Initial selected ids when uncontrolled.

string[][]
onValueChange

Called with the selected ids.

(ids: string[]) => void—
label

Accessible name of the list.

string"Rows"
rangeText

Templates. `{how}`, `{count}`, `{pages}` are filled in.

string"{how} selected {count} rows"
skippedText

Template for rows skipped because the filter hides them.

string"skipped {count} hidden by your filter"
offPageText

Template for selected rows on pages not opened.

string"{count} are on {pages}, out of view"
onlyPageLabel

Button text to keep only this page's rows.

string"Only the ones I saw ({count})"
undoLabel

Undo button text.

string"Undo"
hiddenSelectedText

Template for selected rows the filter hides.

string"{count} selected rows are hidden by your filter."
deselectHiddenLabel

Button text to deselect hidden rows.

string"Deselect them"

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Range Select Guard accessible?

  • Pagination buttons have aria-labels; the page indicator is a polite live region
  • Selection readback is a polite live region
  • Focus stays on the clicked row; highlight motion is skipped under reduced motion

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Works on the rows you pass; server-side "select all" isn't covered
  • Bulk actions are yours to gate

What expensive mistakes does Range Select Guard stop?

Shift-click selected thousand rows

Also known as

shift click · range select · multi select · data table · checkbox rows · tanstack table · bulk select

Field type

What dependencies does Range Select Guard require?

Range Select Guard facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameRange Select Guard
Registry identifier@bollard/range-select-guard
Install commandnpx shadcn@latest add @bollard/range-select-guard
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Range Select Guard

How does Range Select Guard protect destructive mutations?

Range Select Guard prevents shift-click selected thousand rows. Enforces deliberate friction against Shift-click ranges much larger than intended, Rows hidden by the filter: skipped and reported, Selected rows on pages never opened, Selected rows that a filter now hides, with deselect. Limitation: authorize range-select-guard mutations on the server.

How do I install range-select-guard with shadcn?

Run `npx shadcn@latest add @bollard/range-select-guard`. Sources added: registry/default/range-select-guard/range-select-guard.tsx. Package requirements: lucide-react.

What props customize Range Select Guard?

Range Select Guard accepts `rows`, `pageSize`, `value`, `defaultValue`, `onValueChange`. Configures shift click, range select, multi select behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of range-select-guard?

Works on the rows you pass; server-side "select all" isn't covered. Bulk actions are yours to gate Server requirement: backend verification for range-select-guard.

How does Range Select Guard meet accessibility guidelines?

Pagination buttons have aria-labels; the page indicator is a polite live region. Selection readback is a polite live region. Focus stays on the clicked row; highlight motion is skipped under reduced motion. Minimizes errors: shift click selected too many, selected hidden rows.

Which components pair with Range Select Guard?