Skip to content

Introduce package for rendering Blazor components with custom HTML elements #42329

Closed
@MackinnonBuck

Description

@MackinnonBuck

Background and Motivation

We currently have an experimental support package Microsoft.AspNetCore.Components.CustomElements that enables rendering Blazor components using custom HTML elements. This makes it easier to utilize Blazor in projects built on other web frameworks. Since this is a scenario we strongly care about, we'd like to productize this feature as an officially supported package (see #38447).

Proposed API

namespace Microsoft.AspNetCore.Components.Web;

+ public static class CustomElementsJSComponentConfigurationExtensions
{
+    public void RegisterAsCustomElement<TComponent>(this IJSComponentConfiguration configuration, string customElementName) where TComponent : IComponent;
}

Usage Example

var builder = WebAssemblyHostBuilder.CreateDefault(args);
// ...
builder.RootComponents.RegisterAsCustomElement<MyComponent>("my-custom-element");

Metadata

Metadata

Assignees

Labels

api-approvedAPI was approved in API review, it can be implementedarea-blazorIncludes: Blazor, Razor Components

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions