Files
Almighty-Shogun 7d8911bfed Fixed documentation typo's (#2127)
* Fixed typo at line 39

On this code example for the documentation there was a typo on the README.md file at line 39. There was an `;` where there should not be one.

The code that had the typo:

```cs
var tb = new TextInputBuilder()
    .WithLabel("Labeled")
    .WithCustomId("text_input")
    .WithStyle(TextInputStyle.Paragraph)
    .WithMinLength(6); // This ";" does not belong here.
    .WithMaxLength(42)
    .WithRequired(true)
    .WithPlaceholder("Consider this place held.");
```

* Changed `ExecuteAsync` to `ExecuteCommandAsync`

`_interactionService.ExecuteAsync(ctx, serviceProvider);` cannot be executed because the method `ExecuteAsync` does not exists.

* Changed `componBuild()` to `components.Build()`
2022-03-02 15:07:15 -04:00

1.2 KiB

uid, title
uid title
Guides.MessageComponents.TextInputs Text Input Components

Text Input Components

Warning

Text input components can only be used in modals.

Text input components are a type of MessageComponents that can only be used in modals. Texts inputs can be longer (the Paragraph) style or shorter (the Short style). Text inputs have a variable min and max length.

A modal with short and paragraph text inputs

Creating text inputs

Text input components can be built using the TextInputBuilder. The simplest text input can built with:

var tb = new TextInputBuilder()
    .WithLabel("My Text")
    .WithCustomId("text_input");

and would produce a component that looks like:

basic text input component

Additional options can be specified to control the placeholder, style, and min/max length of the input:

var tb = new TextInputBuilder()
    .WithLabel("Labeled")
    .WithCustomId("text_input")
    .WithStyle(TextInputStyle.Paragraph)
    .WithMinLength(6)
    .WithMaxLength(42)
    .WithRequired(true)
    .WithPlaceholder("Consider this place held.");

more advanced text input