Twitter-bootstrap – How does one create a read-only form layout in twitter bootstrap

twitter-bootstrap

Suppose you have view information (not edit information) when using twitter bootstrap. What's the best way to display the data?

This was actually brought up as an issue: https://github.com/twitter/bootstrap/issues/4094.

Best Answer

Bootstrap 3

BS3 has a concept of a static field. You can mix and match static fields and input fields on the same form. Or use all static fields for a read only form.

http://getbootstrap.com/css/#forms-controls-static

Instead of a normal input element, you can use a p tag with this special bootstrap class:

<p class="form-control-static">email@example.com</p>

Bootstrap 4:

You can use the form-control-plaintext class on an input tag.

See https://getbootstrap.com/docs/4.0/components/forms/#readonly-plain-text

Boostrap 5:

form-control-plaintext