Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to customize TwitterBootstrap MVC HTML Helpers with additional css classes? #442

Open
kfinke70 opened this issue Dec 5, 2016 · 3 comments

Comments

@kfinke70
Copy link

kfinke70 commented Dec 5, 2016

We're working on a project with TwitterBootstrapMVC and we wish to incorporate Google's material design. We've found a nice bootstrap / material implementation: http://fezvrasta.github.io/bootstrap-material-design/.

However, in order to harness the power of this material framework we'd like to add css classes to certain things. For example, a FormGroup() might need to be extended with label-floating and has-warning. We would like to extend or customize some of the default behavior of the TwitterBootstrapMVC extensions.

How should we go about that?

@DmitryEfimenko
Copy link
Owner

The .FormGroup() has an extension method .Class() so you can apply any class to the wrapping <div class="form-group"...

As far as extensions go, you can extend things in BMVC to a certain degree. See #436 for an example. It might or might not be sufficient for you.

If you require more involved changes, purchasing BMVC's source code might be an option. Some companies have done that. If that option interests you, please contact me via email.

@kfinke70
Copy link
Author

kfinke70 commented Dec 6, 2016

Sorry, I should have mentioned that I know about the .Class() method.

This is the beginning of a port of a huge application to the web. There will be literally thousands of fields. Tens of thousands! For maintainability, brevity, and consistency I would love to make the default behavior of each control the way we want it.

I really don't want to fork the code. You seem to be actively maintaining it and extending it. However, I also don't see any good ways to simply extend it. If I subclass something, say BootstrapControlGroupBase, I would then have to start adding duplicate extension methods, etc. It could get ugly quickly.

Perhaps we could customize it from within? Say for example a way to provide you with default css classes?

@DmitryEfimenko
Copy link
Owner

DmitryEfimenko commented Dec 6, 2016

We could try add this via adding keys to appSettings similar to how it's done for label position. Something like:

<add key="BMVC.Globals.FormGroup.ExtraCssClass" value="label-floating" />

If you like this approach, please let me know all use cases which you'd require (anything besides FormGroup?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants