How to implement custom elements in blazor 7 (Practical guide) ?

Hamed Vaziri 136 Reputation points
2023-02-03T16:39:26.1333333+00:00

Hi everyone

As you know, one of the new features of blazor 7 is custom elements. But there is not enough references & guides which demonstrate how to implement this.

for example, I want to create custom element in my blazor server app, then consume it from another webSite such as wordpress site, but i don't know how to implement & consume it in wordpress site.

Can anybody help me & give me a step-by-step guide to accomplish this ?

Thanks in advance

Developer technologies ASP.NET ASP.NET Core
Developer technologies .NET Blazor
0 comments No comments
{count} votes

8 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-02-04T00:19:13.1666667+00:00

    your sample html file has to be hosted by a web server and must use the same protocol (http/https) as the blazer server.

    also not sure blazor server can open the correct signal/r hub if its a different website. You may be able to get around this by configuring the signal/r hub in javascript blazor startup:

    https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/startup?view=aspnetcore-7.0

    note: all the examples have the server website hosting the custom element also hosting the blazor app.

    you might find blazor WASM easier, as you can just deploy the static resources to the website hosting the html that will use it.


  2. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-02-04T00:19:44.39+00:00

    (post to display previous post - ms please fix this)

    0 comments No comments

  3. Hamed Vaziri 136 Reputation points
    2023-02-06T10:20:18.1733333+00:00

    Can anybody help me ?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.