tabs.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VTabsBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VTabs(children ...h.HTMLComponent) (r *VTabsBuilder) {
  11. r = &VTabsBuilder{
  12. tag: h.Tag("v-tabs").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VTabsBuilder) ActiveClass(v string) (r *VTabsBuilder) {
  17. b.tag.Attr("active-class", v)
  18. return b
  19. }
  20. func (b *VTabsBuilder) AlignWithTitle(v bool) (r *VTabsBuilder) {
  21. b.tag.Attr(":align-with-title", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VTabsBuilder) BackgroundColor(v string) (r *VTabsBuilder) {
  25. b.tag.Attr("background-color", v)
  26. return b
  27. }
  28. func (b *VTabsBuilder) CenterActive(v bool) (r *VTabsBuilder) {
  29. b.tag.Attr(":center-active", fmt.Sprint(v))
  30. return b
  31. }
  32. func (b *VTabsBuilder) Centered(v bool) (r *VTabsBuilder) {
  33. b.tag.Attr(":centered", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VTabsBuilder) Color(v string) (r *VTabsBuilder) {
  37. b.tag.Attr("color", v)
  38. return b
  39. }
  40. func (b *VTabsBuilder) Dark(v bool) (r *VTabsBuilder) {
  41. b.tag.Attr(":dark", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VTabsBuilder) FixedTabs(v bool) (r *VTabsBuilder) {
  45. b.tag.Attr(":fixed-tabs", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VTabsBuilder) Grow(v bool) (r *VTabsBuilder) {
  49. b.tag.Attr(":grow", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VTabsBuilder) Height(v int) (r *VTabsBuilder) {
  53. b.tag.Attr(":height", fmt.Sprint(v))
  54. return b
  55. }
  56. func (b *VTabsBuilder) HideSlider(v bool) (r *VTabsBuilder) {
  57. b.tag.Attr(":hide-slider", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VTabsBuilder) IconsAndText(v bool) (r *VTabsBuilder) {
  61. b.tag.Attr(":icons-and-text", fmt.Sprint(v))
  62. return b
  63. }
  64. func (b *VTabsBuilder) Light(v bool) (r *VTabsBuilder) {
  65. b.tag.Attr(":light", fmt.Sprint(v))
  66. return b
  67. }
  68. func (b *VTabsBuilder) MobileBreakpoint(v string) (r *VTabsBuilder) {
  69. b.tag.Attr("mobile-breakpoint", v)
  70. return b
  71. }
  72. func (b *VTabsBuilder) NextIcon(v string) (r *VTabsBuilder) {
  73. b.tag.Attr("next-icon", v)
  74. return b
  75. }
  76. func (b *VTabsBuilder) Optional(v bool) (r *VTabsBuilder) {
  77. b.tag.Attr(":optional", fmt.Sprint(v))
  78. return b
  79. }
  80. func (b *VTabsBuilder) PrevIcon(v string) (r *VTabsBuilder) {
  81. b.tag.Attr("prev-icon", v)
  82. return b
  83. }
  84. func (b *VTabsBuilder) Right(v bool) (r *VTabsBuilder) {
  85. b.tag.Attr(":right", fmt.Sprint(v))
  86. return b
  87. }
  88. func (b *VTabsBuilder) ShowArrows(v bool) (r *VTabsBuilder) {
  89. b.tag.Attr(":show-arrows", fmt.Sprint(v))
  90. return b
  91. }
  92. func (b *VTabsBuilder) SliderColor(v string) (r *VTabsBuilder) {
  93. b.tag.Attr("slider-color", v)
  94. return b
  95. }
  96. func (b *VTabsBuilder) SliderSize(v int) (r *VTabsBuilder) {
  97. b.tag.Attr(":slider-size", fmt.Sprint(v))
  98. return b
  99. }
  100. func (b *VTabsBuilder) Value(v interface{}) (r *VTabsBuilder) {
  101. b.tag.Attr(":value", h.JSONString(v))
  102. return b
  103. }
  104. func (b *VTabsBuilder) Vertical(v bool) (r *VTabsBuilder) {
  105. b.tag.Attr(":vertical", fmt.Sprint(v))
  106. return b
  107. }
  108. func (b *VTabsBuilder) SetAttr(k string, v interface{}) {
  109. b.tag.SetAttr(k, v)
  110. }
  111. func (b *VTabsBuilder) Attr(vs ...interface{}) (r *VTabsBuilder) {
  112. b.tag.Attr(vs...)
  113. return b
  114. }
  115. func (b *VTabsBuilder) Children(children ...h.HTMLComponent) (r *VTabsBuilder) {
  116. b.tag.Children(children...)
  117. return b
  118. }
  119. func (b *VTabsBuilder) AppendChildren(children ...h.HTMLComponent) (r *VTabsBuilder) {
  120. b.tag.AppendChildren(children...)
  121. return b
  122. }
  123. func (b *VTabsBuilder) PrependChildren(children ...h.HTMLComponent) (r *VTabsBuilder) {
  124. b.tag.PrependChildren(children...)
  125. return b
  126. }
  127. func (b *VTabsBuilder) Class(names ...string) (r *VTabsBuilder) {
  128. b.tag.Class(names...)
  129. return b
  130. }
  131. func (b *VTabsBuilder) ClassIf(name string, add bool) (r *VTabsBuilder) {
  132. b.tag.ClassIf(name, add)
  133. return b
  134. }
  135. func (b *VTabsBuilder) On(name string, value string) (r *VTabsBuilder) {
  136. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  137. return b
  138. }
  139. func (b *VTabsBuilder) Bind(name string, value string) (r *VTabsBuilder) {
  140. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  141. return b
  142. }
  143. func (b *VTabsBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  144. return b.tag.MarshalHTML(ctx)
  145. }