button.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. ---
  2. title: Button
  3. layout: documentation
  4. doc-tab: elements
  5. doc-subtab: button
  6. variables:
  7. - name: $button-color
  8. value: $grey-darker
  9. - name: $button-background-color
  10. value: $white
  11. - name: $button-border-color
  12. value: $grey-lighter
  13. - name: $button-hover-color
  14. value: $link-hover
  15. - name: $button-hover-border-color
  16. value: $link-hover-border
  17. - name: $button-focus-color
  18. value: $link-focus
  19. - name: $button-focus-border-color
  20. value: $link-focus-border
  21. - name: $button-focus-box-shadow-size
  22. value: 0 0 0 0.125em
  23. - name: $button-focus-box-shadow-color
  24. value: rgba($link, 0.25)
  25. - name: $button-active-color
  26. value: $link-active
  27. - name: $button-active-border-color
  28. value: $link-active-border
  29. - name: $button-link-color
  30. value: $text
  31. - name: $button-link-hover-background-color
  32. value: $background
  33. - name: $button-link-hover-color
  34. value: $text-strong
  35. - name: $button-disabled-background-color
  36. value: $white
  37. - name: $button-disabled-border-color
  38. value: $grey-lighter
  39. - name: $button-disabled-shadow
  40. value: none
  41. - name: $button-disabled-opacity
  42. value: 0.5
  43. - name: $button-static-color
  44. value: $grey
  45. - name: $button-static-background-color
  46. value: $white-ter
  47. - name: $button-static-border-color
  48. value: $grey-lighter
  49. - name: $button-shadow-inset
  50. value: inset 0 1px 2px rgba($black, 0.2)
  51. ---
  52. {% capture button_example %}
  53. <a class="button">Button</a>
  54. {% endcapture %}
  55. {% capture button_tags_example %}
  56. <a class="button">Anchor</a>
  57. <button class="button">Button</button>
  58. <input class="button" type="submit" value="Submit input">
  59. <input class="button" type="reset" value="Reset input">
  60. {% endcapture %}
  61. {% capture button_colors_a_example %}
  62. <a class="button is-white">White</a>
  63. <a class="button is-light">Light</a>
  64. <a class="button is-dark">Dark</a>
  65. <a class="button is-black">Black</a>
  66. <a class="button is-link">Link</a>
  67. {% endcapture %}
  68. {% capture button_colors_b_example %}
  69. <a class="button is-primary">Primary</a>
  70. <a class="button is-info">Info</a>
  71. <a class="button is-success">Success</a>
  72. <a class="button is-warning">Warning</a>
  73. <a class="button is-danger">Danger</a>
  74. {% endcapture %}
  75. {% capture button_sizes_example %}
  76. <a class="button is-small">Small</a>
  77. <a class="button">Normal</a>
  78. <a class="button is-medium">Medium</a>
  79. <a class="button is-large">Large</a>
  80. {% endcapture %}
  81. {% capture button_outlined_example %}
  82. <a class="button is-outlined">Outlined</a>
  83. <a class="button is-primary is-outlined">Outlined</a>
  84. <a class="button is-info is-outlined">Outlined</a>
  85. <a class="button is-success is-outlined">Outlined</a>
  86. <a class="button is-danger is-outlined">Outlined</a>
  87. {% endcapture %}
  88. {% capture button_inverted_example %}
  89. <a class="button is-primary is-inverted">Inverted</a>
  90. <a class="button is-info is-inverted">Inverted</a>
  91. <a class="button is-success is-inverted">Inverted</a>
  92. <a class="button is-danger is-inverted">Inverted</a>
  93. {% endcapture %}
  94. {% capture button_inverted_outlined_example %}
  95. <a class="button is-primary is-inverted is-outlined">Invert Outlined</a>
  96. <a class="button is-info is-inverted is-outlined">Invert Outlined</a>
  97. <a class="button is-success is-inverted is-outlined">Invert Outlined</a>
  98. <a class="button is-danger is-inverted is-outlined">Invert Outlined</a>
  99. {% endcapture %}
  100. {% capture button_normal_example %}
  101. <a class="button">Normal</a>
  102. <a class="button is-primary">Normal</a>
  103. <a class="button is-info">Normal</a>
  104. <a class="button is-success">Normal</a>
  105. <a class="button is-warning">Normal</a>
  106. <a class="button is-danger">Normal</a>
  107. {% endcapture %}
  108. {% capture button_hover_example %}
  109. <a class="button is-hovered">Hover</a>
  110. <a class="button is-primary is-hovered">Hover</a>
  111. <a class="button is-info is-hovered">Hover</a>
  112. <a class="button is-success is-hovered">Hover</a>
  113. <a class="button is-warning is-hovered">Hover</a>
  114. <a class="button is-danger is-hovered">Hover</a>
  115. {% endcapture %}
  116. {% capture button_focus_example %}
  117. <a class="button is-focused">Focus</a>
  118. <a class="button is-primary is-focused">Focus</a>
  119. <a class="button is-info is-focused">Focus</a>
  120. <a class="button is-success is-focused">Focus</a>
  121. <a class="button is-warning is-focused">Focus</a>
  122. <a class="button is-danger is-focused">Focus</a>
  123. {% endcapture %}
  124. {% capture button_active_example %}
  125. <a class="button is-active">Active</a>
  126. <a class="button is-primary is-active">Active</a>
  127. <a class="button is-info is-active">Active</a>
  128. <a class="button is-success is-active">Active</a>
  129. <a class="button is-warning is-active">Active</a>
  130. <a class="button is-danger is-active">Active</a>
  131. {% endcapture %}
  132. {% capture button_loading_example %}
  133. <a class="button is-loading">Loading</a>
  134. <a class="button is-primary is-loading">Loading</a>
  135. <a class="button is-info is-loading">Loading</a>
  136. <a class="button is-success is-loading">Loading</a>
  137. <a class="button is-warning is-loading">Loading</a>
  138. <a class="button is-danger is-loading">Loading</a>
  139. {% endcapture %}
  140. {% capture button_static_example %}
  141. <span class="button is-static">Static</span>
  142. {% endcapture %}
  143. {% capture button_disabled_example %}
  144. <a class="button" title="Disabled button" disabled>Disabled</a>
  145. <a class="button is-primary" title="Disabled button" disabled>Disabled</a>
  146. <a class="button is-info" title="Disabled button" disabled>Disabled</a>
  147. <a class="button is-success" title="Disabled button" disabled>Disabled</a>
  148. <a class="button is-warning" title="Disabled button" disabled>Disabled</a>
  149. <a class="button is-danger" title="Disabled button" disabled>Disabled</a>
  150. {% endcapture %}
  151. {% capture button_fa_example %}
  152. <p class="field">
  153. <a class="button">
  154. <span class="icon is-small">
  155. <i class="fa fa-bold"></i>
  156. </span>
  157. </a>
  158. <a class="button">
  159. <span class="icon is-small">
  160. <i class="fa fa-italic"></i>
  161. </span>
  162. </a>
  163. <a class="button">
  164. <span class="icon is-small">
  165. <i class="fa fa-underline"></i>
  166. </span>
  167. </a>
  168. </p>
  169. <p class="field">
  170. <a class="button">
  171. <span class="icon">
  172. <i class="fa fa-github"></i>
  173. </span>
  174. <span>GitHub</span>
  175. </a>
  176. <a class="button is-primary">
  177. <span class="icon">
  178. <i class="fa fa-twitter"></i>
  179. </span>
  180. <span>Twitter</span>
  181. </a>
  182. <a class="button is-success">
  183. <span class="icon is-small">
  184. <i class="fa fa-check"></i>
  185. </span>
  186. <span>Save</span>
  187. </a>
  188. <a class="button is-danger is-outlined">
  189. <span>Delete</span>
  190. <span class="icon is-small">
  191. <i class="fa fa-times"></i>
  192. </span>
  193. </a>
  194. </p>
  195. <p class="field">
  196. <a class="button is-small">
  197. <span class="icon is-small">
  198. <i class="fa fa-github"></i>
  199. </span>
  200. <span>GitHub</span>
  201. </a>
  202. <a class="button">
  203. <span class="icon">
  204. <i class="fa fa-github"></i>
  205. </span>
  206. <span>GitHub</span>
  207. </a>
  208. <a class="button is-medium">
  209. <span class="icon">
  210. <i class="fa fa-github"></i>
  211. </span>
  212. <span>GitHub</span>
  213. </a>
  214. <a class="button is-large">
  215. <span class="icon is-medium">
  216. <i class="fa fa-github"></i>
  217. </span>
  218. <span>GitHub</span>
  219. </a>
  220. </p>
  221. {% endcapture %}
  222. {% capture button_only_icon_example %}
  223. <p class="field">
  224. <a class="button is-small">
  225. <span class="icon is-small">
  226. <i class="fa fa-header"></i>
  227. </span>
  228. </a>
  229. </p>
  230. <p class="field">
  231. <a class="button">
  232. <span class="icon is-small">
  233. <i class="fa fa-header"></i>
  234. </span>
  235. </a>
  236. <a class="button">
  237. <span class="icon">
  238. <i class="fa fa-header"></i>
  239. </span>
  240. </a>
  241. </p>
  242. <p class="field">
  243. <a class="button is-medium">
  244. <span class="icon is-small">
  245. <i class="fa fa-header"></i>
  246. </span>
  247. </a>
  248. <a class="button is-medium">
  249. <span class="icon">
  250. <i class="fa fa-header"></i>
  251. </span>
  252. </a>
  253. <a class="button is-medium">
  254. <span class="icon is-medium">
  255. <i class="fa fa-header"></i>
  256. </span>
  257. </a>
  258. </p>
  259. <p class="field">
  260. <a class="button is-large">
  261. <span class="icon is-small">
  262. <i class="fa fa-header"></i>
  263. </span>
  264. </a>
  265. <a class="button is-large">
  266. <span class="icon">
  267. <i class="fa fa-header"></i>
  268. </span>
  269. </a>
  270. <a class="button is-large">
  271. <span class="icon is-medium">
  272. <i class="fa fa-header"></i>
  273. </span>
  274. </a>
  275. <a class="button is-large">
  276. <span class="icon is-large">
  277. <i class="fa fa-header"></i>
  278. </span>
  279. </a>
  280. </p>
  281. {% endcapture %}
  282. {% capture button_group_example %}
  283. <div class="field is-grouped">
  284. <p class="control">
  285. <a class="button is-primary">
  286. Save changes
  287. </a>
  288. </p>
  289. <p class="control">
  290. <a class="button">
  291. Cancel
  292. </a>
  293. </p>
  294. <p class="control">
  295. <a class="button is-danger">
  296. Delete post
  297. </a>
  298. </p>
  299. </div>
  300. {% endcapture %}
  301. {% capture button_addons_example %}
  302. <div class="field has-addons">
  303. <p class="control">
  304. <a class="button">
  305. <span class="icon is-small">
  306. <i class="fa fa-align-left"></i>
  307. </span>
  308. <span>Left</span>
  309. </a>
  310. </p>
  311. <p class="control">
  312. <a class="button">
  313. <span class="icon is-small">
  314. <i class="fa fa-align-center"></i>
  315. </span>
  316. <span>Center</span>
  317. </a>
  318. </p>
  319. <p class="control">
  320. <a class="button">
  321. <span class="icon is-small">
  322. <i class="fa fa-align-right"></i>
  323. </span>
  324. <span>Right</span>
  325. </a>
  326. </p>
  327. </div>
  328. {% endcapture %}
  329. {% capture button_group_addons_example %}
  330. <div class="field has-addons">
  331. <p class="control">
  332. <a class="button">
  333. <span class="icon is-small">
  334. <i class="fa fa-bold"></i>
  335. </span>
  336. <span>Bold</span>
  337. </a>
  338. </p>
  339. <p class="control">
  340. <a class="button">
  341. <span class="icon is-small">
  342. <i class="fa fa-italic"></i>
  343. </span>
  344. <span>Italic</span>
  345. </a>
  346. </p>
  347. <p class="control">
  348. <a class="button">
  349. <span class="icon is-small">
  350. <i class="fa fa-underline"></i>
  351. </span>
  352. <span>Underline</span>
  353. </a>
  354. </p>
  355. </div>
  356. <div class="field has-addons">
  357. <p class="control">
  358. <a class="button">
  359. <span class="icon is-small">
  360. <i class="fa fa-align-left"></i>
  361. </span>
  362. <span>Left</span>
  363. </a>
  364. </p>
  365. <p class="control">
  366. <a class="button">
  367. <span class="icon is-small">
  368. <i class="fa fa-align-center"></i>
  369. </span>
  370. <span>Center</span>
  371. </a>
  372. </p>
  373. <p class="control">
  374. <a class="button">
  375. <span class="icon is-small">
  376. <i class="fa fa-align-right"></i>
  377. </span>
  378. <span>Right</span>
  379. </a>
  380. </p>
  381. </div>
  382. {% endcapture %}
  383. {% include subnav-elements.html %}
  384. <section class="section">
  385. <div class="container">
  386. <h1 class="title">Buttons</h1>
  387. <h2 class="subtitle">
  388. The classic <strong>button</strong>, in different colors, sizes, and states
  389. </h2>
  390. {%
  391. include meta.html
  392. colors=true
  393. sizes=true
  394. variables=true
  395. %}
  396. <hr>
  397. <div class="content">
  398. <p>
  399. The <strong>button</strong> is an essential element of any design. It's meant to look and behave as an <strong>interactive</strong> element of your page.
  400. </p>
  401. </div>
  402. {% include snippet.html content=button_example %}
  403. <div class="content">
  404. <p>
  405. The <code>.button</code> class can be used on:
  406. </p>
  407. <ul>
  408. <li>
  409. <code>&lt;a&gt;</code> anchor links
  410. </li>
  411. <li>
  412. <code>&lt;button&gt;</code> form buttons
  413. </li>
  414. <li>
  415. <code>&lt;input type="submit"&gt;</code> submit inputs
  416. </li>
  417. <li>
  418. <code>&lt;input type="reset"&gt;</code> reset inputs
  419. </li>
  420. </ul>
  421. </div>
  422. {% include snippet.html content=button_tags_example %}
  423. {% include anchor.html name="Colors" %}
  424. {% include snippet.html content=button_colors_a_example %}
  425. {% include snippet.html content=button_colors_b_example %}
  426. {% include anchor.html name="Sizes" %}
  427. {% include snippet.html content=button_sizes_example %}
  428. {% include anchor.html name="Styles" %}
  429. <h4 class="subtitle">Outlined</h4>
  430. {% include snippet.html content=button_outlined_example %}
  431. <h4 class="subtitle">Inverted (the text color becomes the background color, and vice-versa)</h4>
  432. <div class="columns">
  433. <div class="column">
  434. <div class="bd-callout is-primary">
  435. {{button_inverted_example}}
  436. </div>
  437. </div>
  438. <div class="column">
  439. {% highlight html %}{{button_inverted_example}}{% endhighlight %}
  440. </div>
  441. </div>
  442. <h4 class="subtitle">Invert Outlined (the invert color becomes the text and border colors)</h4>
  443. <div class="columns">
  444. <div class="column">
  445. <div class="bd-callout is-primary">
  446. {{button_inverted_outlined_example}}
  447. </div>
  448. </div>
  449. <div class="column">
  450. {% highlight html %}{{button_inverted_outlined_example}}{% endhighlight %}
  451. </div>
  452. </div>
  453. {% include anchor.html name="States" %}
  454. <h4 class="subtitle">Normal</h4>
  455. {% include snippet.html content=button_normal_example %}
  456. <h4 class="subtitle">Hover</h4>
  457. {% include snippet.html content=button_hover_example %}
  458. <h4 class="subtitle">Focus</h4>
  459. {% include snippet.html content=button_focus_example %}
  460. <h4 class="subtitle">Active</h4>
  461. {% include snippet.html content=button_active_example %}
  462. <h4 class="subtitle">Loading</h4>
  463. <div class="columns">
  464. <div class="column">
  465. <div class="block">
  466. {{button_loading_example}}
  467. </div>
  468. <div class="message is-info">
  469. <div class="message-body">
  470. <p>
  471. Since the loading spinner is implemented using the <code>:after</code> pseudo-element, it is not support by the <code>&lt;input type="submit"&gt;</code> element.
  472. </p>
  473. </div>
  474. </div>
  475. </div>
  476. <div class="column">
  477. {% highlight html %}{{button_loading_example}}{% endhighlight %}
  478. </div>
  479. </div>
  480. <h4 id="static-button" class="subtitle">
  481. Static
  482. </h4>
  483. <div class="columns">
  484. <div class="column">
  485. <div class="content">
  486. <p>
  487. <span class="tag is-success">New!</span>
  488. <span class="tag is-info">0.4.2</span>
  489. </p>
  490. <p>
  491. You can create a <strong>non-interactive button</strong> by using the <code>is-static</code> modifier. This is useful to align a text label with an input, for example when using <a href="{{site.url}}/documentation/form/general#form-addons">form addons</a>.
  492. </p>
  493. </div>
  494. {{button_static_example}}
  495. </div>
  496. <div class="column">
  497. {% highlight html %}{{button_static_example}}{% endhighlight %}
  498. </div>
  499. </div>
  500. <h4 class="subtitle">Disabled</h4>
  501. <div class="columns">
  502. <div class="column">
  503. <div class="block">
  504. {{button_disabled_example}}
  505. </div>
  506. <div class="message is-danger">
  507. <div class="message-body">
  508. <p>The <code>is-disabled</code> CSS class has been deprecated in favor of the <code>disabled</code> HTML attribute. <a href="https://github.com/jgthms/bulma/issues/276">Learn more</a></p>
  509. </div>
  510. </div>
  511. </div>
  512. <div class="column">
  513. {% highlight html %}{{button_disabled_example}}{% endhighlight %}
  514. </div>
  515. </div>
  516. <h4 class="subtitle">With Font Awesome icons</h4>
  517. {% include snippet.html content=button_fa_example %}
  518. <div class="columns">
  519. <div class="column">
  520. <div class="content">
  521. <p>
  522. <span class="tag is-success">New!</span>
  523. </p>
  524. <p>
  525. If the button only contains an icon, Bulma will make sure the button remains <strong>square</strong>, no matter the size of the button <em>or</em> of the icon.
  526. </p>
  527. </div>
  528. {{button_only_icon_example}}
  529. </div>
  530. <div class="column">
  531. {% highlight html %}{{button_only_icon_example}}{% endhighlight %}
  532. </div>
  533. </div>
  534. {% include anchor.html name="Button group" %}
  535. <div class="content">
  536. <p>If you want to <strong>group</strong> buttons together on a <strong>single line</strong>, use the <code>is-grouped</code> modifier on the <code>field</code> container:</p>
  537. </div>
  538. {% include snippet.html content=button_group_example %}
  539. {% include anchor.html name="Button addons" %}
  540. <div class="content">
  541. <p>If you want to use buttons as <strong>addons</strong>, use the <code>has-addons</code> modifier on the <code>field</code> container:</p>
  542. </div>
  543. {% include snippet.html content=button_addons_example %}
  544. {% include anchor.html name="Button group with addons" %}
  545. <div class="content">
  546. <p>You can group together addons as well:</p>
  547. </div>
  548. {% include snippet.html content=button_group_addons_example %}
  549. {% include variables.html %}
  550. </div>
  551. </section>