Skip to content

Scope

Declare a scope for this component’s children. Any symbols and scopes declared in the children of this component will be in this scope.

Declare a scope by providing an already created scope. The scope is merely exposed via Scope context.

import { Scope } from "@alloy-js/core";
<Scope value={OutputScope}>
{children}
</Scope>
childrenoptional Children
valueOutputScopeThe scope to use. If not provided, a new scope will be created.

Create a scope by providing a name and optional metadata.

import { Scope } from "@alloy-js/core";
<Scope
metadata={Record<string, unknown>}
name="string"
ownerSymbol={OutputSymbol}
>
{children}
</Scope>
childrenoptional Children
metadataoptional Record<string, unknown>Additional metadata for the scope.
nameoptional stringThe name of this scope.
ownerSymboloptional OutputSymbolCreate a member scope with the owner symbol providing the in-scope symbols.

When called with name (without value), this creates a BasicScope. The parent scope must also be a BasicScope; for custom scope types, create your scope and pass it via the value prop instead.