Extensions
To register an extension, the PiralExtension
attribute can be used. You will also have to provide the extension slot name that defines where the extension should be rendered. The component can even be registered into multiple slots using multiple attributes.
razor
//counter.razor
@attribute [PiralExtension("my-counter-slot")]
@attribute [PiralExtension("another-extension-slot")]
<h1>Counter</h1>
<p>Current count: @currentCount</p>
<button @onclick="IncrementCount">Click me</button>
@code {
int currentCount = 0;
void IncrementCount()
{
currentCount++;
}
}
To use an extension within a Blazor component, the <Extension>
component can be used.
razor
<Extension Name="my-counter-slot"></Extension>