From: Mark Otto Date: Wed, 14 Jun 2017 05:11:44 +0000 (-0700) Subject: rearrange, new examples, new docs X-Git-Tag: v4.0.0-beta~147^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc71bee83eaf00c85ab844d0a310d28447aa3851;p=thirdparty%2Fbootstrap.git rearrange, new examples, new docs --- diff --git a/docs/4.0/components/forms.md b/docs/4.0/components/forms.md index 951966bdbd..6c24c83ab2 100644 --- a/docs/4.0/components/forms.md +++ b/docs/4.0/components/forms.md @@ -6,13 +6,15 @@ group: components toc: true --- -## Form controls +## Overview Bootstrap's form controls expand on [our Rebooted form styles]({{ site.baseurl }}/docs/{{ site.docs_version }}/content/reboot/#forms) with classes. Use these classes to opt into their customized displays for a more consistent rendering across browsers and devices. The example form below demonstrates common HTML form elements that receive updated styles from Bootstrap with additional classes. -Be sure to use an appropriate `type` attribute on all inputs (e.g., `email` for email address or `number` for numerical information). +Be sure to use an appropriate `type` attribute on all inputs (e.g., `email` for email address or `number` for numerical information) to take advantage of newer input controls like email verification, number selection, and more. + +## Example -### Example +Here's a quick example to demonstrate Bootstrap's form styles. Keep reading for documentation on required classes, form layout, and more. {% example html %}
@@ -25,9 +27,31 @@ Be sure to use an appropriate `type` attribute on all inputs (e.g., `email` for +
+ +
+ +
+{% endexample %} + +## Form controls + +Textual form controls—like ``s, ` + + + +{% endexample %} + +For file inputs, swap the `.form-control` for `.form-control-file`. + +{% example html %} +
- - - This is some placeholder block-level help text for the above input. It's a bit lighter and easily wraps to a new line. + +
-
- Radio buttons -
- -
-
- + +{% endexample %} + +### Sizing + +Set heights using classes like `.form-control-lg` and `.form-control-sm`. + +{% example html %} + + + +{% endexample %} + +{% example html %} + + + +{% endexample %} + +### Readonly + +Add the `readonly` boolean attribute on an input to prevent modification of the input's value. Read-only inputs appear lighter (just like disabled inputs), but retain the standard cursor. + +{% example html %} + +{% endexample %} + +### Static + +If you want to have read-only fields in your form styled as plain text, use the `.form-control-static` class to remove the default form field styling and preserve the correct margin and padding. + +{% example html %} +
+
+ +
+
-
- +
+
+ +
+
-
-
-
- {% endexample %} -### Supported controls - -Below is a complete list of the specific form controls supported by Bootstrap and the classes that customize them. Additional documentation is available for each group. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ClassesUsed forSupported variations
- {% markdown %}`.form-group`{% endmarkdown %} - - Any group of form controls - - {% markdown %}Use with any block-level element like `
` or `
`{% endmarkdown %} -
- {% markdown %}`.form-control`{% endmarkdown %} - - Textual inputs - - {% markdown %}`text`, `password`, `datetime-local`, `date`, `month`, `time`, `week`, `number`, `email`, `url`, `search`, `tel`, `color`{% endmarkdown %} -
- Select menus - - {% markdown %}`multiple`, `size`{% endmarkdown %} -
- Textareas - - N/A -
- {% markdown %}`.form-control-file`{% endmarkdown %} - - File inputs - - {% markdown %}`file`{% endmarkdown %} -
-{% markdown %} -`.form-check` -{% endmarkdown %} - - Checkboxes and radios - - N/A -
- -Here are examples of `.form-control` applied to each textual HTML5 `` `type` (meaning, almost everything except the file, checkbox, and radio inputs). - -| Type | Example | -| --- | --- | -| `text` | | -| `search` | | -| `email` | | -| `url` | | -| `tel` | | -| `password` | | -| `number` | | -| `datetime-local` | | -| `date` | | -| `month` | | -| `week` | | -| `time` | | -| `color` | | +{% example html %} +
+
+ + +
+
+ + +
+ +
+{% endexample %} + +## Checkboxes and radios + +Default checkboxes and radios are improved upon with the help of `.form-check`, **a single class for both input types that improves the layout and behavior of their HTML elements**. Checkboxes are for selecting one or several options in a list, while radios are for selecting one option from many. + +Disabled checkboxes and radios are supported, but to provide a `not-allowed` cursor on hover of the parent `