The ultimate bulk paste solution for React applications. Parse, validate, and handle thousands of pasted values with ease.
Perfect for enterprise dashboards, admin panels, and data filtering interfaces where users need to paste large lists of IDs, SKUs, emails, or codes.
- ๐ Fast: Handles 10,000+ values efficiently
- ๐ฏ Smart Parsing: Auto-detects commas, newlines, tabs, semicolons
- ๐ Flexible Validation: In-memory sets or async API validation
- ๐ Visual Feedback: Real-time counts and lists of valid/invalid items
- โ๏ธ React Ready: Drop-in component with TypeScript support
- ๐จ Headless Core: Use with any UI framework
- ๐ฆ Zero Dependencies: Lightweight and tree-shakeable
npm install pastebox-react pastebox-coreimport { PasteSelect } from "pastebox-react";
import { inMemorySetValidator } from "pastebox-core";
const allowedValues = new Set(["A123", "B456", "C789", "SKU-999"]);
function App() {
return (
<PasteSelect
validate={inMemorySetValidator(allowedValues)}
onChange={(result) => {
console.log(`${result.validate.valid.length} valid items found!`);
}}
/>
);
}npm install pastebox-corePure parsing and validation logic. Framework agnostic.
import { parse, inMemorySetValidator } from "pastebox-core";
const text = "A123,B456\nC789, A123"; // messy input
const result = parse(text);
console.log(result.uniques); // ["A123", "B456", "C789"]
const validator = inMemorySetValidator(new Set(["A123", "C789"]));
const validation = await validator(result.uniques);
// { valid: ["A123", "C789"], invalid: ["B456"] }npm install pastebox-react pastebox-coreReady-to-use React component with visual feedback.
Try pasting this sample data:
A123, B456
C789; INVALID-001
SKU-999 ITEM-001
A123 (duplicate)
- SaaS Dashboards: Bulk SKU/product code filtering
- Enterprise CRMs: Bulk email or customer ID validation
- Admin Panels: Import/validate large datasets
- Marketing Tools: Clean pasted contact lists
- Internal Tools: Process ticket IDs, reference numbers
Parse pasted text into structured data.
type ParseOptions = {
delimiters?: string[]; // Default: [",", "\n", "\t", ";"]
normalize?: (v: string) => string; // Default: v => v.trim()
caseSensitive?: boolean; // Default: true
maxValues?: number; // Default: 10000
};// In-memory validation
const validator = inMemorySetValidator(allowedSet);
// Batched API validation
const validator = batchedValidator(
async (batch) => {
const response = await fetch('/api/validate', {
method: 'POST',
body: JSON.stringify({ values: batch })
});
return response.json(); // { valid: string[], invalid: string[] }
},
500 // batch size
);| Prop | Type | Required | Description |
|---|---|---|---|
validate |
ValidateFn |
โ | Function to validate values |
delimiters |
string[] |
โ | Custom delimiters |
normalize |
(v: string) => string |
โ | Value normalizer |
maxValues |
number |
โ | Max values (default: 10000) |
caseSensitive |
boolean |
โ | Case sensitivity (default: true) |
onChange |
(result) => void |
โ | Result callback |
className |
string |
โ | CSS class |
# Clone the repository
git clone https://github.com/sagarah/paste-select.git
cd paste-select
# Install dependencies
pnpm install
# Build packages
pnpm build
# Run demo
pnpm devContributions are welcome! Please feel free to submit a Pull Request.
MIT ยฉ sagarah
Built with:
โญ If this library helped you, please consider giving it a star!