feat: add TextInputBuilder

This commit is contained in:
Siwoo Jeon 2025-05-27 20:43:08 +09:00
parent 83a8bfa438
commit fd76911e9f
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA

View file

@ -241,3 +241,56 @@ func (c *ComponentEmoji) SetAnimated(animated bool) *ComponentEmoji {
c.Animated = animated c.Animated = animated
return c return c
} }
// TextInputBuilder creates a new TextInput struct.
func TextInputBuilder() *TextInput {
return &TextInput{}
}
// SetCustomID sets customID for TextInput.
func (t *TextInput) SetCustomID(customID string) *TextInput {
t.CustomID = customID
return t
}
// SetStyle sets style for TextInput.
func (t *TextInput) SetStyle(style TextInputStyle) *TextInput {
t.Style = style
return t
}
// SetLabel sets label for TextInput.
func (t *TextInput) SetLabel(label string) *TextInput {
t.Label = label
return t
}
// SetMinLength sets min length for TextInput.
func (t *TextInput) SetMinLength(minLength int) *TextInput {
t.MinLength = minLength
return t
}
// SetMaxLength sets max length for TextInput.
func (t *TextInput) SetMaxLength(maxLength int) *TextInput {
t.MaxLength = maxLength
return t
}
// SetRequired sets required for TextInput.
func (t *TextInput) SetRequired(required bool) *TextInput {
t.Required = required
return t
}
// SetValue sets value for TextInput.
func (t *TextInput) SetValue(value string) *TextInput {
t.Value = value
return t
}
// SetPlaceholder sets placeholder for TextInput.
func (t *TextInput) SetPlaceholder(placeholder string) *TextInput {
t.Placeholder = placeholder
return t
}