From d01b4eb02560ba67b61b1b2c0496e9f8281c154d Mon Sep 17 00:00:00 2001 From: m5o Date: Wed, 14 Mar 2018 16:44:38 +0100 Subject: Remove custom example plugin. (#25784) --- docs/4.0/components/forms.md | 235 ++++++++++++++++++++++++++----------------- 1 file changed, 141 insertions(+), 94 deletions(-) (limited to 'docs/4.0/components/forms.md') diff --git a/docs/4.0/components/forms.md b/docs/4.0/components/forms.md index fadc2dd27..0eb34bae9 100644 --- a/docs/4.0/components/forms.md +++ b/docs/4.0/components/forms.md @@ -14,7 +14,7 @@ Be sure to use an appropriate `type` attribute on all inputs (e.g., `email` for Here's a quick example to demonstrate Bootstrap's form styles. Keep reading for documentation on required classes, form layout, and more. -{% example html %} +{% capture example %}
@@ -31,7 +31,8 @@ Here's a quick example to demonstrate Bootstrap's form styles. Keep reading for
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} ## Form controls @@ -39,7 +40,7 @@ Textual form controls—like ``s, ` -{% endexample %} +{% endcapture %} +{% include example.html content=example %} For file inputs, swap the `.form-control` for `.form-control-file`. -{% example html %} +{% capture example %}
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} ### Sizing Set heights using classes like `.form-control-lg` and `.form-control-sm`. -{% example html %} +{% capture example %} -{% endexample %} +{% endcapture %} +{% include example.html content=example %} -{% example html %} +{% capture example %} @@ -103,34 +107,37 @@ Set heights using classes like `.form-control-lg` and `.form-control-sm`. -{% endexample %} +{% endcapture %} +{% include example.html content=example %} ## Range Inputs Set horizontally scrollable range inputs using `.form-control-range`. -{% example html %} +{% capture example %}
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} ### 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 %} +{% capture example %} -{% endexample %} +{% endcapture %} +{% include example.html content=example %} ### Readonly plain text If you want to have `` elements in your form styled as plain text, use the `.form-control-plaintext` class to remove the default form field styling and preserve the correct margin and padding. -{% example html %} +{% capture example %}
@@ -145,9 +152,10 @@ If you want to have `` elements in your form styled as plain tex
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} -{% example html %} +{% capture example %}
@@ -159,7 +167,8 @@ If you want to have `` elements in your form styled as plain tex
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} ## Checkboxes and radios @@ -173,7 +182,7 @@ Checkboxes and radios use are built to support HTML-based form validation and pr By default, any number of checkboxes and radios that are immediate sibling will be vertically stacked and appropriately spaced with `.form-check`. -{% example html %} +{% capture example %}
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} -{% example html %} +{% capture example %}
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} ### Inline Group checkboxes or radios on the same horizontal row by adding `.form-check-inline` to any `.form-check`. -{% example html %} +{% capture example %}
@@ -226,9 +237,10 @@ Group checkboxes or radios on the same horizontal row by adding `.form-check-inl
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} -{% example html %} +{% capture example %}
@@ -241,20 +253,22 @@ Group checkboxes or radios on the same horizontal row by adding `.form-check-inl
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} ### Without labels Add `.position-static` to inputs within `.form-check` that don't have any label text. Remember to still provide some form of label for assistive technologies (for instance, using `aria-label`). -{% example html %} +{% capture example %}
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} ## Layout @@ -264,7 +278,7 @@ Since Bootstrap applies `display: block` and `width: 100%` to almost all our for The `.form-group` class is the easiest way to add some structure to forms. It provides a flexible class that encourages proper grouping of labels, controls, optional help text, and form validation messaging. By default it only applies `margin-bottom`, but it picks up additional styles in `.form-inline` as needed. Use it with `
`s, `
`s, or nearly any other element. -{% example html %} +{% capture example %}
@@ -275,13 +289,14 @@ The `.form-group` class is the easiest way to add some structure to forms. It pr
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} ### Form grid More complex forms can be built using our grid classes. Use these for form layouts that require multiple columns, varied widths, and additional alignment options. -{% example html %} +{% capture example %}
@@ -292,13 +307,14 @@ More complex forms can be built using our grid classes. Use these for form layou
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} #### Form row You may also swap `.row` for `.form-row`, a variation of our standard grid row that overrides the default column gutters for tighter and more compact layouts. -{% example html %} +{% capture example %}
@@ -309,11 +325,12 @@ You may also swap `.row` for `.form-row`, a variation of our standard grid row t
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} More complex layouts can also be created with the grid system. -{% example html %} +{% capture example %}
@@ -360,7 +377,8 @@ More complex layouts can also be created with the grid system.
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} #### Horizontal form @@ -368,7 +386,7 @@ Create horizontal forms with the grid by adding the `.row` class to form groups At times, you maybe need to use margin or padding utilities to create that perfect alignment you need. For example, we've removed the `padding-top` on our stacked radio inputs label to better align the text baseline. -{% example html %} +{% capture example %}
@@ -424,13 +442,14 @@ At times, you maybe need to use margin or padding utilities to create that perfe
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} ##### Horizontal form label sizing Be sure to use `.col-form-label-sm` or `.col-form-label-lg` to your `
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} #### Column sizing As shown in the previous examples, our grid system allows you to place any number of `.col`s within a `.row` or `.form-row`. They'll split the available width equally between them. You may also pick a subset of your columns to take up more or less space, while the remaining `.col`s equally split the rest, with specific column classes like `.col-7`. -{% example html %} +{% capture example %}
@@ -471,13 +491,14 @@ As shown in the previous examples, our grid system allows you to place any numbe
-{% endexample html %} +{% endcapture %} +{% include example.html content=example %} #### Auto-sizing The example below uses a flexbox utility to vertically center the contents and changes `.col` to `.col-auto` so that your columns only take up as much space as needed. Put another way, the column sizes itself based on the contents. -{% example html %} +{% capture example %}
@@ -506,11 +527,12 @@ The example below uses a flexbox utility to vertically center the contents and c
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} You can then remix that once again with size-specific column classes. -{% example html %} +{% capture example %}
@@ -539,11 +561,12 @@ You can then remix that once again with size-specific column classes.
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} And of course [custom form controls](#custom-forms) are supported. -{% example html %} +{% capture example %}
@@ -566,7 +589,8 @@ And of course [custom form controls](#custom-forms) are supported.
-{% endexample %} +{% endcapture %} +{% include example.html content=example %} ### Inline forms @@ -578,7 +602,7 @@ Use the `.form-inline` class to display a series of labels, form controls, and b You may need to manually address the width and alignment of individual form controls with [spacing utilities]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/spacing/) (as shown below). Lastly, be sure to always include a `