0

I have recently been looking at fast-components with a Blazor PWA in .NET 6, and in the docs I can see that there is potential for invoking individual components (showing angular syntax, I believe - example below). I would like to bring in individual components with Blazor, however, I'm not sure if this is possible, or how it would be done (potentially using IJSRuntime?) The Blazor integration guide does not cover importing individual components, which leads me to thinking it's not possible, but I hope someone knows otherwise.

Does anyone know how to achieve something like this:

import {
    provideFASTDesignSystem,
    fastAccordion,
    fastAccordionItem
} from "@microsoft/fast-components";

provideFASTDesignSystem()
    .register(
        fastAccordion(),
        fastAccordionItem()
    );

Using this kind of syntax in Blazor with .NET 6, but to import only a specific component, rather than the whole module?

[Inject]
IJSRuntime JSRuntime { get; set; }
IJSObjectReference module;

protected override async Task OnAfterRenderAsync(bool firstRender)
{
    module = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "./scripts/components/fast-components.min.js");

}
Guru Stron
  • 102,774
  • 10
  • 95
  • 132
  • What do you mean by importing individual components? What are you trying to achieve? – Grizzlly Jan 10 '22 at 14:33
  • As an example, if I wanted to use a fast-data-grid on a page, I'd like to import the data grid, only, into the page, instead of the entire JS module – MayaDev Jan 11 '22 at 08:44

0 Answers0