Skip to main content

FluentBootstrap provides extensions, helper classes, model binding, and other goodies to help you use the Bootstrap CSS framework from .NET code.

As discussed in the docs:

The Bootstrap CSS framework is great. It provides a whole lot of useful components that can be leveraged on any web page. However, as with any complex CSS framework it requires you to specify particular CSS classes on specific HTML elements. FluentBootstrap abstracts most of this detail behind code so that you can think about what you want to present rather than how to present it.

FluentBootstrap may not be for you if you prefer writing raw HTML or need the control the markup gives you. However, FluentBootstrap does offer the following advantages that may make generating Bootstrap HTML code easier in many situations:

  • By leveraging extension methods, helper classes, enums, etc., FluentBootstrap helps provide complete Intellisense when writing Bootstrap code.
  • Integrated helpers to bind Bootstrap structures to code objects.
  • The structures in FluentBootstrap are intended to be logic representations of the content as opposed to the (sometimes)
    complex HTML nesting imposed by CSS limitations in Bootstrap.
  • FluentBootstrap makes upgrading the Bootstrap library easier because missing structures, changes, etc. will be presented as compile-time errors (if precompilation is enabled). You also won't have to worry about subtle changes in the CSS (for example, Bootstrap 3.3.0 made some small changes to the CSS classes you should use for media objects, which was handled transparently by the corresponding FluentBootstrap update).
  • Proper start and end tag conventions are enforced through run-time checks and the disposable object model.
  • All FluentBootstrap components have a flexible fluent interface that can be used to adjust HTML attributes, classes, etc. prior to output.
  • Using code makes automatic refactoring and other static analysis possible on your Bootstrap code.
  • Content can be output to alternate destinations, such as a string (this is helpful when rendering templates for JavaScript consumption).
  • Component properties, such as whether a form should be horizontal or vertical, are transparently maintained for all child components, including those in partial views.
  • Additional extensions can be written to create custom composite components that are easy to use within your views.