Skip to content

Make a standard way (in BlazorComponent) to pass arbitrary attributes #16087

Closed
@chanan

Description

@chanan

In @SteveSandersonMS Bootstrap branch @SteveSandersonMS added a way to pass arbitrary attributes down to a Component. Every Component should have that by default such that a component doesn't have to implement every single attribute imaginable. For example in react I would do that with the spread operator on props: <button {...props} />

See code in the bootstrap branch here:

https://github.com/aspnet/Blazor/blob/stevesa/bootstrap-components-library/src/Microsoft.AspNetCore.Blazor.Bootstrap/BootstrapComponentBase.cs
Used here: https://github.com/aspnet/Blazor/blob/stevesa/bootstrap-components-library/src/Microsoft.AspNetCore.Blazor.Bootstrap/Components/bsAlert.cshtml#L5
and rendered here: https://github.com/aspnet/Blazor/blob/stevesa/bootstrap-components-library/src/Microsoft.AspNetCore.Blazor.Bootstrap/DynamicElement.cs

IMO, this should be part of Blazor itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions