BlazingStory icon indicating copy to clipboard operation
BlazingStory copied to clipboard

Passing more than just text to a renderfragment

Open NathanVG opened this issue 8 months ago • 2 comments

I'm trying to create a story for my custom button. Normally I can pass an icon to the button and it will render correctly as such:

<ExampleButton><PlusCircleIcon class="mr-2 h-4 w-4 text-current" /> Add New</ExampleButton>

However all I get is the text "Add New" when I do this in blazing story, the span etc is stripped as well:

<Stories>
    <Story Name="With Icon">
        <Arguments>
            <Arg For="_ => _.ChildContent" Value="_ButtonContentWithIcon" />
            <Arg For="_=>_.ButtonStyle" Value="ExampleButtonStyle.Primary" />
            <Arg For="_ => _.isLoading" Value="false" />
        </Arguments>
        <Template>
            <div class="flex items-center justify-center p-4">
                <ExampleButton@attributes="context.Args"></ExampleButton>
            </div>
        </Template>
    </Story>
</Stories>

@code
{
    private RenderFragment _ButtonContentWithIcon = @<span class="text-red-500"><PlusCircleIcon class="mr-2 h-4 w-4 text-current" /> Add new</span>;
}

How can I do this correctly?

NathanVG avatar May 30 '24 08:05 NathanVG