Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

313 рядки
12 KiB

  1. <div class="bs-docs-section">
  2. <h1 id="input-groups" class="page-header">Input groups</h1>
  3. <p class="lead">Extend form controls by adding text or buttons before, after, or on both sides of any text-based <code>&lt;input&gt;</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>
  4. <div class="bs-callout bs-callout-danger">
  5. <h4>Textual <code>&lt;input&gt;</code>s only</h4>
  6. <p>Avoid using <code>&lt;select&gt;</code> elements here as they cannot be fully styled in WebKit browsers.</p>
  7. <p>Avoid using <code>&lt;textarea&gt;</code> elements here as their <code>rows</code> attribute will not be respected in some cases.</p>
  8. </div>
  9. <div class="bs-callout bs-callout-warning">
  10. <h4>Tooltips &amp; popovers in input groups require special setting</h4>
  11. <p>When using tooltips or popovers on elements within an <code>.input-group</code>, you'll have to specify the option <code>container: 'body'</code> to avoid unwanted side effects (such as the element growing wider and/or losing its rounded corners when the tooltip or popover is triggered).</p>
  12. </div>
  13. <div class="bs-callout bs-callout-warning">
  14. <h4>Don't mix with other components</h4>
  15. <p>Do not mix form groups or grid column classes directly with input groups. Instead, nest the input group inside of the form group or grid-related element.</p>
  16. </div>
  17. <h2 id="input-groups-basic">Basic example</h2>
  18. <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>
  19. <p><strong class="text-danger">We do not support multiple add-ons on a single side.</strong></p>
  20. <p><strong class="text-danger">We do not support multiple form-controls in a single input group.</strong></p>
  21. <form class="bs-example bs-example-form" role="form">
  22. <div class="input-group">
  23. <span class="input-group-addon">@</span>
  24. <input type="text" class="form-control" placeholder="Username">
  25. </div>
  26. <br>
  27. <div class="input-group">
  28. <input type="text" class="form-control">
  29. <span class="input-group-addon">.00</span>
  30. </div>
  31. <br>
  32. <div class="input-group">
  33. <span class="input-group-addon">$</span>
  34. <input type="text" class="form-control">
  35. <span class="input-group-addon">.00</span>
  36. </div>
  37. </form>
  38. {% highlight html %}
  39. <div class="input-group">
  40. <span class="input-group-addon">@</span>
  41. <input type="text" class="form-control" placeholder="Username">
  42. </div>
  43. <div class="input-group">
  44. <input type="text" class="form-control">
  45. <span class="input-group-addon">.00</span>
  46. </div>
  47. <div class="input-group">
  48. <span class="input-group-addon">$</span>
  49. <input type="text" class="form-control">
  50. <span class="input-group-addon">.00</span>
  51. </div>
  52. {% endhighlight %}
  53. <h2 id="input-groups-sizing">Sizing</h2>
  54. <p>Add the relative form sizing classes to the <code>.input-group</code> itself and contents within will automatically resize—no need for repeating the form control size classes on each element.</p>
  55. <form class="bs-example bs-example-form" role="form">
  56. <div class="input-group input-group-lg">
  57. <span class="input-group-addon">@</span>
  58. <input type="text" class="form-control" placeholder="Username">
  59. </div>
  60. <br>
  61. <div class="input-group">
  62. <span class="input-group-addon">@</span>
  63. <input type="text" class="form-control" placeholder="Username">
  64. </div>
  65. <br>
  66. <div class="input-group input-group-sm">
  67. <span class="input-group-addon">@</span>
  68. <input type="text" class="form-control" placeholder="Username">
  69. </div>
  70. </form>
  71. {% highlight html %}
  72. <div class="input-group input-group-lg">
  73. <span class="input-group-addon">@</span>
  74. <input type="text" class="form-control" placeholder="Username">
  75. </div>
  76. <div class="input-group">
  77. <span class="input-group-addon">@</span>
  78. <input type="text" class="form-control" placeholder="Username">
  79. </div>
  80. <div class="input-group input-group-sm">
  81. <span class="input-group-addon">@</span>
  82. <input type="text" class="form-control" placeholder="Username">
  83. </div>
  84. {% endhighlight %}
  85. <h2 id="input-groups-checkboxes-radios">Checkboxes and radio addons</h2>
  86. <p>Place any checkbox or radio option within an input group's addon instead of text.</p>
  87. <form class="bs-example bs-example-form">
  88. <div class="row">
  89. <div class="col-lg-6">
  90. <div class="input-group">
  91. <span class="input-group-addon">
  92. <input type="checkbox">
  93. </span>
  94. <input type="text" class="form-control">
  95. </div><!-- /input-group -->
  96. </div><!-- /.col-lg-6 -->
  97. <div class="col-lg-6">
  98. <div class="input-group">
  99. <span class="input-group-addon">
  100. <input type="radio">
  101. </span>
  102. <input type="text" class="form-control">
  103. </div><!-- /input-group -->
  104. </div><!-- /.col-lg-6 -->
  105. </div><!-- /.row -->
  106. </form>
  107. {% highlight html %}
  108. <div class="row">
  109. <div class="col-lg-6">
  110. <div class="input-group">
  111. <span class="input-group-addon">
  112. <input type="checkbox">
  113. </span>
  114. <input type="text" class="form-control">
  115. </div><!-- /input-group -->
  116. </div><!-- /.col-lg-6 -->
  117. <div class="col-lg-6">
  118. <div class="input-group">
  119. <span class="input-group-addon">
  120. <input type="radio">
  121. </span>
  122. <input type="text" class="form-control">
  123. </div><!-- /input-group -->
  124. </div><!-- /.col-lg-6 -->
  125. </div><!-- /.row -->
  126. {% endhighlight %}
  127. <h2 id="input-groups-buttons">Button addons</h2>
  128. <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>
  129. <form class="bs-example bs-example-form">
  130. <div class="row">
  131. <div class="col-lg-6">
  132. <div class="input-group">
  133. <span class="input-group-btn">
  134. <button class="btn btn-default" type="button">Go!</button>
  135. </span>
  136. <input type="text" class="form-control">
  137. </div><!-- /input-group -->
  138. </div><!-- /.col-lg-6 -->
  139. <div class="col-lg-6">
  140. <div class="input-group">
  141. <input type="text" class="form-control">
  142. <span class="input-group-btn">
  143. <button class="btn btn-default" type="button">Go!</button>
  144. </span>
  145. </div><!-- /input-group -->
  146. </div><!-- /.col-lg-6 -->
  147. </div><!-- /.row -->
  148. </form>
  149. {% highlight html %}
  150. <div class="row">
  151. <div class="col-lg-6">
  152. <div class="input-group">
  153. <span class="input-group-btn">
  154. <button class="btn btn-default" type="button">Go!</button>
  155. </span>
  156. <input type="text" class="form-control">
  157. </div><!-- /input-group -->
  158. </div><!-- /.col-lg-6 -->
  159. <div class="col-lg-6">
  160. <div class="input-group">
  161. <input type="text" class="form-control">
  162. <span class="input-group-btn">
  163. <button class="btn btn-default" type="button">Go!</button>
  164. </span>
  165. </div><!-- /input-group -->
  166. </div><!-- /.col-lg-6 -->
  167. </div><!-- /.row -->
  168. {% endhighlight %}
  169. <h2 id="input-groups-buttons-dropdowns">Buttons with dropdowns</h2>
  170. <p></p>
  171. <form class="bs-example bs-example-form" role="form">
  172. <div class="row">
  173. <div class="col-lg-6">
  174. <div class="input-group">
  175. <div class="input-group-btn">
  176. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Action <span class="caret"></span></button>
  177. <ul class="dropdown-menu" role="menu">
  178. <li><a href="#">Action</a></li>
  179. <li><a href="#">Another action</a></li>
  180. <li><a href="#">Something else here</a></li>
  181. <li class="divider"></li>
  182. <li><a href="#">Separated link</a></li>
  183. </ul>
  184. </div><!-- /btn-group -->
  185. <input type="text" class="form-control">
  186. </div><!-- /input-group -->
  187. </div><!-- /.col-lg-6 -->
  188. <div class="col-lg-6">
  189. <div class="input-group">
  190. <input type="text" class="form-control">
  191. <div class="input-group-btn">
  192. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Action <span class="caret"></span></button>
  193. <ul class="dropdown-menu dropdown-menu-right" role="menu">
  194. <li><a href="#">Action</a></li>
  195. <li><a href="#">Another action</a></li>
  196. <li><a href="#">Something else here</a></li>
  197. <li class="divider"></li>
  198. <li><a href="#">Separated link</a></li>
  199. </ul>
  200. </div><!-- /btn-group -->
  201. </div><!-- /input-group -->
  202. </div><!-- /.col-lg-6 -->
  203. </div><!-- /.row -->
  204. </form>
  205. {% highlight html %}
  206. <div class="row">
  207. <div class="col-lg-6">
  208. <div class="input-group">
  209. <div class="input-group-btn">
  210. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Action <span class="caret"></span></button>
  211. <ul class="dropdown-menu" role="menu">
  212. <li><a href="#">Action</a></li>
  213. <li><a href="#">Another action</a></li>
  214. <li><a href="#">Something else here</a></li>
  215. <li class="divider"></li>
  216. <li><a href="#">Separated link</a></li>
  217. </ul>
  218. </div><!-- /btn-group -->
  219. <input type="text" class="form-control">
  220. </div><!-- /input-group -->
  221. </div><!-- /.col-lg-6 -->
  222. <div class="col-lg-6">
  223. <div class="input-group">
  224. <input type="text" class="form-control">
  225. <div class="input-group-btn">
  226. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Action <span class="caret"></span></button>
  227. <ul class="dropdown-menu dropdown-menu-right" role="menu">
  228. <li><a href="#">Action</a></li>
  229. <li><a href="#">Another action</a></li>
  230. <li><a href="#">Something else here</a></li>
  231. <li class="divider"></li>
  232. <li><a href="#">Separated link</a></li>
  233. </ul>
  234. </div><!-- /btn-group -->
  235. </div><!-- /input-group -->
  236. </div><!-- /.col-lg-6 -->
  237. </div><!-- /.row -->
  238. {% endhighlight %}
  239. <h2 id="input-groups-buttons-segmented">Segmented buttons</h2>
  240. <form class="bs-example bs-example-form" role="form">
  241. <div class="row">
  242. <div class="col-lg-6">
  243. <div class="input-group">
  244. <div class="input-group-btn">
  245. <button type="button" class="btn btn-default" tabindex="-1">Action</button>
  246. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1">
  247. <span class="caret"></span>
  248. <span class="sr-only">Toggle Dropdown</span>
  249. </button>
  250. <ul class="dropdown-menu" role="menu">
  251. <li><a href="#">Action</a></li>
  252. <li><a href="#">Another action</a></li>
  253. <li><a href="#">Something else here</a></li>
  254. <li class="divider"></li>
  255. <li><a href="#">Separated link</a></li>
  256. </ul>
  257. </div>
  258. <input type="text" class="form-control">
  259. </div><!-- /.input-group -->
  260. </div><!-- /.col-lg-6 -->
  261. <div class="col-lg-6">
  262. <div class="input-group">
  263. <input type="text" class="form-control">
  264. <div class="input-group-btn">
  265. <button type="button" class="btn btn-default" tabindex="-1">Action</button>
  266. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1">
  267. <span class="caret"></span>
  268. <span class="sr-only">Toggle Dropdown</span>
  269. </button>
  270. <ul class="dropdown-menu dropdown-menu-right" role="menu">
  271. <li><a href="#">Action</a></li>
  272. <li><a href="#">Another action</a></li>
  273. <li><a href="#">Something else here</a></li>
  274. <li class="divider"></li>
  275. <li><a href="#">Separated link</a></li>
  276. </ul>
  277. </div>
  278. </div><!-- /.input-group -->
  279. </div><!-- /.col-lg-6 -->
  280. </div><!-- /.row -->
  281. </form>
  282. {% highlight html %}
  283. <div class="input-group">
  284. <div class="input-group-btn">
  285. <!-- Button and dropdown menu -->
  286. </div>
  287. <input type="text" class="form-control">
  288. </div>
  289. <div class="input-group">
  290. <input type="text" class="form-control">
  291. <div class="input-group-btn">
  292. <!-- Button and dropdown menu -->
  293. </div>
  294. </div>
  295. {% endhighlight %}
  296. </div>