btn-toggle.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VBtnToggleBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VBtnToggle(children ...h.HTMLComponent) (r *VBtnToggleBuilder) {
  11. r = &VBtnToggleBuilder{
  12. tag: h.Tag("v-btn-toggle").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VBtnToggleBuilder) ActiveClass(v string) (r *VBtnToggleBuilder) {
  17. b.tag.Attr("active-class", v)
  18. return b
  19. }
  20. func (b *VBtnToggleBuilder) BackgroundColor(v string) (r *VBtnToggleBuilder) {
  21. b.tag.Attr("background-color", v)
  22. return b
  23. }
  24. func (b *VBtnToggleBuilder) Borderless(v bool) (r *VBtnToggleBuilder) {
  25. b.tag.Attr(":borderless", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VBtnToggleBuilder) Color(v string) (r *VBtnToggleBuilder) {
  29. b.tag.Attr("color", v)
  30. return b
  31. }
  32. func (b *VBtnToggleBuilder) Dark(v bool) (r *VBtnToggleBuilder) {
  33. b.tag.Attr(":dark", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VBtnToggleBuilder) Dense(v bool) (r *VBtnToggleBuilder) {
  37. b.tag.Attr(":dense", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VBtnToggleBuilder) Group(v bool) (r *VBtnToggleBuilder) {
  41. b.tag.Attr(":group", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VBtnToggleBuilder) Light(v bool) (r *VBtnToggleBuilder) {
  45. b.tag.Attr(":light", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VBtnToggleBuilder) Mandatory(v bool) (r *VBtnToggleBuilder) {
  49. b.tag.Attr(":mandatory", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VBtnToggleBuilder) Max(v int) (r *VBtnToggleBuilder) {
  53. b.tag.Attr(":max", fmt.Sprint(v))
  54. return b
  55. }
  56. func (b *VBtnToggleBuilder) Multiple(v bool) (r *VBtnToggleBuilder) {
  57. b.tag.Attr(":multiple", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VBtnToggleBuilder) Rounded(v bool) (r *VBtnToggleBuilder) {
  61. b.tag.Attr(":rounded", fmt.Sprint(v))
  62. return b
  63. }
  64. func (b *VBtnToggleBuilder) Shaped(v bool) (r *VBtnToggleBuilder) {
  65. b.tag.Attr(":shaped", fmt.Sprint(v))
  66. return b
  67. }
  68. func (b *VBtnToggleBuilder) Tag(v string) (r *VBtnToggleBuilder) {
  69. b.tag.Attr("tag", v)
  70. return b
  71. }
  72. func (b *VBtnToggleBuilder) Tile(v bool) (r *VBtnToggleBuilder) {
  73. b.tag.Attr(":tile", fmt.Sprint(v))
  74. return b
  75. }
  76. func (b *VBtnToggleBuilder) Value(v interface{}) (r *VBtnToggleBuilder) {
  77. b.tag.Attr(":value", h.JSONString(v))
  78. return b
  79. }
  80. func (b *VBtnToggleBuilder) SetAttr(k string, v interface{}) {
  81. b.tag.SetAttr(k, v)
  82. }
  83. func (b *VBtnToggleBuilder) Attr(vs ...interface{}) (r *VBtnToggleBuilder) {
  84. b.tag.Attr(vs...)
  85. return b
  86. }
  87. func (b *VBtnToggleBuilder) Children(children ...h.HTMLComponent) (r *VBtnToggleBuilder) {
  88. b.tag.Children(children...)
  89. return b
  90. }
  91. func (b *VBtnToggleBuilder) AppendChildren(children ...h.HTMLComponent) (r *VBtnToggleBuilder) {
  92. b.tag.AppendChildren(children...)
  93. return b
  94. }
  95. func (b *VBtnToggleBuilder) PrependChildren(children ...h.HTMLComponent) (r *VBtnToggleBuilder) {
  96. b.tag.PrependChildren(children...)
  97. return b
  98. }
  99. func (b *VBtnToggleBuilder) Class(names ...string) (r *VBtnToggleBuilder) {
  100. b.tag.Class(names...)
  101. return b
  102. }
  103. func (b *VBtnToggleBuilder) ClassIf(name string, add bool) (r *VBtnToggleBuilder) {
  104. b.tag.ClassIf(name, add)
  105. return b
  106. }
  107. func (b *VBtnToggleBuilder) On(name string, value string) (r *VBtnToggleBuilder) {
  108. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  109. return b
  110. }
  111. func (b *VBtnToggleBuilder) Bind(name string, value string) (r *VBtnToggleBuilder) {
  112. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  113. return b
  114. }
  115. func (b *VBtnToggleBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  116. return b.tag.MarshalHTML(ctx)
  117. }