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

# Create a boolean flag

> Add an on/off toggle in shipd.config.ts and read it with isEnabled.

## Overview

Add a boolean flag (toggle / switch / gate) named `new-checkout` to Fieldkit's `web-app`, push it, and branch on it.

## Steps

<Steps>
  <Step title="Define it">
    ```ts shipd.config.ts theme={null}
    import { defineFlags } from "shipdit/config";

    export default defineFlags({
      "new-checkout": {
        type: "boolean",
        default: false,
        description: "Redesigned checkout flow",
        tags: ["checkout"],
      },
    });
    ```
  </Step>

  <Step title="Push">
    ```bash theme={null}
    shipd push --project web-app --env production --yes
    ```
  </Step>

  <Step title="Evaluate">
    ```ts theme={null}
    if (shipd.isEnabled("new-checkout", { userId: "usr_8f2k19" })) {
      return renderNewCheckout();
    }
    return renderLegacyCheckout();
    ```

    ```tsx theme={null}
    const on = useFlag("new-checkout");
    ```
  </Step>
</Steps>

Off by default until a dashboard rule or fallthrough serves `true`. Targeting is not in `shipd.config.ts` — see [Target users](/guides/target-users).

CLI one-off (no config file):

```bash theme={null}
shipd flags create --key new-checkout --type boolean --description "Redesigned checkout flow"
```

Prefer `defineFlags` + `shipd push` so the repo stays source of truth.
