TriggerScope
Stable · since 0.1.0
Provides a scope id to descendants. useCondition and useAction calls inside this subtree register with the scope, and only triggers declared with the same scope in createTrigger(...) will see them. The runtime, inspector, scheduler and middleware all stay shared — TriggerScope is a lighter, in-runtime partition compared to <TriggerRuntimeProvider>.
Use it when one runtime is correct but you need two halves of the tree to register independent providers for the same condition or action.
Import
Section titled “Import”Signature
Section titled “Signature”| Prop | Type | Required | Description |
|---|---|---|---|
id | string | yes | Scope id. Must match the scope field on a trigger to bind. |
children | ReactNode | yes | Subtree where registrations are tagged with id. |
Examples
Section titled “Examples”Two chat instances on one page
Section titled “Two chat instances on one page”Independent scopes for two trigger instances
Section titled “Independent scopes for two trigger instances”Nested scopes
Section titled “Nested scopes”The inner id wins for everything inside it:
Related
Section titled “Related” TriggerRuntimeProvider Heavier isolation — separate runtime per subtree.
createTrigger Where you declare the `scope` field.
useCondition Registrations inside a scope inherit its id.
Scopes guide Patterns for multi-instance UIs.