Skip to content

MemberDeclaration

Declares a symbol in the current member scope for this component’s children.

Create a member declaration by providing a symbol name and optional symbol metadata.

import { MemberDeclaration } from "@alloy-js/core";
<MemberDeclaration
metadata={Record<string, unknown>}
name={string | Namekey}
refkey={Refkey | Refkey[]}
static
>
{children}
</MemberDeclaration>
childrenoptional Children
metadataoptional Record<string, unknown>Additional metadata for the declared symbol.
namestring | NamekeyThe name of this declaration.
refkeyoptional Refkey | Refkey[]The refkey or array refkeys for this declaration.
staticoptional booleanWhether this is a static member. If not provided, the member is an instance member.

Create a declaration by providing an already created symbol. The symbol is merely exposed via Declaration context.

import { MemberDeclaration } from "@alloy-js/core";
<MemberDeclaration symbol={OutputSymbol}>
{children}
</MemberDeclaration>
childrenoptional Children
symbolOutputSymbolThe symbol being declared. When provided, the name, refkey, and metadata props are ignored.

This component must be called in one of two ways: with a name and an optional refkey, or else passing in the symbol. When called with a name and refkey, a BasicSymbol will be created in the current member space. When called with a name, the owning scope must be a BasicScope; for custom scope/symbol types, pass a pre-created symbol instead.

When called with a symbol, that symbol is merely exposed via MemberDeclaration context (not Declaration context). Use MemberName (not <Name />) to render the declared member’s name.