> ## 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.

# Map when a condition applies

> Applies mappers when the conditions apply.

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

Applies mappers when the conditions apply. Use this to transform a value only in certain cases: you set one or more conditions and one or more transformations, and the transformations run only when every condition is met. When any condition is not met, the value is passed through unchanged. This is useful for rules such as "only relabel the tier when it equals VIP" or "only round the price when it is not empty".

This documentation describes: [Schema](/schemas/mapper/conditional)

## Fields

<FormField property="conditions" label="Conditions" diType="condition">
  The checks that decide whether the transformations run. All of the conditions you add must be met; if any one fails, the value is left as it is. Each entry is a condition you pick and configure.
</FormField>

<FormField property="mappers" label="Mappers" diType="mapper">
  The transformations to run when the conditions are met, applied in the order you add them. Each entry is another mapper you pick and configure.
</FormField>

## Sample data

| Field      | Value                                            |
| ---------- | ------------------------------------------------ |
| Conditions | value equals `VIP`                               |
| Mappers    | Map value using comparator (`VIP` to `Priority`) |

When the condition is met, the value is transformed:

Input:

```json theme={null}
{ "tier": "VIP" }
```

Output:

```json theme={null}
{ "tier": "Priority" }
```

When the condition is not met, the value is unchanged (for example `"Standard"` stays `"Standard"`).

```json Configuration theme={null}
{
  "prototype": "conditional",
  "parameters": {
    "conditions": [
      { "prototype": "equals", "parameters": { "value": "VIP" } }
    ],
    "mappers": [
      { "prototype": "standard", "parameters": { "from": "VIP", "to": "Priority" } }
    ]
  }
}
```
