radio.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VRadioBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VRadio(children ...h.HTMLComponent) (r *VRadioBuilder) {
  11. r = &VRadioBuilder{
  12. tag: h.Tag("v-radio").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VRadioBuilder) ActiveClass(v string) (r *VRadioBuilder) {
  17. b.tag.Attr("active-class", v)
  18. return b
  19. }
  20. func (b *VRadioBuilder) Color(v string) (r *VRadioBuilder) {
  21. b.tag.Attr("color", v)
  22. return b
  23. }
  24. func (b *VRadioBuilder) Dark(v bool) (r *VRadioBuilder) {
  25. b.tag.Attr(":dark", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VRadioBuilder) Disabled(v bool) (r *VRadioBuilder) {
  29. b.tag.Attr(":disabled", fmt.Sprint(v))
  30. return b
  31. }
  32. func (b *VRadioBuilder) Id(v string) (r *VRadioBuilder) {
  33. b.tag.Attr("id", v)
  34. return b
  35. }
  36. func (b *VRadioBuilder) Label(v string) (r *VRadioBuilder) {
  37. b.tag.Attr("label", v)
  38. return b
  39. }
  40. func (b *VRadioBuilder) Light(v bool) (r *VRadioBuilder) {
  41. b.tag.Attr(":light", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VRadioBuilder) Name(v string) (r *VRadioBuilder) {
  45. b.tag.Attr("name", v)
  46. return b
  47. }
  48. func (b *VRadioBuilder) OffIcon(v string) (r *VRadioBuilder) {
  49. b.tag.Attr("off-icon", v)
  50. return b
  51. }
  52. func (b *VRadioBuilder) OnIcon(v string) (r *VRadioBuilder) {
  53. b.tag.Attr("on-icon", v)
  54. return b
  55. }
  56. func (b *VRadioBuilder) Readonly(v bool) (r *VRadioBuilder) {
  57. b.tag.Attr(":readonly", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VRadioBuilder) Ripple(v interface{}) (r *VRadioBuilder) {
  61. b.tag.Attr(":ripple", h.JSONString(v))
  62. return b
  63. }
  64. func (b *VRadioBuilder) Value(v interface{}) (r *VRadioBuilder) {
  65. b.tag.Attr(":value", h.JSONString(v))
  66. return b
  67. }
  68. func (b *VRadioBuilder) SetAttr(k string, v interface{}) {
  69. b.tag.SetAttr(k, v)
  70. }
  71. func (b *VRadioBuilder) Attr(vs ...interface{}) (r *VRadioBuilder) {
  72. b.tag.Attr(vs...)
  73. return b
  74. }
  75. func (b *VRadioBuilder) Children(children ...h.HTMLComponent) (r *VRadioBuilder) {
  76. b.tag.Children(children...)
  77. return b
  78. }
  79. func (b *VRadioBuilder) AppendChildren(children ...h.HTMLComponent) (r *VRadioBuilder) {
  80. b.tag.AppendChildren(children...)
  81. return b
  82. }
  83. func (b *VRadioBuilder) PrependChildren(children ...h.HTMLComponent) (r *VRadioBuilder) {
  84. b.tag.PrependChildren(children...)
  85. return b
  86. }
  87. func (b *VRadioBuilder) Class(names ...string) (r *VRadioBuilder) {
  88. b.tag.Class(names...)
  89. return b
  90. }
  91. func (b *VRadioBuilder) ClassIf(name string, add bool) (r *VRadioBuilder) {
  92. b.tag.ClassIf(name, add)
  93. return b
  94. }
  95. func (b *VRadioBuilder) On(name string, value string) (r *VRadioBuilder) {
  96. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  97. return b
  98. }
  99. func (b *VRadioBuilder) Bind(name string, value string) (r *VRadioBuilder) {
  100. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  101. return b
  102. }
  103. func (b *VRadioBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  104. return b.tag.MarshalHTML(ctx)
  105. }