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.

Overload 1

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>

Props

childrenoptionalChildren
valueScope context interface

The scope to use. If not provided, a new scope will be created.

Overload 2

Create a scope by providing a name and optional metadata.

import { Scope } from "@alloy-js/core";
<Scope kind="string" metadata={Record<string, unknown>} name="string">
{children}
</Scope>

Props

childrenoptionalChildren
kindoptionalstring

The kind of scope. This may be used by application code to determine how to handle symbols in this scope. It is not used by the core framework.

metadataoptionalRecord<string, unknown>

Additional metadata for the scope.

nameoptionalstring

The name of this scope.

See also