ViewComponentTagHelper: Allow optional parameters · Issue #5011 · dotnet/aspnetcore (original) (raw)

Say we have a ViewComponent class

class MyViewComponent { IViewComponentResult Invoke( bool showSomething = false ) { ... } }

It would be great to just only write <vc:my /> in Razor if one don't want to show that something. Currently you have to write <vc:my show-something="false" />.