> ## 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: Keep matching values

> Returns only the values that exist in both the input and the supplied data.

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>;
};

Keeps only the items from the incoming array or object whose values also appear in a second set of values you supply, and drops everything else. Use this to filter a list down to an approved set, for example keeping only the tags, categories, or status codes that you actually allow through.

The comparison looks at the values themselves, not at where they sit, and the surviving items keep their original keys.

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

## Fields

<FormField property="array" label="Array" required>
  The set of allowed values to match against, entered as JSON. Only input items whose value is found somewhere in this set are kept; anything not present here is removed.
</FormField>

## Sample data

| Field | Value                                               |
| ----- | --------------------------------------------------- |
| Array | `{ "a": "sale", "b": "featured", "c": "seasonal" }` |

Input:

```json theme={null}
{ "tags": ["sale", "new", "clearance", "featured"] }
```

Output:

```json theme={null}
{ "tags": { "0": "sale", "3": "featured" } }
```

Only `sale` and `featured` appear in the allowed set, so the rest are dropped. The two survivors keep their original positions (0 and 3) from the input list.

```json Configuration theme={null}
{
  "prototype": "list-intersect",
  "parameters": {
    "array": {
      "a": "sale",
      "b": "featured",
      "c": "seasonal"
    }
  }
}
```
