--- title: Javascript section: Guides description: Step-by-step guide to installing and integrating the importOK component in your Javascript project --- Add a complete CSV and Excel importer to your Next.js app, with column mapping, real-time validation, and API integration built in. @importok/javascript ## Installation Install the following package ```bash npm install @importok/javascript ``` **Note**: The trial version is available on NPM. When you upgrade, you'll get access to our [private packages](/docs/private-packages) with full features. No code changes required. ## Your first importer Create a basic contact importer: ```javascript import ImportOK from './node_modules/@importok/javascript/importok.js'; window.onload = function () { const fields = { first_name: { label: 'First Name' }, last_name: { label: 'Last Name' }, email: { label: 'Email' }, phone: { label: 'Phone' }, country: { label: 'Country' } }; ImportOK.add( document.getElementById('import-wizard'), ); } ``` That's it. Users can now upload CSV or Excel files and map columns to your fields. ## Make it production-ready ### Add data transformations Clean up data before validation using [transformers](/docs/transformers): ```javascript const fields = { first_name: { label: 'First Name', transformers: 'trim|capitalize' // Built-in transformers }, last_name: { label: 'Last Name', transformers: 'trim|capitalize' }, email: { label: 'Email', transformers: 'trim' } }; ``` [See all built-in transformers →](/docs/transformers) ### Add validation rules Catch errors before they reach your API using [validators](/docs/validators): ```javascript const fields = { first_name: { label: 'First Name', transformers: 'trim|capitalize' }, last_name: { label: 'Last Name', transformers: 'trim|capitalize', validators: 'required' // Built-in validators }, email: { label: 'Email', transformers: 'trim', validators: 'email|required' } }; ``` [See all built-in validators →](/docs/validators) ### Connect to your API Send validated data to your backend: ```javascript import ImportOK from './node_modules/@importok/javascript/importok.js'; window.onload = function () { const fields = { /* ... */ }; const handleImport = async function (records, meta) { const response = await fetch('/api/contacts/imports', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(records) }); return response; }; ImportOK.add( document.getElementById('import-wizard'), ); } ``` ## Complete example Here's everything together: ```javascript import ImportOK from './node_modules/@importok/javascript/importok.js'; window.onload = function () { const fields = { first_name: { label: 'First Name', transformers: 'trim|capitalize' }, last_name: { label: 'Last Name', transformers: 'trim|capitalize', validators: 'required' }, email: { label: 'Email', transformers: 'trim', validators: 'email|required' } }; const handleImport = async function (records, meta) { const response = await fetch('/api/contacts/imports', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(records) }); return response; }; ImportOK.add( document.getElementById('import-wizard'), ); } ``` ## Next steps Now that you have a working importer, explore advanced features: - **[Custom validators](/docs/validators)** - Add business-specific validation rules - **[Custom transformers](/docs/transformers)** - Create domain-specific data cleanup - **[Data providers](/docs/data-providers)** - Connect dropdowns to your API - **[Props & events](/docs/component-props-events)** - Customize behavior and styling - **[Field configuration](/docs/fields)** - Deep dive into field options ## Try it live Experiment with a complete example in StackBlitz: [Open in StackBlitz →](https://stackblitz.com/github/importok/javascript-example?file=index) ## Trial limitations The free trial includes: - ✅ Full UI and mapping features - ✅ Built-in validators and transformers - ⚠️ **20 records per import** (unlimited on paid plans) - ⚠️ **Up to 2 custom validators** (unlimited on paid plans) - ⚠️ **Up to 2 custom transformers** (unlimited on paid plans) - ⚠️ **Up to 2 data providers** (unlimited on paid plans) When you're ready, [upgrade to unlock full features](/pricing) with access to our [private packages](/docs/private-packages).