<div class="bs-docs-section">
<h1 id="input-groups" class="page-header">Input groups</h1>
- <p class="lead">Extend form controls by adding text or buttons before, after, or on both sides of any text-based <code><input></code>. Use <code>.input-group</code> with an <code>.input-group-addon</code> to prepend or append elements to a single <code>.form-control</code>.</p>
+ <p class="lead">Extend form controls by adding text or buttons before, after, or on both sides of any text-based <code><input></code>. Use <code>.input-group</code> with an <code>.input-group-addon</code> or <code>.input-group-btn</code> to prepend or append elements to a single <code>.form-control</code>.</p>
<div class="bs-callout bs-callout-danger" id="callout-inputgroup-text-input-only">
<h4>Textual <code><input></code>s only</h4>
<div class="bs-callout bs-callout-warning" id="callout-inputgroup-form-labels">
<h4>Always add labels</h4>
<p>Screen readers will have trouble with your forms if you don't include a label for every input. For these input groups, ensure that any additional label or functionality is conveyed to assistive technologies.</p>
- <p>The exact technique to be used (<code><label></code> elements hidden using the <code>.sr-only</code> class, or use of the <code>aria-label</code>, <code>aria-labelledby</code>, <code>aria-describedby</code>, <code>title</code> or <code>placeholder</code> attribute) and what additional information will need to be conveyed will vary depending on the exact type of interface widget you're implementing. The examples in this section provide a few suggested, case-specific approaches.</p>
+ <p>The exact technique to be used (visible <code><label></code> elements, <code><label></code> elements hidden using the <code>.sr-only</code> class, or use of the <code>aria-label</code>, <code>aria-labelledby</code>, <code>aria-describedby</code>, <code>title</code> or <code>placeholder</code> attribute) and what additional information will need to be conveyed will vary depending on the exact type of interface widget you're implementing. The examples in this section provide a few suggested, case-specific approaches.</p>
</div>
<h2 id="input-groups-basic">Basic example</h2>
<p>Place one add-on or button on either side of an input. You may also place one on both sides of an input.</p>
- <p><strong class="text-danger">We do not support multiple add-ons on a single side.</strong></p>
+ <p><strong class="text-danger">We do not support multiple add-ons (<code>.input-group-addon</code> or <code>.input-group-btn</code>) on a single side.</strong></p>
<p><strong class="text-danger">We do not support multiple form-controls in a single input group.</strong></p>
<form class="bs-example bs-example-form" data-example-id="simple-input-groups">
<div class="input-group">
<input type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
<span class="input-group-addon">.00</span>
</div>
+ <br>
+ <label for="basic-url">Your vanity URL</label>
+ <div class="input-group">
+ <span class="input-group-addon" id="basic-addon3">https://example.com/users/</span>
+ <input type="text" class="form-control" id="basic-url" aria-describedby="basic-addon3">
+ </div>
</form>
<div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt"><div</span> <span class="na">class=</span><span class="s">"input-group"</span><span class="nt">></span>
<span class="nt"><span</span> <span class="na">class=</span><span class="s">"input-group-addon"</span> <span class="na">id=</span><span class="s">"basic-addon1"</span><span class="nt">></span>@<span class="nt"></span></span>
<span class="nt"><span</span> <span class="na">class=</span><span class="s">"input-group-addon"</span><span class="nt">></span>$<span class="nt"></span></span>
<span class="nt"><input</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">class=</span><span class="s">"form-control"</span> <span class="na">aria-label=</span><span class="s">"Amount (to the nearest dollar)"</span><span class="nt">></span>
<span class="nt"><span</span> <span class="na">class=</span><span class="s">"input-group-addon"</span><span class="nt">></span>.00<span class="nt"></span></span>
+<span class="nt"></div></span>
+
+<span class="nt"><label</span> <span class="na">for=</span><span class="s">"basic-url"</span><span class="nt">></span>Your vanity URL<span class="nt"></label></span>
+<span class="nt"><div</span> <span class="na">class=</span><span class="s">"input-group"</span><span class="nt">></span>
+ <span class="nt"><span</span> <span class="na">class=</span><span class="s">"input-group-addon"</span> <span class="na">id=</span><span class="s">"basic-addon3"</span><span class="nt">></span>https://example.com/users/<span class="nt"></span></span>
+ <span class="nt"><input</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">class=</span><span class="s">"form-control"</span> <span class="na">id=</span><span class="s">"basic-url"</span> <span class="na">aria-describedby=</span><span class="s">"basic-addon3"</span><span class="nt">></span>
<span class="nt"></div></span></code></pre></div>
<h2 id="input-groups-sizing">Sizing</h2>
<span class="nt"><input</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">class=</span><span class="s">"form-control"</span> <span class="na">placeholder=</span><span class="s">"Username"</span> <span class="na">aria-describedby=</span><span class="s">"sizing-addon3"</span><span class="nt">></span>
<span class="nt"></div></span></code></pre></div>
-
<h2 id="input-groups-checkboxes-radios">Checkboxes and radio addons</h2>
<p>Place any checkbox or radio option within an input group's addon instead of text.</p>
<form class="bs-example bs-example-form" data-example-id="input-group-with-checkbox-radio">
<span class="nt"></div></span><span class="c"><!-- /.col-lg-6 --></span>
<span class="nt"></div></span><span class="c"><!-- /.row --></span></code></pre></div>
-
<h2 id="input-groups-buttons">Button addons</h2>
<p>Buttons in input groups are a bit different and require one extra level of nesting. Instead of <code>.input-group-addon</code>, you'll need to use <code>.input-group-btn</code> to wrap the buttons. This is required due to default browser styles that cannot be overridden.</p>
<form class="bs-example bs-example-form" data-example-id="input-group-with-button">
<span class="nt"></div></span><span class="c"><!-- /.row --></span></code></pre></div>
<h2 id="input-groups-buttons-dropdowns">Buttons with dropdowns</h2>
- <p></p>
<form class="bs-example bs-example-form" data-example-id="input-group-dropdowns">
<div class="row">
<div class="col-lg-6">
<span class="c"><!-- Button and dropdown menu --></span>
<span class="nt"></div></span>
<span class="nt"></div></span></code></pre></div>
+
+ <h2 id="input-groups-buttons-multiple">Multiple buttons</h2>
+ <p>While you can only have one add-on per side, you can have multiple buttons inside a single <code>.input-group-btn</code>.</p>
+ <form class="bs-example bs-example-form" data-example-id="input-group-multiple-buttons">
+ <div class="row">
+ <div class="col-lg-6">
+ <div class="input-group">
+ <div class="input-group-btn">
+ <button type="button" class="btn btn-default" aria-label="Bold"><span class="glyphicon glyphicon-bold"></span></button>
+ <button type="button" class="btn btn-default" aria-label="Italic"><span class="glyphicon glyphicon-italic"></span></button>
+ </div>
+ <input type="text" class="form-control" aria-label="Text input with multiple buttons">
+ </div><!-- /.input-group -->
+ </div><!-- /.col-lg-6 -->
+ <div class="col-lg-6">
+ <div class="input-group">
+ <input type="text" class="form-control" aria-label="Text input with multiple buttons">
+ <div class="input-group-btn">
+ <button type="button" class="btn btn-default" aria-label="Help"><span class="glyphicon glyphicon-question-sign"></span></button>
+ <button type="button" class="btn btn-default">Action</button>
+ </div>
+ </div><!-- /.input-group -->
+ </div><!-- /.col-lg-6 -->
+ </div><!-- /.row -->
+ </form>
+<div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt"><div</span> <span class="na">class=</span><span class="s">"input-group"</span><span class="nt">></span>
+ <span class="nt"><div</span> <span class="na">class=</span><span class="s">"input-group-btn"</span><span class="nt">></span>
+ <span class="c"><!-- Buttons --></span>
+ <span class="nt"></div></span>
+ <span class="nt"><input</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">class=</span><span class="s">"form-control"</span> <span class="na">aria-label=</span><span class="s">"..."</span><span class="nt">></span>
+<span class="nt"></div></span>
+
+<span class="nt"><div</span> <span class="na">class=</span><span class="s">"input-group"</span><span class="nt">></span>
+ <span class="nt"><input</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">class=</span><span class="s">"form-control"</span> <span class="na">aria-label=</span><span class="s">"..."</span><span class="nt">></span>
+ <span class="nt"><div</span> <span class="na">class=</span><span class="s">"input-group-btn"</span><span class="nt">></span>
+ <span class="c"><!-- Buttons --></span>
+ <span class="nt"></div></span>
+<span class="nt"></div></span></code></pre></div>
</div>
<div class="bs-docs-section">
<li><a href="#input-groups-buttons">Button addons</a></li>
<li><a href="#input-groups-buttons-dropdowns">Buttons with dropdowns</a></li>
<li><a href="#input-groups-buttons-segmented">Segmented buttons</a></li>
+ <li><a href="#input-groups-buttons-multiple">Multiple buttons</a></li>
</ul>
</li>
<li>