コード例 #1
0
 /// <summary>
 ///     Create a new <see cref="ModalTextInputAttribute"/>.
 /// </summary>
 /// <param name="customId"The custom id of the text input.></param>
 /// <param name="style">The style of the text input.</param>
 /// <param name="placeholder">The placeholder of the text input.</param>
 /// <param name="minLength">The minimum length of the text input's content.</param>
 /// <param name="maxLength">The maximum length of the text input's content.</param>
 /// <param name="initValue">The initial value to be displayed by this input.</param>
 public ModalTextInputAttribute(string customId, TextInputStyle style = TextInputStyle.Short, string placeholder = null, int minLength = 1, int maxLength = 4000, string initValue = null)
     : base(customId)
 {
     Style        = style;
     Placeholder  = placeholder;
     MinLength    = minLength;
     MaxLength    = maxLength;
     InitialValue = initValue;
 }
コード例 #2
0
 /// <summary>
 /// Constructs a new text input field.
 /// </summary>
 /// <param name="label">The label for the field, placed above the input itself.</param>
 /// <param name="customId">The ID of this field.</param>
 /// <param name="placeholder">Placeholder text for the field.</param>
 /// <param name="value">A pre-filled value for this field.</param>
 /// <param name="required">Whether this field is required.</param>
 /// <param name="style">The style of this field. A single-ling short, or multi-line paragraph.</param>
 /// <param name="min_length">The minimum input length.</param>
 /// <param name="max_length">The maximum input length. Must be greater than the minimum, if set.</param>
 public TextInputComponent(string label, string customId, string placeholder = null, string value = null, bool required = true, TextInputStyle style = TextInputStyle.Short, int min_length = 0, int?max_length = null)
 {
     this.CustomId      = customId;
     this.Type          = ComponentType.FormInput;
     this.Label         = label;
     this.Required      = required;
     this.Placeholder   = placeholder;
     this.MinimumLength = min_length;
     this.MaximumLength = max_length;
     this.Style         = style;
     this.Value         = value;
 }
コード例 #3
0
 internal TextInputComponent(string customId, string label, string placeholder, int?minLength, int?maxLength,
                             TextInputStyle style, bool?required, string value)
 {
     CustomId    = customId;
     Label       = label;
     Placeholder = placeholder;
     MinLength   = minLength;
     MaxLength   = maxLength;
     Style       = style;
     Required    = required;
     Value       = value;
 }
コード例 #4
0
 /// <summary>
 ///     Sets <see cref="Style"/>.
 /// </summary>
 /// <param name="style">New value of the <see cref="Style"/>.</param>
 /// <returns>
 ///     The builder instance.
 /// </returns>
 public TextInputComponentBuilder WithStyle(TextInputStyle style)
 {
     Style = style;
     return(this);
 }