> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Array or object: Split into chunks

> Splits an array or object into chunks of the specified size.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Breaks a single list into several smaller lists of a fixed size. The items are taken in order and grouped together until each group reaches the size you choose; the final group holds whatever is left over and may be smaller. Use this to process data in manageable batches, for example sending products to an external system 50 at a time instead of all at once.

This documentation describes: [Schema](/schemas/mapper/list-split)

## Fields

<FormField property="length" label="Length" required>
  How many items go into each chunk. Must be at least 1. For example, a length of 2 turns a list of five items into three chunks: two pairs and a final single item.
</FormField>

<FormField property="preserveKeys" label="Preserve keys">
  An on/off toggle that decides what happens to the original keys. When turned off (the default), each chunk is renumbered from zero. When turned on, the items keep their original keys or positions inside the chunks. Leave it off for plain lists; turn it on when the original positions or key names matter.
</FormField>

## Sample data

| Field         | Value |
| ------------- | ----- |
| Length        | `2`   |
| Preserve keys | off   |

Input:

```json theme={null}
{ "skus": ["A1", "B2", "C3", "D4", "E5"] }
```

Output:

```json theme={null}
{ "skus": [["A1", "B2"], ["C3", "D4"], ["E5"]] }
```

The five items are grouped into pairs, with the leftover item forming a final single-item chunk. With Preserve keys turned on, the items keep their original positions instead, so the later chunks would look like `{ "2": "C3", "3": "D4" }` and `{ "4": "E5" }`.

```json Configuration theme={null}
{
  "prototype": "list-split",
  "parameters": {
    "length": 2,
    "preserveKeys": false
  }
}
```
