btn.go 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VBtnBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func (b *VBtnBuilder) Absolute(v bool) (r *VBtnBuilder) {
  11. b.tag.Attr(":absolute", fmt.Sprint(v))
  12. return b
  13. }
  14. func (b *VBtnBuilder) ActiveClass(v string) (r *VBtnBuilder) {
  15. b.tag.Attr("active-class", v)
  16. return b
  17. }
  18. func (b *VBtnBuilder) Append(v bool) (r *VBtnBuilder) {
  19. b.tag.Attr(":append", fmt.Sprint(v))
  20. return b
  21. }
  22. func (b *VBtnBuilder) Block(v bool) (r *VBtnBuilder) {
  23. b.tag.Attr(":block", fmt.Sprint(v))
  24. return b
  25. }
  26. func (b *VBtnBuilder) Bottom(v bool) (r *VBtnBuilder) {
  27. b.tag.Attr(":bottom", fmt.Sprint(v))
  28. return b
  29. }
  30. func (b *VBtnBuilder) Color(v string) (r *VBtnBuilder) {
  31. b.tag.Attr("color", v)
  32. return b
  33. }
  34. func (b *VBtnBuilder) Dark(v bool) (r *VBtnBuilder) {
  35. b.tag.Attr(":dark", fmt.Sprint(v))
  36. return b
  37. }
  38. func (b *VBtnBuilder) Depressed(v bool) (r *VBtnBuilder) {
  39. b.tag.Attr(":depressed", fmt.Sprint(v))
  40. return b
  41. }
  42. func (b *VBtnBuilder) Disabled(v bool) (r *VBtnBuilder) {
  43. b.tag.Attr(":disabled", fmt.Sprint(v))
  44. return b
  45. }
  46. func (b *VBtnBuilder) Elevation(v int) (r *VBtnBuilder) {
  47. b.tag.Attr(":elevation", fmt.Sprint(v))
  48. return b
  49. }
  50. func (b *VBtnBuilder) Exact(v bool) (r *VBtnBuilder) {
  51. b.tag.Attr(":exact", fmt.Sprint(v))
  52. return b
  53. }
  54. func (b *VBtnBuilder) ExactActiveClass(v string) (r *VBtnBuilder) {
  55. b.tag.Attr("exact-active-class", v)
  56. return b
  57. }
  58. func (b *VBtnBuilder) ExactPath(v bool) (r *VBtnBuilder) {
  59. b.tag.Attr(":exact-path", fmt.Sprint(v))
  60. return b
  61. }
  62. func (b *VBtnBuilder) Fab(v bool) (r *VBtnBuilder) {
  63. b.tag.Attr(":fab", fmt.Sprint(v))
  64. return b
  65. }
  66. func (b *VBtnBuilder) Fixed(v bool) (r *VBtnBuilder) {
  67. b.tag.Attr(":fixed", fmt.Sprint(v))
  68. return b
  69. }
  70. func (b *VBtnBuilder) Height(v int) (r *VBtnBuilder) {
  71. b.tag.Attr(":height", fmt.Sprint(v))
  72. return b
  73. }
  74. func (b *VBtnBuilder) Href(v interface{}) (r *VBtnBuilder) {
  75. b.tag.Attr(":href", h.JSONString(v))
  76. return b
  77. }
  78. func (b *VBtnBuilder) Icon(v bool) (r *VBtnBuilder) {
  79. b.tag.Attr(":icon", fmt.Sprint(v))
  80. return b
  81. }
  82. func (b *VBtnBuilder) InputValue(v interface{}) (r *VBtnBuilder) {
  83. b.tag.Attr(":input-value", h.JSONString(v))
  84. return b
  85. }
  86. func (b *VBtnBuilder) Large(v bool) (r *VBtnBuilder) {
  87. b.tag.Attr(":large", fmt.Sprint(v))
  88. return b
  89. }
  90. func (b *VBtnBuilder) Left(v bool) (r *VBtnBuilder) {
  91. b.tag.Attr(":left", fmt.Sprint(v))
  92. return b
  93. }
  94. func (b *VBtnBuilder) Light(v bool) (r *VBtnBuilder) {
  95. b.tag.Attr(":light", fmt.Sprint(v))
  96. return b
  97. }
  98. func (b *VBtnBuilder) Link(v bool) (r *VBtnBuilder) {
  99. b.tag.Attr(":link", fmt.Sprint(v))
  100. return b
  101. }
  102. func (b *VBtnBuilder) Loading(v bool) (r *VBtnBuilder) {
  103. b.tag.Attr(":loading", fmt.Sprint(v))
  104. return b
  105. }
  106. func (b *VBtnBuilder) MaxHeight(v int) (r *VBtnBuilder) {
  107. b.tag.Attr(":max-height", fmt.Sprint(v))
  108. return b
  109. }
  110. func (b *VBtnBuilder) MaxWidth(v int) (r *VBtnBuilder) {
  111. b.tag.Attr(":max-width", fmt.Sprint(v))
  112. return b
  113. }
  114. func (b *VBtnBuilder) MinHeight(v int) (r *VBtnBuilder) {
  115. b.tag.Attr(":min-height", fmt.Sprint(v))
  116. return b
  117. }
  118. func (b *VBtnBuilder) MinWidth(v int) (r *VBtnBuilder) {
  119. b.tag.Attr(":min-width", fmt.Sprint(v))
  120. return b
  121. }
  122. func (b *VBtnBuilder) Nuxt(v bool) (r *VBtnBuilder) {
  123. b.tag.Attr(":nuxt", fmt.Sprint(v))
  124. return b
  125. }
  126. func (b *VBtnBuilder) Outlined(v bool) (r *VBtnBuilder) {
  127. b.tag.Attr(":outlined", fmt.Sprint(v))
  128. return b
  129. }
  130. func (b *VBtnBuilder) Plain(v bool) (r *VBtnBuilder) {
  131. b.tag.Attr(":plain", fmt.Sprint(v))
  132. return b
  133. }
  134. func (b *VBtnBuilder) Replace(v bool) (r *VBtnBuilder) {
  135. b.tag.Attr(":replace", fmt.Sprint(v))
  136. return b
  137. }
  138. func (b *VBtnBuilder) RetainFocusOnClick(v bool) (r *VBtnBuilder) {
  139. b.tag.Attr(":retain-focus-on-click", fmt.Sprint(v))
  140. return b
  141. }
  142. func (b *VBtnBuilder) Right(v bool) (r *VBtnBuilder) {
  143. b.tag.Attr(":right", fmt.Sprint(v))
  144. return b
  145. }
  146. func (b *VBtnBuilder) Ripple(v interface{}) (r *VBtnBuilder) {
  147. b.tag.Attr(":ripple", h.JSONString(v))
  148. return b
  149. }
  150. func (b *VBtnBuilder) Rounded(v bool) (r *VBtnBuilder) {
  151. b.tag.Attr(":rounded", fmt.Sprint(v))
  152. return b
  153. }
  154. func (b *VBtnBuilder) Shaped(v bool) (r *VBtnBuilder) {
  155. b.tag.Attr(":shaped", fmt.Sprint(v))
  156. return b
  157. }
  158. func (b *VBtnBuilder) Small(v bool) (r *VBtnBuilder) {
  159. b.tag.Attr(":small", fmt.Sprint(v))
  160. return b
  161. }
  162. func (b *VBtnBuilder) Tag(v string) (r *VBtnBuilder) {
  163. b.tag.Attr("tag", v)
  164. return b
  165. }
  166. func (b *VBtnBuilder) Target(v string) (r *VBtnBuilder) {
  167. b.tag.Attr("target", v)
  168. return b
  169. }
  170. func (b *VBtnBuilder) Text(v bool) (r *VBtnBuilder) {
  171. b.tag.Attr(":text", fmt.Sprint(v))
  172. return b
  173. }
  174. func (b *VBtnBuilder) Tile(v bool) (r *VBtnBuilder) {
  175. b.tag.Attr(":tile", fmt.Sprint(v))
  176. return b
  177. }
  178. func (b *VBtnBuilder) To(v interface{}) (r *VBtnBuilder) {
  179. b.tag.Attr(":to", h.JSONString(v))
  180. return b
  181. }
  182. func (b *VBtnBuilder) Top(v bool) (r *VBtnBuilder) {
  183. b.tag.Attr(":top", fmt.Sprint(v))
  184. return b
  185. }
  186. func (b *VBtnBuilder) Type(v string) (r *VBtnBuilder) {
  187. b.tag.Attr("type", v)
  188. return b
  189. }
  190. func (b *VBtnBuilder) Value(v interface{}) (r *VBtnBuilder) {
  191. b.tag.Attr(":value", h.JSONString(v))
  192. return b
  193. }
  194. func (b *VBtnBuilder) Width(v int) (r *VBtnBuilder) {
  195. b.tag.Attr(":width", fmt.Sprint(v))
  196. return b
  197. }
  198. func (b *VBtnBuilder) XLarge(v bool) (r *VBtnBuilder) {
  199. b.tag.Attr(":x-large", fmt.Sprint(v))
  200. return b
  201. }
  202. func (b *VBtnBuilder) XSmall(v bool) (r *VBtnBuilder) {
  203. b.tag.Attr(":x-small", fmt.Sprint(v))
  204. return b
  205. }
  206. func (b *VBtnBuilder) SetAttr(k string, v interface{}) {
  207. b.tag.SetAttr(k, v)
  208. }
  209. func (b *VBtnBuilder) Attr(vs ...interface{}) (r *VBtnBuilder) {
  210. b.tag.Attr(vs...)
  211. return b
  212. }
  213. func (b *VBtnBuilder) Children(children ...h.HTMLComponent) (r *VBtnBuilder) {
  214. b.tag.Children(children...)
  215. return b
  216. }
  217. func (b *VBtnBuilder) AppendChildren(children ...h.HTMLComponent) (r *VBtnBuilder) {
  218. b.tag.AppendChildren(children...)
  219. return b
  220. }
  221. func (b *VBtnBuilder) PrependChildren(children ...h.HTMLComponent) (r *VBtnBuilder) {
  222. b.tag.PrependChildren(children...)
  223. return b
  224. }
  225. func (b *VBtnBuilder) Class(names ...string) (r *VBtnBuilder) {
  226. b.tag.Class(names...)
  227. return b
  228. }
  229. func (b *VBtnBuilder) ClassIf(name string, add bool) (r *VBtnBuilder) {
  230. b.tag.ClassIf(name, add)
  231. return b
  232. }
  233. func (b *VBtnBuilder) On(name string, value string) (r *VBtnBuilder) {
  234. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  235. return b
  236. }
  237. func (b *VBtnBuilder) Bind(name string, value string) (r *VBtnBuilder) {
  238. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  239. return b
  240. }
  241. func (b *VBtnBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  242. return b.tag.MarshalHTML(ctx)
  243. }