# Height and Width
Source: https://hellocsv.mintlify.app/common/customization/height-and-width
You can customize the dimensions by setting `height`, `max-height`, `width`, or `max-width`. To ensure proper scaling and responsiveness, it's important to include `flex`.
```jsx theme={null}
```
# Docs
Source: https://hellocsv.mintlify.app/common/development/docs
To run mintlify locally
```bash theme={null}
cd docs
```
```bash theme={null}
PUPPETEER_SKIP_DOWNLOAD=true npm i -g mintlify
```
```bash theme={null}
mintlify dev
```
# No Build Example
Source: https://hellocsv.mintlify.app/common/development/no-build-example
To run a no build example you could run
```bash theme={null}
npx http-server .
```
This will run the example application at `http://localhost:8080`
# XLSX & Custom Data Formats
Source: https://hellocsv.mintlify.app/common/get-started/custom-file-loaders
## Custom File Loaders
HelloCSV supports integrating data formats different from standard CSV / TSV uploads by allowing developers to create a `CustomFileLoader`
```tsx theme={null}
interface CustomFileLoader {
mimeType: string;
label: string;
convert: (
loadEvent: ProgressEvent,
file: File
) =>
| {
fileName: string;
csvData: string;
}
| Promise<{
fileName: string;
csvData: string;
}>;
}
```
A `CustomFileLoader` is responsible for parsing a file, of a target `mimeType`, and returning a `csvData` string, which then gets passed
to the rest of the pipeline.
The `convert` function supports returning a promise for parsing files server-side if needed.
### Usage
See [customFileLoader](https://hellocsv.mintlify.app/v0.6.0/api-reference/importer-props#customfileloaders) prop.
# Demo
Source: https://hellocsv.mintlify.app/common/get-started/demo
See hello-csv in action
# Demo
Visit [the demo page](https://HelloCSV.github.io/HelloCSV/) to see hello-csv in action!
# Introduction
Source: https://hellocsv.mintlify.app/common/get-started/introduction
Welcome to HelloCSV
# Multiple Sheets
Source: https://hellocsv.mintlify.app/common/get-started/multiple-sheets
## Multiple Sheets
Often you'll want to import data that actually implicitly has multiple data schemas within it. For example, consider importing a CSV of employees working across multiple companies.
In the above example, the company fields are actually duplicated for both Emily and Chris.
In this case, you'd most likely have a database table called `employees` and another one called `companies`, so this import should create **3 users** but only **2 companies**.
HelloCSV allows you to split the `employee` data and `company` data into separate sheets on the frontend, before the upload, to give the user a chance to review the upload and make edits.
Here is an example HelloCSV definition for the data above:
```tsx theme={null}
{
// Filter companies down to only unique names
const sheet = sheets.find((sheet: any) => sheet.sheetId === 'companies')!;
const seen = new Set();
sheet.rows = [...sheet.rows].filter((row: SheetRow) => {
// Remove duplicate companies
const hasSeen = !seen.has(row.name);
seen.add(row.name);
return hasSeen;
});
return sheets;
}}
onComplete={async (data) => {
const employees = data.sheetData.find((s: any) => s.id === 'employees');
const companies = data.sheetData.find((s: any) => s.id === 'companies');
console.log(employees);
// [{id: 1, name: "Mat", company: "Dunder Mifflin"}, {id: 2, name: "Emily", company: "Los Pollos Hermanos"}, {id: 3, name: "Chris", company: "Los Pollos Hermanos"}]
console.log(companies);
// [{name: "Dunder Mifflin", industry: "Paper"}, {name: "Los Pollos Hermanos", industry: "Food & Beverage"}]
}}
/>
```
### Screenshots
**Preview**
**Mapping**
**Employees Sheet**
**Companies Sheet**
# Persistence
Source: https://hellocsv.mintlify.app/common/get-started/persistence
## Persistence
HelloCSV supports using [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) for persisting state. This ensures that users don't lose any edits they make if the page refreshes, and allows them to come back to a partially imported state later.
The data is saved in the browsers IndexedDB store, so this data never leaves the user's browser. Therefore, if a different browser is used, the saved session will not be maintained.
HelloCSV will invalidate any state that is saved if the definition of the importer changes. For example, if the definition of an importer is changed such that a new column is added, the state previously saved will not be maintained.
### Persistence Configuration
```tsx theme={null}
export interface PersistenceConfig {
enabled: boolean;
customKey?: string;
}
```
### Usage
```tsx theme={null}
```
The persistence configuration also supports a custom key, so that you as the developer can invalidate any saved importing sessions. Intuitively, the key that the data is saved under can be thought of as: `key = importer_definition + custom_key`.
Be careful that you don't accidentally leak information across multiple users who may be sharing the same browser with this feature.
# Why?
Source: https://hellocsv.mintlify.app/common/get-started/why
The motivation behind hello-csv
# Why?
Every project I’ve worked on needed some hacked together CSV importer. **hello-csv** fixes this by implementing a modern CSV import flow for React projects!
# Column Types
Source: https://hellocsv.mintlify.app/v0.6.0/api-reference/column-types
This section lists the available column types.
## string
**Description:**\
Basic text column.
***
## number
**Description:**\
Numeric column.
***
## boolean
**Description:**\
Boolean column.
**Additional:**\
`typeArguments?: { trueLabel?: string, falseLabel?: string, trueValues?: string[], falseValues?: string[] }`
**Notes:**
* `trueLabel` / `falseLabel` are the labels shown in the dropdown editor and in label-mode CSV export. Defaults are `Yes` and `No`.
* On import, cell text is coerced to a boolean **case-insensitively**. By default, `true`, `1`, `yes`, `y` become `true` and `false`, `0`, `no`, `n` become `false`. The configured `trueLabel` / `falseLabel` are always accepted too.
* `trueValues` / `falseValues` override the accepted tokens. When provided they **replace** the built-in defaults (the label still counts).
* A value that matches neither set is kept as-is and flagged by the automatic [boolean](/v0.6.0/api-reference/validators#boolean) validator.
**Example:**
```ts theme={null}
{
label: 'Active',
id: 'active',
type: 'boolean',
typeArguments: {
trueLabel: 'Active',
falseLabel: 'Inactive',
trueValues: ['on', 'active', '1'],
falseValues: ['off', 'inactive', '0'],
},
}
```
For a CSV cell containing `"on"`, the stored value will be `true`.
***
## date
**Description:**\
A calendar date, edited with a calendar picker.
**Additional:**\
`typeArguments?: { outputFormat?: string, displayFormat?: string, min?: string, max?: string }`
**Notes:**
* Values are **stored and returned as normalized strings** in `outputFormat`. `displayFormat` controls how the value is shown in the grid cell and the editor input. Both use [dayjs tokens](https://day.js.org/docs/en/display/format).
* On import, cell text is parsed against `outputFormat`, `displayFormat`, and the ISO fallback. A parseable value is normalized to `outputFormat`; anything else is kept as-is and flagged by the automatic [date](/v0.6.0/api-reference/validators#date) validator.
* `min` / `max` bound the allowed range: out-of-range values are flagged by the validator, and out-of-range days are disabled in the picker (`date` / `datetime`). For `datetime` / `time` the comparison includes the time portion.
* **`min` / `max` format:** they're parsed leniently — accepted in **ISO** (`YYYY-MM-DD`, `YYYY-MM-DDTHH:mm:ss`, `HH:mm:ss`), in the column's `outputFormat` or `displayFormat`, or in a default format. **ISO is always accepted even if you override `outputFormat` / `displayFormat`**, so it's the recommended way to specify bounds. A bound that matches none of these is silently ignored (treated as no bound).
**Default formats** (used when `outputFormat` / `displayFormat` are omitted) — these apply to all three date-like types:
| Type | Default `outputFormat` (stored & returned) | Default `displayFormat` (shown) |
| - | - | - |
| `date` | `YYYY-MM-DD` | `MMM D, YYYY` |
| `datetime` | `YYYY-MM-DDTHH:mm` (`…:ss` with `showSeconds`) | `MMM D, YYYY h:mm A` |
| `time` | `HH:mm` (`HH:mm:ss` with `showSeconds`) | `h:mm A` |
The stored/returned value is always 24-hour; `hourFormat: '24h'` changes the default `displayFormat` time part to `HH:mm`.
**Example:**
```ts theme={null}
{
label: 'Start Date',
id: 'start_date',
type: 'date',
typeArguments: {
displayFormat: 'MMM D, YYYY',
min: '2000-01-01',
},
}
```
For a CSV cell containing `"31/12/2026"` with `outputFormat: 'DD/MM/YYYY'`, the stored value will be `"2026-12-31"` (ISO) — or `"31/12/2026"` if that same `outputFormat` is used for output.
***
## datetime
**Description:**\
A date and time, edited with a combined calendar + time picker.
**Additional:**\
`typeArguments?: { outputFormat?: string, displayFormat?: string, min?: string, max?: string, showSeconds?: boolean, hourFormat?: '12h' | '24h' }`
**Notes:**
* Same behavior as [date](#date). By default seconds are omitted: `outputFormat` is `YYYY-MM-DDTHH:mm` and `displayFormat` is `MMM D, YYYY h:mm A`.
* Set `showSeconds: true` to add a seconds field to the picker and include seconds in the default formats (`YYYY-MM-DDTHH:mm:ss`). Explicit `outputFormat` / `displayFormat` always take precedence.
* `hourFormat` controls the picker clock and default display: `'12h'` (default) shows an AM/PM toggle; `'24h'` uses a 24-hour field. The stored `outputFormat` value is always 24-hour.
**Example:**
```ts theme={null}
{
label: 'Created At',
id: 'created_at',
type: 'datetime',
}
```
For a CSV cell containing `"2026-12-31T10:30:00"`, the stored value will be `"2026-12-31T10:30"` (seconds dropped by default; use `showSeconds: true` to keep them).
***
## time
**Description:**\
A time of day, edited with a time picker.
**Additional:**\
`typeArguments?: { outputFormat?: string, displayFormat?: string, min?: string, max?: string, showSeconds?: boolean, hourFormat?: '12h' | '24h' }`
**Notes:**
* Same behavior as [date](#date). By default seconds are omitted: `outputFormat` is `HH:mm` and `displayFormat` is `h:mm A`.
* Set `showSeconds: true` to add a seconds field to the picker and use `HH:mm:ss` as the default output.
* `hourFormat` controls the picker clock and default display: `'12h'` (default) shows an AM/PM toggle; `'24h'` uses a 24-hour field. The stored `outputFormat` value is always 24-hour.
**Example:**
```ts theme={null}
{
label: 'Shift Start',
id: 'shift_start',
type: 'time',
typeArguments: {
displayFormat: 'h:mm A',
},
}
```
For a CSV cell containing `"9:30 AM"` with `displayFormat: 'h:mm A'`, the stored value will be `"09:30"` (or `"09:30:00"` with `showSeconds: true`).
***
## reference
**Description:**\
References data from another sheet.
**Additional:**\
`typeArguments: { sheetId: string, sheetColumnId: string }`
***
## calculated
**Description:**\
Computed column value (read-only).
**Additional:**\
`typeArguments: { getValue: (row: SheetRow) => ImporterOutputFieldType }`
***
## enum
**Description:**
Column with predefined values. Supports both single-select and multi-select modes.
**Additional:**
```ts theme={null}
// Single-select (default)
typeArguments: {
values: SelectOption[];
multiple?: false;
}
// Multi-select
typeArguments: {
values: SelectOption[];
multiple: true;
delimiter?: string | RegExp; // Default: ','
}
```
**Notes:**
```ts theme={null}
export interface SelectOption {
label: ImporterOutputFieldType;
value: T;
icon?: ReactNode;
group?: string;
}
```
**Multi-Select Behavior:**
* When `multiple: true`, values are stored as `string[]` instead of `string`
* CSV values are split by `delimiter` (default: comma)
* Each part is trimmed and mapped from label to value
* Display shows comma-separated labels
**Example:**
```ts theme={null}
{
label: 'Skills',
id: 'skills',
type: 'enum',
typeArguments: {
values: [
{ label: 'JavaScript', value: 'js' },
{ label: 'Python', value: 'py' },
{ label: 'React', value: 'react' },
],
multiple: true,
delimiter: ',',
},
}
```
For a CSV cell containing `"JavaScript, Python"`, the stored value will be `["js", "py"]`.
# Common Column Props
Source: https://hellocsv.mintlify.app/v0.6.0/api-reference/common-column-props
All column types share these properties.
## id
**Type:** `string`
**Required:** Yes
**Description:**\
Unique identifier for the column.
***
## type
**Type:** `ColumnType`
**Required:** Yes
**Description:**\
Defines the column type.
***
## label
**Type:** `string`
**Required:** Yes
**Description:**\
Display name for the column.
***
## suggestedMappingKeywords
**Type:** `string[]`
**Required:** No
**Description:**\
Keywords to assist in automatic mapping.
***
## isReadOnly
**Type:** `boolean`
**Required:** No
**Description:**\
Indicates whether the column is editable.
***
## validators
**Type:** `ImporterValidatorDefinition[]`
**Required:** No
**Description:**\
Array of validation rules.
***
## transformers
**Type:** `ImporterTransformerDefinition[]`
**Required:** No
**Description:**\
Array of transformation rules.
***
## customRender
**Type:** `(value: ImporterOutputFieldType, displayValue: ImporterOutputFieldType) => ReactNode`
**Required:** No
**Description:**\
Custom render function for the cell.
The function gets passed
* `value` - the row value of the cell
* `displayValue` - the display value of the cell - that is a value that extracts enum labels and prevents empty values from being displayed. You should use this value to display the cell.
The function should return a ReactNode.
When rendering the cell you should remember that the background color of the cell could be
* `hc:bg-hello-csv-danger-extra-light` - in case of validation errors
* `hc:bg-hello-csv-muted` - in case of read only columns
* default background colors - in other case
As of v0.6.0 all of HelloCSV's internal utility classes are namespaced with the
`hc:` prefix (e.g. `hc:bg-hello-csv-muted`). See
[Upgrade from v0.5.0](/v0.6.0/upgrade/from-v-0-5-0) for details.
# CSV Importer State Builder
Source: https://hellocsv.mintlify.app/v0.6.0/api-reference/csv-importer-state-builder
This section describes the state builder object of the importer.
## constructor
**Parameters:** `importerDefinition: Pick<
ImporterDefinition, | 'sheets' | 'customFileLoaders' | 'customSuggestedMapper' | 'onDataColumnsMapped'>`
**Description:**\
Defines the importer configuration. Checkout the [Importer Props](/v0.3.7/api-reference/importer-props) section for more information.
***
# Methods
The order of the methods might be important. Please follow the order defined below. You don't need to run all the methods though.
## uploadFile
**Parameters:** `file: File`
**Required to call next steps:** Yes
**Description:**\
Keep in mind that this is asynchronous function. Make sure to await the result of it.
The function simulates the upload of a file. It will parse the file and build the suggested mappings.
## setEnterDataManually
**Parameters:** `amountOfEmptyRowsToAdd?: number`
**Required to call next steps:** No
**Description:**\
This method will add empty rows to the current sheet and switch the mode to preview - this means that it will skip
the mapping step and ignore uploaded file.
## setMappings
**Parameters:** `mappings: ColumnMapping[]`
**Required to call next steps:** No
**Description:**\
This method will set the mappings for the current sheet.
## confirmMappings
**Parameters:** `mappings: ColumnMapping[]`
**Required to call next steps:** Yes
**Description:**
Remember that this is asynchronous function. Make sure to await the result of it.
Confirm the mappings for the current sheet. This will switch the mode to preview.
## getState
**Parameters:** `none`
**Description:**\
Returns the built state. This should be the last method you call.
Function is async, so you need to await it's results.
# Example
```tsx theme={null}
import { useEffect, useState } from 'preact/hooks';
import Importer, {
CsvImporterStateBuilder,
ImporterDefinition,
ImporterState,
} from 'hello-csv/preact';
import Content from '../Content';
import DocumentContainer from '../DocumentContainer';
import example1 from '../../assets/datasets/example-1.csv?url';
export default function EmployeeImporter() {
const [ready, setReady] = useState(false);
const [initialState, setInitialState] = useState(
undefined
);
const onComplete = async (
data: ImporterState,
onProgress: (progress: number) => void
) => {
await new Promise((resolve) => setTimeout(resolve, 200));
onProgress(20);
await new Promise((resolve) => setTimeout(resolve, 200));
onProgress(50);
await new Promise((resolve) => setTimeout(resolve, 200));
onProgress(100);
console.log(data);
setReady(true);
};
const importerDefinition: ImporterDefinition = {
allowManualDataEntry: true,
maxFileSizeInBytes: 10 * 1024 * 1024, // 10MB
sheets: [
{
id: 'employees',
label: 'Employees',
columns: [
{
label: 'Employee ID',
id: 'employee.id',
type: 'number',
validators: [
{ validate: 'required' },
{
validate: 'unique',
error: 'This employee ID is not unique',
},
{
validate: 'is_integer',
error: 'This value must be a number',
},
],
},
{
label: 'Email',
id: 'email',
type: 'string',
validators: [
{ validate: 'required' },
{ validate: 'unique', error: 'This email is not unique' },
{
validate: 'email',
error: 'This email is not valid',
},
],
},
{
label: 'Phone Number',
id: 'phone_number',
type: 'string',
validators: [
{ validate: 'required' },
{ validate: 'phone_number' },
],
},
{
label: 'Address',
id: 'address',
type: 'string',
validators: [{ validate: 'required' }],
},
{ label: 'City', id: 'city', type: 'string' },
{
label: 'State',
id: 'state',
type: 'string',
transformers: [{ transformer: 'state_code' }],
},
{
label: 'Zip Code',
id: 'zip_code',
type: 'string',
validators: [{ validate: 'required' }, { validate: 'postal_code' }],
},
{
label: 'Full address',
id: 'full_address',
type: 'calculated',
typeArguments: {
getValue: (row) =>
`${row.address}, ${row.city}, ${row.state} ${row.zip_code}`,
},
},
],
},
],
onDataColumnsMapped: (dataColumns) => {
return dataColumns;
},
onComplete,
preventUploadOnValidationErrors: true,
persistenceConfig: {
enabled: true,
},
};
useEffect(() => {
const run = async () => {
const stateBuilder = new CsvImporterStateBuilder(importerDefinition);
const csvContent = `employee_id,email,phone_number,address,city,state,zip_code
1234567,john.smith@company.com,555-123-4567,123 Main Street,Seattle,WA,98101
2345678,emma.wilson@company.com,555-234-5678,456 Oak Avenue,Portland,OR,97201`;
const file = new File([csvContent], 'example-1.csv', {
type: 'text/csv',
});
await stateBuilder.uploadFile(file);
await stateBuilder.confirmMappings();
setInitialState(await stateBuilder.getState());
};
run();
}, []);
if (initialState == null) {
return
Loading...
;
}
return (
<>
{ready && (
Check the console for the output!
)}
>
);
}
```
# Importer Props
Source: https://hellocsv.mintlify.app/v0.6.0/api-reference/importer-props
This section details each property available for the Importer component.
## sheets
**Type:** `SheetDefinition[]`
**Required:** Yes
**Description:**
Array of sheet definitions for importing data. This property defines the structure of the data to be imported.
***
## onComplete
**Type:** `(data: ImporterState, onProgress: (progress: number) => void, submissionFiles: ImporterSubmissionFile[]) => Promise`
**Required:** Yes
**Description:**
A callback function invoked when the import process completes. It receives the final data and a progress callback.
An `ImportStatistics` object can be returned to provide detailed information about the import results. The statistics object has the following properties:
* `imported`: Number of rows successfully imported
* `failed`: Number of rows that failed to import
* `skipped`: Number of rows that were skipped
These statistics will be displayed in the import summary and can be used to show detailed import results to the user.
The `submissionFiles` parameter is an array of files that were submitted by the user. This can be used to provide the files to upload to the server.
The `submissionFiles` is defined as
```ts theme={null}
interface ImporterSubmissionFile {
file: Blob;
sheetId: string;
}
```
The `file` is the file that was processed by the importer. The `sheetId` is the id of the sheet that the file belongs to.
***
## initialState
**Type:** `ImporterState`
**Required:** No
**Description:**
Initial state for the importer. If provided, the importer will start with this state instead of the default one.
Please use the [CSV Importer State Builder](/v0.3.7/api-reference/csv-importer-state-builder) to build the initial state.
When using `initialState` the persisted state will be ignored.
***
## theme
**Type:** `'default' | 'theme-1' | 'theme-2' | 'dark'`
**Required:** No (Default: `default`)
**Description:**
Determines the visual theme of the importer component. Use `dark` for the built-in
dark theme — see [Dark Mode](/v0.6.0/customization/dark-mode). You can further
customize any theme's colors via [Theme Styles](/v0.6.0/customization/theme-styles).
***
## onDataColumnsMapped
**Type:** `(data: SheetState) => Promise | SheetState`
**Required:** No
**Description:**
Callback executed after CSV columns are mapped to the sheet definitions. Allows for custom post-mapping processing.
***
## allowManualDataEntry
**Type:** `boolean`
**Required:** No (Default: `false`)
**Description:**
Indicates whether manual data entry is allowed during the preview phase.
***
## locale
**Type:** `'en' | 'fr' | 'pt-BR'`
**Required:** No (Default: `en`)
**Description:**
Specifies the locale for internationalization purposes.
***
## preventUploadOnValidationErrors
**Type:** `boolean | (errors: ImporterValidationError[]) => boolean`
**Required:** No (Default: `false`)
**Description:**
Controls whether file upload should be prevented when validation errors occur. Can be a boolean or a function that returns a boolean.
***
## maxFileSizeInBytes
**Type:** `number`
**Required:** No (Default: `20971520` i.e., 20MB)
**Description:**
Sets the maximum allowed file size in bytes. Files exceeding this limit will be rejected.
***
## maxConcurrentAsyncOperations
**Type:** `number`
**Required:** No (Default: `8`)
**Description:**
Maximum number of async [validator](/v0.6.0/api-reference/validators) /
[transformer](/v0.6.0/api-reference/transformers) calls run at once during a
processing pass. Lower it to respect strict API rate limits (e.g. an LLM
endpoint); raise it to speed up fast local async work.
***
## customSuggestedMapper
**Type:** `(sheetDefinitions: SheetDefinition[], csvHeaders: string[]) => ColumnMapping[] | Promise`
**Required:** No
**Description:**
Provides a custom function to generate suggested mappings based on CSV headers.
***
## onSummaryFinished
**Type:** `() => void`
**Required:** No
**Description:**
Callback executed when the user has finished reviewing the import summary. This can be used to navigate users to a results page, dashboard, or next step in the workflow after the import process completes successfully.
***
## persistenceConfig
**Type:** `{ enabled: boolean; customKey?: string }`
**Required:** No
**Description:**
Configuration for IndexedDB storage. When enabled, the importer state will be persisted in the browser's IndexedDB storage, allowing users to resume their import process if the page is refreshed or closed. The `customKey` option allows specifying a unique identifier for the stored data.
Use cases for `customKey`:
* **Multiple Import Sessions**: When you need to handle multiple import processes simultaneously in the same application, you can use different `customKey` values to keep their states separate.
* **User-Specific Storage**: When implementing a multi-user system, you can use the user's ID as the `customKey` to maintain separate import states for each user.
* **Session Management**: You can use the `customKey` to implement session-specific storage, allowing you to clear specific import sessions without affecting others.
***
## translationResources
**Type:** `Record`
**Required:** No
**Description:**
A dictionary of translations for the importer component. The keys are the locale codes, and the values are the translations.
***
## customFileLoaders
**Type:** `{ mimeType: string; label: string; convert: (loadEvent: ProgressEvent, file: File) => { fileName: string; csvData: string; } | Promise<{ fileName: string; csvData: string; }>; }[]`
**Required:** No
**Description:**
A list of custom file loaders for the importer component.
Use cases for `customFileLoaders`:
* **Custom File Types**: When you need to import files with custom formats(like XLSX), you can create a custom file loader to handle the conversion process.
**Example:**
```typescript theme={null}
// Excel upload using xlsx library
import * as XLSX from 'xlsx';
const XLSX_FILE_MIME_TYPE =
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
{
const data = new Uint8Array(loadEvent.target?.result as ArrayBuffer);
const workbook = XLSX.read(data, { type: 'array' });
const firstSheet = workbook.Sheets[workbook.SheetNames[0]];
const csvData = XLSX.utils.sheet_to_csv(firstSheet);
return { fileName: file.name, csvData };
},
},
]}
/>
```
***
## csvDownloadMode
**Type:** `'value' | 'label'`
**Required:** No (Default: `value`)
**Description:**
Determines the mode for CSV download.
When set to `value`, the CSV will contain the raw values from the sheet. This includes enum fields values and column ids for CSV headers.
When set to `label`, the CSV will contain the labels of the values as well as column labels for CSV headers.
***
## availableActions
**Type:** `'addRows' | 'removeRows' | 'editRows' | 'downloadCsv' | 'search' | 'resetState' | 'backToPreviousStep' | 'undoRedo'[]`
**Required:** No (Default: `['addRows', 'removeRows', 'editRows', 'downloadCsv', 'search', 'resetState', 'backToPreviousStep', 'undoRedo'] - all the actions`)
**Description:**
Determines which actions are available to the user on the preview screen.
The `undoRedo` action enables the Back/Forward toolbar buttons **and** the
undo/redo keyboard shortcuts (see
[Keyboard & Clipboard](/v0.6.0/get-started/keyboard-and-clipboard#undo-redo)).
Omitting it hides the buttons and disables the shortcuts.
Use cases for `availableActions`:
* **No actions**: You can use it to hide all the actions and make the preview screen read only.
***
## onStateChanged
**Type:** `(previous: ImporterState, next: ImporterState) => void`
**Required:** No
**Description:**
Callback executed whenever the importer state updates. It receives both the previous and the new state, enabling parent components to respond to state changes.
# Importer State
Source: https://hellocsv.mintlify.app/v0.6.0/api-reference/importer-state
This section describes the state object of the importer.
## sheetDefinitions
**Type:** `SheetDefinition[]`
**Required:** Yes
**Description:**\
Defines the structure of the import.
***
## currentSheetId
**Type:** `string`
**Required:** Yes
**Description:**\
ID of the currently selected sheet.
***
## mode
**Type:** `'upload' | 'mapping' | 'preview' | 'submit' | 'completed' | 'failed'`
**Required:** Yes
**Description:**\
Current state of the importer.
***
## validationErrors
**Type:** `ImporterValidationError[]`
**Required:** Yes
**Description:**\
List of validation errors.
***
## processingInProgress
**Type:** `boolean`
**Required:** No
**Description:**
Indicates whether an asynchronous processing run (transformers followed by validators) is currently in progress. When `true`, the importer is transforming and validating data; components may use this to show global loading indicators.
***
## processingRunId
**Type:** `string`
**Required:** No
**Description:**
Identifier for the currently running processing batch (transform + validate). This is a short-lived string (UUID or timestamp-based id) that can be used to correlate `PROCESSING_STARTED` / `PROCESSING_COMPLETED` lifecycle events and to ignore stale results when multiple runs overlap.
***
## sheetData
**Type:** `SheetState[]`
**Required:** Yes
**Description:**\
Data for each sheet.
***
## parsedFile
**Type:** `ParsedFile`
**Required:** No
**Description:**\
Parsed CSV file data, if available.
***
## rowFile
**Type:** `File`
**Required:** No
**Description:**\
Original uploaded file.
***
## columnMappings
**Type:** `ColumnMapping[]`
**Required:** No
**Description:**\
Mappings between CSV columns and sheet columns.
***
## importProgress
**Type:** `number`
**Required:** Yes
**Description:**\
Import progress percentage (0-100).
***
## importStatistics
**Type:** `ImportStatistics`
**Required:** No
**Description:**\
Statistics about the import.
**Fields:**
* `imported`: number - Number of rows successfully imported
* `failed`: number - Number of rows that failed to import
* `skipped`: number - Number of rows that were skipped during import
***
# Importer Validation Error
Source: https://hellocsv.mintlify.app/v0.6.0/api-reference/importer-validation-error
This section describes the structure of a validation error.
## sheetId
**Type:** `string`
**Required:** Yes
**Description:**\
Identifier of the sheet where the error occurred.
***
## rowIndex
**Type:** `number`
**Required:** Yes
**Description:**\
0-based index indicating the row with the error.
***
## columnId
**Type:** `string`
**Required:** Yes
**Description:**\
Column identifier where the error occurred.
***
## message
**Type:** `string`
**Required:** Yes
**Description:**\
Error message describing the validation failure.
# Sheet Definition Props
Source: https://hellocsv.mintlify.app/v0.6.0/api-reference/sheet-definition-props
This section details the properties for defining a sheet.
## id
**Type:** `string`
**Required:** Yes
**Description:**\
Unique identifier for the sheet.
***
## label
**Type:** `string`
**Required:** Yes
**Description:**\
Display name for the sheet.
***
## columns
**Type:** `SheetColumnDefinition[]`
**Required:** Yes
**Description:**\
Array of column definitions for the sheet.
***
## maxRows
**Type:** `number`
**Required:** No (Default: no limit)
**Description:**\
Maximum number of rows that can be imported for this sheet. Empty rows are not
counted toward the limit. When the limit is exceeded the user can still upload,
map, and browse all of their data, but the **Upload** button is disabled (with an
explanatory tooltip) until enough rows are removed. The sheet tab shows a
`count / maxRows` counter and is flagged when over the limit.
To apply a single limit across a multi-sheet import, set the same `maxRows` on
each sheet.
# Sheet State
Source: https://hellocsv.mintlify.app/v0.6.0/api-reference/sheet-state
The state of a sheet.
## sheetId
**Type:** `string`
**Required:** Yes
**Description:**\
Id of the sheet.
***
## rows
**Type:** `SheetRow[]`
**Required:** Yes
**Description:**\
The rows of the sheet.
# Transformers
Source: https://hellocsv.mintlify.app/v0.6.0/api-reference/transformers
This section describes available transformation functions.
## Async transformers & run timing
Transformers may be **synchronous or asynchronous**. A `custom` `transformFn`
may return either `ImporterOutputFieldType | undefined` or a
`Promise` — making it possible to transform
a value by calling a remote service or an LLM.
By default, transformers run reactively on every edit (`runOn: 'change'`). For
slow or costly async work you usually don't want that to fire on each keystroke —
set `runOn: 'submit'` so the transformer runs only in the final pass when the
user submits:
```ts theme={null}
{
transformer: 'custom',
key: 'normalize_with_llm',
runOn: 'submit', // deferred — runs once on submit, not on every edit
transformFn: async (value) => normalizeWithLlm(value),
}
```
Async calls are throttled so a large sheet can't fire one request per cell at
once; tune the cap with
[`maxConcurrentAsyncOperations`](/v0.6.0/api-reference/importer-props).
## phone\_number
**Description:**\
Formats phone numbers to a standard format.
***
## postal\_code
**Description:**\
Formats postal codes to a standard format.
***
## state\_code
**Description:**\
Formats state codes to a standard format.
***
## strip
**Description:**\
Trims leading and trailing whitespace.
***
## custom
**Description:**\
Custom transformation function.
**Additional:**\
Requires a `key` and a `transformFn` to modify the value.
Return `undefined` in `transformFn` to skip the transformation.
# Validators
Source: https://hellocsv.mintlify.app/v0.6.0/api-reference/validators
This section describes the available validation rules.
## Async validators & run timing
Any validator may be **synchronous or asynchronous**. A `custom` `validateFn`
(see [custom](#custom)) may return `string | null | undefined` or a
`Promise`, so you can validate against a remote
service or an LLM.
By default, validators run reactively on every edit (`runOn: 'change'`). For slow
or costly async checks, set `runOn: 'submit'` so the validator runs only in the
final pass when the user submits — if it reports errors (and
`preventUploadOnValidationErrors` is set), submission is blocked and the errors
appear in the grid:
```ts theme={null}
{
validate: 'custom',
key: 'verify_with_llm',
runOn: 'submit', // deferred — runs once on submit, not on every edit
validateFn: async (value, row) => verifyWithLlm(value, row),
}
```
Async calls are throttled so a large sheet can't fire one request per cell at
once; tune the cap with
[`maxConcurrentAsyncOperations`](/v0.6.0/api-reference/importer-props). If an
async validator **rejects** (e.g. a failed network/LLM call), the cell is marked
invalid with the validator's `error` message (or a default) rather than silently
passing.
## required
**Description:**\
Ensures the field is not empty.
**Additional:**\
Accepts an optional `error` message.
Additionally, accepts a `when` function that returns a boolean value. If the function returns false, the validation is skipped. Defaults to `() => true`.
Example:
```ts theme={null}
{
"validate": "required",
"when": (row) => row['employee.type'] === 'other'
}
```
***
## unique
**Description:**\
Ensures the value is unique across rows.
**Additional:**\
Accepts an optional `error` message. Set `caseInsensitive` to `true` to compare
string values case-insensitively.
***
## regex\_matches
**Description:**\
Validates a field against a regular expression.
**Additional:**\
Expects a `regex` and an optional `error` message.
***
## includes
**Description:**\
Checks if a value is within a predefined list.
**Additional:**\
Requires a list of valid values.
***
## multi\_includes
**Description:**\
Checks if all delimited values are valid.
**Additional:**\
Accepts `values`, a `delimiter`, and an optional `error` message.
***
## boolean
**Description:**\
Ensures the value is a real boolean (`true` / `false`). Empty values pass; a value
that couldn't be coerced to a boolean (i.e. it matched neither the column's true
nor false tokens) fails.
**Additional:**\
Added **automatically** to every [boolean](/v0.6.0/api-reference/column-types#boolean)
column, so you normally don't configure it. You can also add it explicitly to
provide a custom `error` message.
***
## date
**Description:**\
Ensures the value is a valid date / datetime / time and, optionally, within a
configured range. Empty values pass; a value that couldn't be parsed against the
column's format (or the ISO fallback) fails.
**Additional:**\
Added **automatically** to every [date](/v0.6.0/api-reference/column-types#date),
[datetime](/v0.6.0/api-reference/column-types#datetime), and
[time](/v0.6.0/api-reference/column-types#time) column, using that column's
`outputFormat`, `displayFormat`, `min`, and `max`, so you normally don't
configure it. Out-of-range values report a distinct error. You can also add it
explicitly to provide a custom `error` message.
***
## is\_integer
**Description:**\
Validates that the value is an integer.
**Additional:**\
Optional `error` message.
***
## phone\_number
**Description:**\
Validates phone number formatting.
**Additional:**\
Optional `error` message.
***
## email
**Description:**\
Validates email format.
Pragmatic email validation based on: [https://www.regular-expressions.info/email.html](https://www.regular-expressions.info/email.html)
* Case-insensitive
* Prevents consecutive dots in domain
* Intentionally not RFC 5322 complete
For more restrictive needs please use [regex\_matches](#regex-matches) validator.
**Additional:**\
Optional `error` message.
***
## postal\_code
**Description:**\
Validates postal code format.
**Additional:**\
Optional `error` message.
***
## custom
**Description:**\
Custom validation function.
**Additional:**\
Requires a `key` and a `validateFn` that returns an error message if validation fails. The `validateFn` may be synchronous or asynchronous — it may return a `string | null | undefined` or a `Promise`.
Example (async):
```ts theme={null}
{
validate: 'custom',
key: 'email_remote_check',
validateFn: async (value) => {
if (value && typeof value === 'string') {
// simulate async check (e.g. remote service)
const isEmailValid = await fetch('/api/validate-email', { method: 'POST', body: value });
if(!isEmailValid) {
return 'This email is too short';
}
}
return undefined;
},
}
```
# Bundle Versions
Source: https://hellocsv.mintlify.app/v0.6.0/configuration/bundle-versions
This section explains the difference between the two versions of the package.
## /preact
**Description:**\
Intended for Preact projects.
***
## /react
**Description:**\
Intended for React projects.
***
## /bundled
**Description:**\
Bundles Preact so that it can be used without React/Preact pre-installed.
**Usage:**\
Use the `renderImporter` function from the bundled version.
# Dark Mode
Source: https://hellocsv.mintlify.app/v0.6.0/customization/dark-mode
HelloCSV ships with a built-in **dark** theme. Because the importer is embedded
inside your application, dark mode is **opt-in** — HelloCSV never forces a dark
appearance based on the operating system, so it always matches whatever your host
page decides.
## Enabling dark mode
Pass `dark` to the [`theme`](/v0.6.0/api-reference/importer-props#theme) prop:
```tsx theme={null}
```
## Following your app's light / dark state
The recommended pattern is to drive the `theme` prop from whatever signal your app
already uses for light/dark mode, so the importer flips together with the rest of
the page:
```tsx theme={null}
function MyImporter({ isDarkMode }: { isDarkMode: boolean }) {
return (
);
}
```
Want the OS preference to drive it? Read `prefers-color-scheme` in your own app
and feed the result into the `theme` prop:
```ts theme={null}
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
```
## How it works
The dark theme simply reassigns the same CSS variables documented in
[Theme Styles](/v0.6.0/customization/theme-styles) — both the accent colors and
the neutral surface/text/border tokens — so every part of the importer (including
portalled dropdowns, tooltips, and modals) adapts automatically.
## Customizing the dark palette
To fine-tune the dark colors, override the tokens under the `dark` theme selector
in your own CSS:
```css theme={null}
[hello-csv-data-theme='dark'] {
--hello-csv-color-surface: #0b1120;
--hello-csv-color-surface-raised: #111827;
--hello-csv-color-text: #e2e8f0;
--hello-csv-color-border: #334155;
--hello-csv-color-primary: #818cf8;
/* ...any other tokens you want to adjust */
}
```
See [Theme Styles](/v0.6.0/customization/theme-styles) for the full list of
available tokens.
# Theme Styles
Source: https://hellocsv.mintlify.app/v0.6.0/customization/theme-styles
The importer is styled entirely through CSS custom properties, so you can adapt it
to your brand by overriding these variables in your own `index.css`.
## Accent colors
```css theme={null}
:root {
--hello-csv-color-primary: #007bff;
--hello-csv-color-primary-light: #66b3ff;
--hello-csv-color-primary-extra-light: #cce7ff;
--hello-csv-color-secondary: #6c757d;
--hello-csv-color-tertiary: #17a2b8;
--hello-csv-color-tertiary-light: #5bc0de;
--hello-csv-color-success: #15803d;
--hello-csv-color-success-light: #4ade80;
--hello-csv-color-success-extra-light: #f0fdf4;
--hello-csv-color-danger: #dc3545;
--hello-csv-color-danger-light: #f5c6cb;
--hello-csv-color-danger-extra-light: #fef2f2;
--hello-csv-color-warning: #a16207;
--hello-csv-color-warning-light: #facc15;
--hello-csv-color-warning-extra-light: #fefce8;
--hello-csv-color-info: #17a2b8;
--hello-csv-color-muted: #f9fafb;
--hello-csv-color-muted-light: #f3f4f6;
/* content (text/icons) that sits on top of an accent fill */
--hello-csv-color-primary-contrast: #ffffff;
--hello-csv-color-success-contrast: #ffffff;
--hello-csv-color-danger-contrast: #ffffff;
}
```
Most accent colors come in up to three shades that share a role:
* **base** (e.g. `--hello-csv-color-primary`) — the main color, used for text, icons,
fills, and borders.
* **`-light`** — a hover / emphasis variant of the base.
* **`-extra-light`** — a soft tint used as a background behind the base color.
| Token | Role |
| - | - |
| `primary` | Main brand color — primary buttons, active tabs/pills, links, checkboxes, focus rings |
| `primary-light` | Primary hover state |
| `primary-extra-light` | Subtle primary-tinted backgrounds |
| `secondary` | Secondary accent — secondary button focus outline |
| `tertiary` | Tertiary (neutral) button ring/border |
| `tertiary-light` | Tertiary button hover background |
| `success` | Success text and icons, success button |
| `success-light` | Lighter success accent (icons, progress indicator) |
| `success-extra-light` | Success-tinted background (e.g. success alert) |
| `danger` | Error text and icons, danger button, error borders |
| `danger-light` | Danger hover / lighter danger accent |
| `danger-extra-light` | Danger-tinted background (e.g. error alert, delete modal icon) |
| `warning` | Warning text and icons |
| `warning-light` | Lighter warning accent (icons) |
| `warning-extra-light` | Warning-tinted background (e.g. warning alert) |
| `info` | Informational icons and accents (info alert) |
| `muted` | Muted surface — cards, table headers, the upload drop zone |
| `muted-light` | Lighter muted surface (e.g. drop zone hover) |
| `primary-contrast` | Text/icons rendered **on top of** a `primary` fill (e.g. primary button label, spinner, checkbox tick). Override this if you set `primary` to a light color. |
| `success-contrast` | Text/icons on top of a `success` fill (e.g. success button label) |
| `danger-contrast` | Text/icons on top of a `danger` fill (e.g. danger button label) |
## Neutral / structural colors
New in v0.5.0. These role-based neutral tokens back every surface, text, and
border in the importer, and are what make [dark
mode](/v0.6.0/customization/dark-mode) possible. Override them to fine-tune
backgrounds, text, and borders.
```css theme={null}
:root {
/* surfaces */
--hello-csv-color-surface: #ffffff; /* default page/control background */
--hello-csv-color-surface-raised: #ffffff; /* elevated surfaces (modals, dropdowns) */
--hello-csv-color-surface-sunken: #f9fafb; /* hover / disabled fills */
/* text */
--hello-csv-color-text: #111827; /* primary text */
--hello-csv-color-text-muted: #6b7280; /* secondary text, icons */
--hello-csv-color-text-subtle: #9ca3af; /* placeholders, faint icons */
/* borders */
--hello-csv-color-border: #e5e7eb;
--hello-csv-color-border-strong: #d1d5db;
/* misc */
--hello-csv-color-overlay: #6b7280; /* modal backdrop (used at 75% opacity) */
--hello-csv-color-tooltip-surface: #111827; /* tooltip background */
--hello-csv-color-tooltip-text: #ffffff; /* tooltip text */
}
```
| Token | Role |
| - | - |
| `surface` | Default background for the importer and its controls (inputs, selects) |
| `surface-raised` | Elevated surfaces that float above the page — modals, dropdown menus |
| `surface-sunken` | Recessed fills — hover backgrounds, disabled controls |
| `text` | Primary text color |
| `text-muted` | Secondary text and most icons |
| `text-subtle` | De-emphasized text — input placeholders, faint icons |
| `border` | Default borders and dividers |
| `border-strong` | Higher-contrast borders — input outlines, table cell borders |
| `overlay` | Modal backdrop (applied at 75% opacity) |
| `tooltip-surface` | Tooltip background (intentionally inverted relative to the page) |
| `tooltip-text` | Tooltip text |
## Built-in theme variants
The importer ships with a few ready-made variants. Select one with the
[`theme`](/v0.6.0/api-reference/importer-props#theme) prop:
| `theme` value | Description |
| - | - |
| `default` | Light theme (used when omitted) |
| `theme-1` | Alternate light palette |
| `theme-2` | Alternate light palette |
| `dark` | Dark theme — see [Dark Mode](/v0.6.0/customization/dark-mode) |
```tsx theme={null}
```
# Deployment
Source: https://hellocsv.mintlify.app/v0.6.0/development/deployment
Deployment is done with the following steps
1. Change version in `package.json` (to the target version) - use branch `release/v{x.y.z}`
2. Run `npm i` in the root directory as well as in `example-preact`, `example-vanilla`, `example-react` and `example-next-js` directories
3. Update version in docs
For minor version release
* update version in `docs/docs.json` file
* update directory name of `docs/v{oldVersion}` to `docs/v{newVersion}`
* make sure to update all references to the old version in the `docs/docs.json` file
For major version release
* create a new directory in `docs` called `v{newVersion}`
* copy all files from `docs/v{oldVersion}` to `docs/v{newVersion}`
* create a new version entry in `docs/docs.json` file
* write upgrade guide and put it in the docs
4. Update version in `InstallTabs.tsx::no build`, `example-preact/index.html`, `README.md`, `example-preact/src/App.tsx` and `custom-file-loaders.mdx`
5. Verify if `importer/storage.ts:DB_VERSION` needs to be bumped. It should be bumped anytime the release contains any breaking changes to `ImporterState`. If it is true, increment the `DB_VERSION`.
6. Create a PR in the repository called `Release v{x.y.z}`
7. Run `npm publish` in the root directory, you can use `--dry-run` flag to test the deployment
8. Create a new release in Github - [https://github.com/HelloCSV/HelloCSV/releases](https://github.com/HelloCSV/HelloCSV/releases). Remember about creating a tag (`v{x.y.z}`) and writing release notes.
9. Merge `main` to `production` branch - this would trigger docs deployment to Mintlify
# Setup
Source: https://hellocsv.mintlify.app/v0.6.0/development/setup
Make sure to use proper node version specified in `.nvmrc` file
```bash theme={null}
nvm use
```
This watches for changes in main plugin and rebuilds if needed
```bash theme={null}
npm i && npm run watch
```
This runs example application
```bash theme={null}
cd example-preact && npm i && npm run dev
```
# Keyboard & Clipboard
Source: https://hellocsv.mintlify.app/v0.6.0/get-started/keyboard-and-clipboard
The data editor grid supports spreadsheet-style keyboard navigation, range
selection, editing, and clipboard/fill — similar to Google Sheets or Excel.
Click a cell (or press a navigation key) to make it active, then use the
shortcuts below. On macOS use Cmd wherever Ctrl is listed.
## Navigation
| Shortcut | Action |
| - | - |
| ↑↓←→ | Move the active cell |
| Tab / Shift+Tab | Move right / left |
| Enter / Shift+Enter | Move down / up |
| Ctrl+↑/↓/←/→ | Jump to the edge of the current data block |
| Home / End | First / last cell in the row |
| Ctrl+Home / Ctrl+End | First / last cell in the grid |
| PageUp / PageDown | Move up / down one viewport |
## Selection
| Shortcut | Action |
| - | - |
| Shift+arrow | Extend the selection |
| Ctrl+A | Select the whole grid |
| Click | Select a cell |
| Shift+click | Extend the selection to the clicked cell |
| Click + drag | Select a range |
## Editing
| Shortcut | Action |
| - | - |
| F2 or double-click | Edit the active cell |
| Start typing | Edit the cell, seeded with the typed character |
| Enter / Tab | Commit and move to the next cell |
| Escape | Cancel the edit |
| Delete / Backspace | Clear the selected cells |
Read-only cells (for example [calculated](/v0.6.0/api-reference/column-types#calculated)
columns) can't be edited or cleared.
## Clipboard & fill
| Shortcut | Action |
| - | - |
| Ctrl+C | Copy the selection |
| Ctrl+X | Cut the selection |
| Ctrl+V | Paste at the active cell (or fill the selection with a single copied cell) |
| Ctrl+D | Fill the top row of the selection down |
Copy/paste uses tab-separated values, so you can move data between HelloCSV and
spreadsheet apps like Excel or Google Sheets. Multi-select
[enum](/v0.6.0/api-reference/column-types#enum) cells are serialized using the
column's `delimiter`, so copying and pasting them round-trips correctly.
## Undo & Redo
| Shortcut | Action |
| - | - |
| Ctrl+Z | Undo the last change |
| Ctrl+Shift+Z | Redo |
| Ctrl+Y | Redo |
Each user operation is one step, so a mass action — pasting a block of cells,
filling down, clearing a range, or removing rows — is undone (or redone) in a
single press. Back and Forward buttons in the toolbar do the same thing. While
you're editing a cell, Ctrl+Z falls back to the browser's
native text undo inside that cell.
History is kept in memory only and is cleared on reload. Both the shortcuts and
the toolbar buttons are controlled by the `undoRedo`
[available action](/v0.6.0/api-reference/importer-props#availableactions).
# Usage
Source: https://hellocsv.mintlify.app/v0.6.0/get-started/usage
## Installation
```bash theme={null}
npm install hello-csv
```
## React
```jsx theme={null}
import Importer from 'hello-csv/react';
import 'hello-csv/react/index.css';
()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
error: 'This email is not valid',
},
],
},
{
label: 'Phone Number',
id: 'phone_number',
type: 'string',
validators: [{ validate: 'required' }],
},
{ label: 'City', id: 'city', type: 'string' },
{
label: 'State',
id: 'state',
type: 'string',
isReadOnly: true,
transformers: [{ transformer: 'state_code' }],
},
],
},
{
id: 'companies',
label: 'Companies',
columns: [
{
label: 'Company',
id: 'company',
type: 'string',
validators: [{ validate: 'required' }],
},
{
label: 'Industry',
id: 'industry',
type: 'enum',
typeArguments: {
values: [
{ label: 'Tech', value: 'tech' },
{ label: 'Finance', value: 'finance' },
],
},
validators: [{ validate: 'required' }],
},
{
label: 'Name',
id: 'name',
type: 'reference',
typeArguments: {
sheetId: 'employees',
sheetColumnId: 'name',
},
validators: [{ validate: 'required' }],
},
],
},
]}
onComplete={(data) => {
console.log(data);
}}
persistenceConfig={{ enabled: true }}
/>;
```
## Preact
```jsx theme={null}
import Importer from 'hello-csv/preact';
import 'hello-csv/preact/index.css';
()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
error: 'This email is not valid',
},
],
},
{
label: 'Phone Number',
id: 'phone_number',
type: 'string',
validators: [{ validate: 'required' }],
},
{ label: 'City', id: 'city', type: 'string' },
{
label: 'State',
id: 'state',
type: 'string',
isReadOnly: true,
transformers: [{ transformer: 'state_code' }],
},
],
},
{
id: 'companies',
label: 'Companies',
columns: [
{
label: 'Company',
id: 'company',
type: 'string',
validators: [{ validate: 'required' }],
},
{
label: 'Industry',
id: 'industry',
type: 'enum',
typeArguments: {
values: [
{ label: 'Tech', value: 'tech' },
{ label: 'Finance', value: 'finance' },
],
},
validators: [{ validate: 'required' }],
},
{
label: 'Name',
id: 'name',
type: 'reference',
typeArguments: {
sheetId: 'employees',
sheetColumnId: 'name',
},
validators: [{ validate: 'required' }],
},
],
},
]}
onComplete={(data) => {
console.log(data);
}}
persistenceConfig={{ enabled: true }}
/>;
```
## Bundled
```jsx theme={null}
import { renderImporter } from 'hello-csv/bundled';
renderImporter(document.querySelector('#app'), {
sheets: [
{
id: 'employees',
label: 'Employees',
columns: [
{
label: 'Name',
id: 'name',
type: 'string',
validators: [{ validate: 'required' }],
},
{
label: 'Email',
id: 'email',
type: 'string',
validators: [{ validate: 'required' }],
},
],
},
],
});
```
# Upgrade from v0.5.0
Source: https://hellocsv.mintlify.app/v0.6.0/upgrade/from-v-0-5-0
Most projects need **no changes** to upgrade from v0.5.0 to v0.6.0. There are two
breaking changes, and both only affect you if your code reaches into HelloCSV internals —
its utility class names, or two transient `ImporterState` fields. There are also new,
fully opt-in features (see [What's new](#whats-new)).
## 1. Namespaced CSS utility classes
### What changed
HelloCSV is built with Tailwind CSS. Previously its utility classes (`text-center`,
`bg-hello-csv-muted`, etc.) used the same names Tailwind generates everywhere, so they
could clash with another CSS framework loaded on the same page — for example Bootstrap,
whose global `.text-center` overrode HelloCSV's styles and broke the layout
([#262](https://github.com/HelloCSV/HelloCSV/issues/262)).
As of **v0.6.0**, every internal utility class is namespaced with an **`hc:` prefix**:
| Before (v0.5.0) | After (v0.6.0) |
| - | - |
| `bg-hello-csv-muted` | `hc:bg-hello-csv-muted` |
| `bg-hello-csv-danger-extra-light` | `hc:bg-hello-csv-danger-extra-light` |
| `text-center`, `flex`, `p-4`, … | `hc:text-center`, `hc:flex`, `hc:p-4`, … |
This makes HelloCSV's styles collision-proof against any host CSS framework, without
resorting to `!important` (which would have made the styles hard for you to override).
### Do I need to do anything?
**No changes needed if you:**
* Style the importer with the [`theme`](/v0.6.0/api-reference/importer-props#theme) prop.
* Customize colors via the `--hello-csv-color-*` CSS variables
(see [Theme Styles](/v0.6.0/customization/theme-styles)) — variable names are unchanged.
* Only render the importer and let it style itself.
* Use your own Tailwind/CSS classes in your surrounding layout — your classes are untouched.
**Action required only if you:**
* Reference HelloCSV's internal utility classes in a
[`customRender`](/v0.6.0/api-reference/common-column-props#customrender) callback (or any
custom cell/component) — for example checking or reusing the cell background classes.
Add the `hc:` prefix:
```diff theme={null}
-
+
```
The classes a cell may carry are now
`hc:bg-hello-csv-danger-extra-light` (validation errors) and
`hc:bg-hello-csv-muted` (read-only columns).
### Notes
* The `hello-csv` root/scoping class is **not** prefixed — only Tailwind utility classes are.
* CSS custom properties (`--hello-csv-color-*`) are **not** prefixed and keep their names.
* You do **not** need to configure a Tailwind prefix in your own project; HelloCSV ships
pre-compiled CSS, so the prefix is entirely internal.
## 2. Renamed `ImporterState` processing fields
The async pass that runs after an edit now runs **transformers and then validators** (in
v0.5.0 transformation happened synchronously and only validation was async). To reflect
that it's a combined "processing" pass, two transient [`ImporterState`](/v0.6.0/api-reference/importer-state)
fields were renamed:
| Before (v0.5.0) | After (v0.6.0) |
| - | - |
| `validationInProgress` | `processingInProgress` |
| `validationRunId` | `processingRunId` |
`validationErrors` is **unchanged**. The internal reducer action types
`VALIDATION_STARTED` / `VALIDATION_COMPLETED` were likewise renamed to
`PROCESSING_STARTED` / `PROCESSING_COMPLETED` — only relevant if you dispatch importer
actions directly, which is uncommon.
### Do I need to do anything?
**No changes needed if you:**
* Only read `validationErrors` (unchanged) or don't inspect these fields at all.
* Rely on [persistence](/v0.6.0/api-reference/importer-props#persistenceconfig) (IndexedDB).
**No migration is required** — these fields are transient and optional. A persisted
v0.5.0 state keeps its old keys harmlessly (nothing reads them), and the new fields
default to `undefined` (falsy = "not running"), which is the correct resting state.
**Action required only if you:**
* Read `state.validationInProgress` or `state.validationRunId` in
[`onStateChanged`](/v0.6.0/api-reference/importer-props#onstatechanged),
[`onComplete`](/v0.6.0/api-reference/importer-props#oncomplete), or a custom component
(e.g. via `useImporterState`). Rename the references:
```diff theme={null}
- if (state.validationInProgress) showSpinner();
+ if (state.processingInProgress) showSpinner();
```
## What's new
These are fully **opt-in** and require no changes to existing code:
* **Async transformers.** A `custom` `transformFn` may now return a `Promise`
(see [Transformers](/v0.6.0/api-reference/transformers)).
* **`runOn: 'change' | 'submit'`** on any validator or transformer — defer slow/costly
async work (e.g. an LLM call) to the submit pass instead of running it on every edit.
* **[`maxConcurrentAsyncOperations`](/v0.6.0/api-reference/importer-props#maxconcurrentasyncoperations)**
to cap how many async validator/transformer calls run at once.
# Height and Width
Source: https://hellocsv.mintlify.app/common/customization/height-and-width
You can customize the dimensions by setting `height`, `max-height`, `width`, or `max-width`. To ensure proper scaling and responsiveness, it's important to include `flex`.
```jsx theme={null}
```
# Docs
Source: https://hellocsv.mintlify.app/common/development/docs
To run mintlify locally
```bash theme={null}
cd docs
```
```bash theme={null}
PUPPETEER_SKIP_DOWNLOAD=true npm i -g mintlify
```
```bash theme={null}
mintlify dev
```
# No Build Example
Source: https://hellocsv.mintlify.app/common/development/no-build-example
To run a no build example you could run
```bash theme={null}
npx http-server .
```
This will run the example application at `http://localhost:8080`
# Demo
Source: https://hellocsv.mintlify.app/common/get-started/demo
See hello-csv in action
# Demo
Visit [the demo page](https://HelloCSV.github.io/HelloCSV/) to see hello-csv in action!
# Introduction
Source: https://hellocsv.mintlify.app/common/get-started/introduction
Welcome to HelloCSV
# Multiple Sheets
Source: https://hellocsv.mintlify.app/common/get-started/multiple-sheets
## Multiple Sheets
Often you'll want to import data that actually implicitly has multiple data schemas within it. For example, consider importing a CSV of employees working across multiple companies.
In the above example, the company fields are actually duplicated for both Emily and Chris.
In this case, you'd most likely have a database table called `employees` and another one called `companies`, so this import should create **3 users** but only **2 companies**.
HelloCSV allows you to split the `employee` data and `company` data into separate sheets on the frontend, before the upload, to give the user a chance to review the upload and make edits.
Here is an example HelloCSV definition for the data above:
```tsx theme={null}
{
// Filter companies down to only unique names
const sheet = sheets.find((sheet: any) => sheet.sheetId === 'companies')!;
const seen = new Set();
sheet.rows = [...sheet.rows].filter((row: SheetRow) => {
// Remove duplicate companies
const hasSeen = !seen.has(row.name);
seen.add(row.name);
return hasSeen;
});
return sheets;
}}
onComplete={async (data) => {
const employees = data.sheetData.find((s: any) => s.id === 'employees');
const companies = data.sheetData.find((s: any) => s.id === 'companies');
console.log(employees);
// [{id: 1, name: "Mat", company: "Dunder Mifflin"}, {id: 2, name: "Emily", company: "Los Pollos Hermanos"}, {id: 3, name: "Chris", company: "Los Pollos Hermanos"}]
console.log(companies);
// [{name: "Dunder Mifflin", industry: "Paper"}, {name: "Los Pollos Hermanos", industry: "Food & Beverage"}]
}}
/>
```
### Screenshots
**Preview**
**Mapping**
**Employees Sheet**
**Companies Sheet**
# Persistence
Source: https://hellocsv.mintlify.app/common/get-started/persistence
## Persistence
HelloCSV supports using [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) for persisting state. This ensures that users don't lose any edits they make if the page refreshes, and allows them to come back to a partially imported state later.
The data is saved in the browsers IndexedDB store, so this data never leaves the user's browser. Therefore, if a different browser is used, the saved session will not be maintained.
HelloCSV will invalidate any state that is saved if the definition of the importer changes. For example, if the definition of an importer is changed such that a new column is added, the state previously saved will not be maintained.
### Persistence Configuration
```tsx theme={null}
export interface PersistenceConfig {
enabled: boolean;
customKey?: string;
}
```
### Usage
```tsx theme={null}
```
The persistence configuration also supports a custom key, so that you as the developer can invalidate any saved importing sessions. Intuitively, the key that the data is saved under can be thought of as: `key = importer_definition + custom_key`.
Be careful that you don't accidentally leak information across multiple users who may be sharing the same browser with this feature.
# Why?
Source: https://hellocsv.mintlify.app/common/get-started/why
The motivation behind hello-csv
# Why?
Every project I’ve worked on needed some hacked together CSV importer. **hello-csv** fixes this by implementing a modern CSV import flow for React projects!