DmitryEfimenko / TwitterBootstrapMvc

Fluent implementation of ASP.NET-MVC HTML helpers for Twitter Bootstrap.
Apache License 2.0
221 stars 78 forks source link

HTML5 input color ? #443

Closed wstaelens closed 7 years ago

wstaelens commented 7 years ago

How to create an input for a HTML5 color picker?

<input type="color" />
@f.FormGroup().EditorFor...?
@f.FormGroup().??
DmitryEfimenko commented 7 years ago

This is a general MVC question rather than a BMVC specific. Please use StackOverflow for these. You'd do it the same as with regular MVC - using html attributes:

@Html.Bootstrap().TextBoxFor(x => x.MyColor).HtmlAttributes(new { type = "color" })
wstaelens commented 7 years ago

I agree, but a helper with shorter syntax would be useful... 'textbox' doesn't make sense for an html5 colorpicker

Something like would be great:

@Html.Bootstrap().ColorpickerFor(x => x.MyColor);
DmitryEfimenko commented 7 years ago

It would indeed be a bit cleaner, but to me it doesn't sound like the benefit worth the effort