Skip to Content
ConceptsFeature Flags

Boolean Flag

The simplest flag: on or off. When active, flag.enabled is true for all users in the environment.

const flag = canary.getFlag('maintenance-mode') // flag.type === 'boolean' // flag.enabled === true | false

When to use:

  • Kill switches / maintenance
  • Complete features you want to release to everyone at once
  • Integrations or modules that require manual activation

Rollout Flag

Exposes the feature to a percentage of users in a sticky (deterministic) way. A user with the same userId will always receive the same result for a given percentage configuration.

const flag = canary.getFlag('new-dashboard') // flag.type === 'rollout' // flag.enabled === true | false (based on userId and percentage) // flag.percentage === 25 (the currently configured percentage)

The SDK determines whether the user is included via a hash of userId combined with the flag name — with no server-side state per user.

When to use:

  • Canary deploys (expose to 5% → 25% → 100%)
  • Simple A/B tests
  • Beta features for early adopter users

Common fields

FieldTypeDescription
keystringUnique flag identifier in the environment
type'boolean' | 'rollout'Flag type
enabledbooleanWhether the flag is active for the current user
descriptionstring | nullOptional description

SDK access

// Specific flag const flag = canary.getFlag('feature-key') // All flags const flags = canary.getFlags() // Safe check (returns false if the flag does not exist) const isEnabled = canary.getFlag('feature-key')?.enabled ?? false

The SDK does not expose an isEnabled() method — always use getFlag(key)?.enabled ?? false for simple checks.

Last updated on