> For the complete documentation index, see [llms.txt](https://docs.pixiebrix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pixiebrix.com/developing-mods/developer-concepts/control-flow/conditional-field-on-bricks.md).

# Conditional Field on Bricks

This advanced brick option decides whether that brick should run, or should not based on a condition.

The condition to run the brick is that the value must be true (or truthy) If the value is false (or falsy) this brick will not execute.

{% hint style="info" %}
💡 Here are some additional resources to understand what falsy or truthy mean in the context of JavaScript:<br>

* Truthy <https://developer.mozilla.org/en-US/docs/Glossary/Truthy>
* Falsy <https://developer.mozilla.org/en-US/docs/Glossary/Falsy>
  {% endhint %}

This condition can be any variable or expression or value, as long as they are truthy or falsy they will make it so that the brick will run, or not.

#### 🧙‍♂️ **Pro-tip:**

When building mods, it happens often that you want to debug your work. Sometimes there’s a brick that you don’t want to run, but at the same time you don’t want to fully delete it from the mod.

How can you prevent it from being triggered? If you want to “pause” a brick from running without deleting it you can set the **Condition** to **`0`** or **`false`**.

Here are some examples of **Condition** you can set:

Setting these values to the Condition will run the brick:

* `1`
* `true`
* `“this is a string”`

However, setting it to one of the below options will not run the brick:

* `0`
* `false`
* `{{ false if @input.url }}`

You can provide a condition as one of the following:

* **Text**: either a hard-coded value or a text template

{% hint style="info" %}
Using a text template, the shortest way to write an expression is using their conditional expression syntax: `{{ true if *<expr>* }}`.\
\
*Learn more in the* [Text Template Guide](/developing-mods/developer-concepts/text-template-guide.md)
{% endhint %}

* **Number**: non-zero numbers are considered truthy
* **Toggle**: toggling the brick on/off using a toggle
* **Variable**: a variable from a preceding brick

For complicated business logic, you can use the jq - JSON processor brick, and pass the output to the condition using the variable entry mode.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pixiebrix.com/developing-mods/developer-concepts/control-flow/conditional-field-on-bricks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
