Closed conficient closed 2 years ago
An initial test suggests layouts are not working, needs further investigation .
So layouts for a component are specified using a directive, e.g.
@layout LayoutFile
This the results in an attribute added to the generated code:
using Microsoft.AspNetCore.Components;
[Microsoft.AspNetCore.Components.LayoutAttribute(typeof(LayoutFile))]
public partial class LayoutComponent : Microsoft.AspNetCore.Components.ComponentBase
A template is a component that @inherits LayoutComponentBase
and has a @Body
parameter. If I can find a way to render the layout and set the @Body
to the target top-level component we should be able to support this.
Razor Components support the specify of a Layout templates that wrap component output using a
@Body
render fragment.Layouts can be specified in the component, e.g,
@layout MyLayout
- we need to see if this can be supported.Also are we able to support a layout being passed as a parameter or set in
Templater
to apply to components. This might be useful if using different layouts for different brands when creating emails, for example.