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

# If component

export const ComponentMetadata = ({warehouses, unsupportedWarehouses = [], componentType, connectionInputs, connectionOutputs}) => {
  const allWarehouses = [...warehouses.map(w => ({
    name: w,
    supported: true
  })), ...unsupportedWarehouses.map(w => ({
    name: w,
    supported: false
  }))];
  return <div style={{
    background: 'var(--colors-background-light, #f9fafb)',
    border: '1px solid var(--colors-border-default, #e5e7eb)',
    borderRadius: '12px',
    padding: '20px 28px',
    marginBottom: '28px',
    boxShadow: '0 1px 4px rgba(0,0,0,0.10)'
  }}>
      <table style={{
    width: '100%',
    borderCollapse: 'collapse'
  }}>
        <tbody>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle',
    width: '180px'
  }}>Project Availability</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>
              <div style={{
    display: 'flex',
    flexWrap: 'wrap',
    gap: '8px'
  }}>
                {allWarehouses.map((w, i) => <span key={i} style={{
    background: w.supported ? '#dcfce7' : '#fee2e2',
    color: w.supported ? '#15803d' : '#b91c1c',
    border: `1px solid ${w.supported ? '#bbf7d0' : '#fca5a5'}`,
    borderRadius: '9999px',
    padding: '3px 12px',
    fontSize: '0.85rem',
    fontWeight: '500',
    whiteSpace: 'nowrap'
  }}>
                    {w.name} {w.supported ? '✅' : '❌'}
                  </span>)}
              </div>
            </td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Component Type</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{componentType}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Connection Inputs</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{connectionInputs}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Connection Outputs</td>
            <td style={{
    verticalAlign: 'middle'
  }}>{connectionOutputs}</td>
          </tr>
        </tbody>
      </table>
    </div>;
};

<ComponentMetadata warehouses={["Snowflake", "Databricks", "Amazon Redshift", "Google BigQuery"]} componentType="Orchestration, Test" connectionInputs="One" connectionOutputs="Unlimited" />

The If component can evaluate an expression involving variables and direct the flow of an orchestration pipeline depending upon whether the expression evaluates to "true" or "false".

The If component has three [output connectors](/docs/guides/components-overview#connect-components). The blue (top) connector is followed when the expression evaluates to "true". The orange (center) connector is followed when the expression evaluates to "false". The red (bottom) connector is followed if a runtime error occurs during evaluation.

Variables involved in the expression must be declared in advance as pipeline variables or project variables. Read [Project and pipeline variables](/docs/guides/variables) for more information.

***

## Properties

<ResponseField name="Name" type="string" required>
  A human-readable name for the component.
</ResponseField>

{/* <!-- param-start:[mode] | warehouses: [snowflake, databricks, redshift, bigquery] --> */}

<ResponseField name="Mode" type="drop-down" required>
  Select:

  * **Simple:** uses the **Condition** and **Combine Conditions** properties to define an expression.
  * **Advanced:** provides a code editor to write your own JavaScript expression.
</ResponseField>

{/* <!-- param-start:[condition] | warehouses: [snowflake, databricks, redshift, bigquery] --> */}

<ResponseField name="Condition (Advanced mode)" type="code editor" required>
  A JavaScript expression, which will be evaluated to determine whether it is true or false. If the expression is not itself a true or false value, then any non-empty string is considered true, as is any non-zero number.

  Only used if **Mode** is set to `Advanced`.

  To use variables in this field, type the name of the variable prefixed by the dollar symbol and surrounded by \{ } brackets, as follows: `${variable}`. Once you type `${`, a drop-down list of autocompleted suggested variables will appear. This list updates as you type; for example, if you type `${date`, functions and variables containing `date` will be listed.

  #### Example

  If you have a grid variable `new_orders` with columns `order_id`, `customer_id`, and `order_value`, and you want to perform actions based on the number of orders, you can use:

  ```
  new_orders.order_id.length
  ```

  You can then use this in an If component to determine the flow, such as checking if there are any new orders and directing the flow accordingly.
</ResponseField>

{/* <!-- param-start:[condition1] | warehouses: [snowflake, databricks, redshift, bigquery] --> */}

<ResponseField name="Condition (Simple mode)" type="column editor" required>
  Click **+** to add a condition. Any number of conditions can be added; the **Combine Conditions** property will define how they work together.

  For each condition, enter the following:

  * **Input Variable:** The variable to use in the comparison. If the input variable is null, it will be considered blank.
  * **Qualifier:** Select **Is** or **Not**. Not reverses the meaning of the comparator; for example, changing an "Equals" to a "Does Not Equal" expression.
  * **Comparator:** Select the comparison operator.
  * **Value:** Most commonly a constant value, but can also be a variable reference or expression. The value is parsed according to the type of the input variable.

  Click the **Text mode** toggle at the bottom of the dialog to open a multi-line editor that lets you add items in a single block. For more information, read [Text mode](/docs/guides/components-overview#text-mode).

  To use grid variables, toggle **Use Grid Variable** on at the bottom of the dialog. For more information, read [Grid variables](/docs/guides/grid-variables).

  Only used if **Mode** is set to `Simple`.

  #### Example

  The condition in Simple mode allows users to define conditions using input variables, comparators, and values. Multiple conditions can be combined using the Combine Conditions property to evaluate whether an expression is true or false.

  If you have a variable `gv_test1` containing a grid with columns `col_1`, `col_2`, and `col_3`, you would need to reference the column and row as follows to check the value in the first row of `col_1`:

  ```
  gv_test1.col_1[0] == "b"
  ```

  This example will check if the value in the first row of `col_1` is equal to `"b"`. In Simple mode, you don't need to use `${}` syntax as in Advanced mode, since you're directly comparing values.
</ResponseField>

{/* <!-- param-start:[combineConditions] | warehouses: [snowflake, databricks, redshift, bigquery] --> */}

<ResponseField name="Combine Conditions" type="drop-down" required>
  Use the defined conditions in combination with one another according to either "And" or "Or". Only used if **Mode** is set to `Simple`.
</ResponseField>
