You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.2 KiB

4 years ago
  1. +++
  2. title = "Button Group"
  3. description = "Layout buttons to fit buttons snugly together."
  4. categories = ["interaction"]
  5. tags = ["controls"]
  6. html_attributes = ["class"]
  7. custom_attributes = ["formactions"]
  8. snippets_used = ["button group", "button", "form"]
  9. notes = [
  10. "update 'snippets' if this content is updated"
  11. ]
  12. [[copyright]]
  13. owner = "Josh Habdas"
  14. date = "2019"
  15. license = "agpl-3.0-or-later"
  16. +++
  17. With three [Buttons](../button), one ghosted and one of type info:
  18. ```html
  19. {{</* hackcss-buttongroup >}}
  20. {{< hackcss-button text="Left" />}}
  21. {{< hackcss-button type="info" >}}Middle{{< /hackcss-button >}}
  22. {{< hackcss-button text="Right" isghost="true" />}}
  23. {{< /hackcss-buttongroup */>}}
  24. ```
  25. {{< hackcss-buttongroup >}}
  26. {{< hackcss-button text="Left" />}}
  27. {{< hackcss-button type="info" >}}Middle{{< /hackcss-button >}}
  28. {{< hackcss-button text="Right" isghost="true" />}}
  29. {{< /hackcss-buttongroup >}}
  30. With three [Buttons](../button) styled using `class` attribute:
  31. ```html
  32. <style>.btn-text button::after { content: attr(class) }</style>
  33. {{</* hackcss-buttongroup class="btn-text" >}}
  34. {{< hackcss-button />}}
  35. {{< hackcss-button type="info" />}}
  36. {{< /hackcss-buttongroup */>}}
  37. ```
  38. <style>.btn-text button::after { content: attr(class) }</style>
  39. {{< hackcss-buttongroup class="btn-text" >}}
  40. {{< hackcss-button />}}
  41. {{< hackcss-button type="info" />}}
  42. {{< /hackcss-buttongroup >}}
  43. With two [Buttons](../button) inside a [Form](../form) using `formactions` attribute:
  44. ```html
  45. {{</* hackcss-form action="/search" >}}
  46. {{< hackcss-textinput type="hidden" name="s" value="button" >}}
  47. {{< hackcss-buttongroup formactions="true" >}}
  48. {{< hackcss-button text="Print" action="javascript:window.print()" />}}
  49. {{< hackcss-button text="Search" type="primary" isghost="true" />}}
  50. {{< /hackcss-buttongroup >}}
  51. {{< /hackcss-form */>}}
  52. ```
  53. {{< hackcss-form action="/search" >}}
  54. {{< hackcss-textinput type="hidden" name="s" value="group" >}}
  55. {{< hackcss-buttongroup formactions="true" >}}
  56. {{< hackcss-button text="Print" action="javascript:window.print()" />}}
  57. {{< hackcss-button text="Search" type="primary" isghost="true" />}}
  58. {{< /hackcss-buttongroup >}}
  59. {{< /hackcss-form >}}