Skip to content

Commit 09028a2

Browse files
dimodintachevayordan-mitev
authored
[4.1] docs(maskedtextbox): Add InputMode parameter and polish Overview (#1323)
* docs(maskedtextbox): Add InputMode parameter and polush Overview * Update components/maskedtextbox/overview.md Co-authored-by: Nadezhda Tacheva <[email protected]> * Update components/maskedtextbox/overview.md Co-authored-by: Yordan <[email protected]> * Update components/maskedtextbox/overview.md Co-authored-by: Yordan <[email protected]> * Update components/maskedtextbox/overview.md Co-authored-by: Yordan <[email protected]> * Update components/maskedtextbox/overview.md Co-authored-by: Yordan <[email protected]> * Update components/maskedtextbox/overview.md Co-authored-by: Yordan <[email protected]> * docs(maskedtextbox): polishing --------- Co-authored-by: Nadezhda Tacheva <[email protected]> Co-authored-by: Yordan <[email protected]>
1 parent 2d381d3 commit 09028a2

File tree

4 files changed

+82
-46
lines changed

4 files changed

+82
-46
lines changed

components/dateinput/overview.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ The following section lists some Date Input parameters and links to other pages
8989

9090
| Parameter | Type and Default Value | Description |
9191
|---|---|---|
92-
| `AriaDescribedBy` | `string` | The [`aria-describedby` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) if the `input`. |
93-
| `AriaLabel` | `string` | The [`aria-label` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) if the `input`. |
94-
| `AriaLabelledBy` | `string` | The [`aria-labelledby` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) if the `input`. |
92+
| `AriaDescribedBy` | `string` | The [`aria-describedby` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) of the `input`. |
93+
| `AriaLabel` | `string` | The [`aria-label` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) of the `input`. |
94+
| `AriaLabelledBy` | `string` | The [`aria-labelledby` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) of the `input`. |
9595
| `AutoComplete` | `string` | The [`autocomplete` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) of the `input`. |
9696
| `DebounceDelay` | `int` <br/> (`150`) | The time in milliseconds between the last typed symbol and the value update. Use it to balance between client-side performance and number of database queries. |
9797
| `Enabled` | `bool` | Defines if the Date Input is enabled and accepts new values. |
-834 Bytes
Binary file not shown.

components/maskedtextbox/overview.md

Lines changed: 78 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,71 +10,106 @@ position: 0
1010

1111
# Blazor MaskedTextbox Overview
1212

13-
The <a href = "https://www.telerik.com/blazor-ui/maskedtextbox" target="_blank">Blazor Masked Textbox component</a> provides a mask and prompts the user to enter the data in the required format, and it prevents input that does not match the mask. You can use it to show the user the format the need to write things like phone numbers, credit card numbers, ZIP codes, IP addresses, percentage values and so on.
13+
The <a href = "https://www.telerik.com/blazor-ui/maskedtextbox" target="_blank">Blazor MaskedTextbox component</a> provides a mask and prompts the user to enter the data in the required format. The component prevents input that does not match the mask. Use it to show the user the required format for values like phone numbers, credit card numbers, ZIP codes, IP addresses, percentage values, and so on.
1414

15-
You can also add a custom CSS class or control various attributes of the `input` element such as the `name`, `placeholder`, `tabindex`, and [more](#features), and also respond to [events]({%slug maskedtextbox-events%}).
15+
You can also add standard attributes such as custom CSS classes, `name`, `placeholder`, `tabindex`, and [more](#maskedtextbox-parameters), and also respond to [events]({%slug maskedtextbox-events%}).
1616

17-
## Creating MaskedTextBox
17+
## Creating Blazor MaskedTextBox
1818

19-
To use a Telerik MaskedTextbox for Blazor:
2019

2120
1. Add the `<TelerikMaskedTextBox>` tag to your razor page.
22-
1. Set its `Value` to the `string` you want to get out of it.
23-
1. Provide the desired [`Mask`]({%slug maskedtextbox-mask-prompt%}) to prompt the user.
21+
1. Set its `Value` parameter to a `string`. The parameter supports two-way binding.
22+
1. Set the desired [`Mask`]({%slug maskedtextbox-mask-prompt%}) to prompt the user.
2423

25-
>caption Basic masked textbox with two-way value binding and a credit card mask
24+
>caption Basic MaskedTextBox with two-way Value binding and a credit card mask
2625
2726
````CSHTML
28-
@TheValue
29-
<br />
27+
<TelerikMaskedTextBox @bind-Value="@MaskedValue"
28+
Mask="0000-0000-0000-0000"
29+
Width="300px" />
3030
31-
<TelerikMaskedTextBox Mask="0000-0000-0000-0000"
32-
@bind-Value="@TheValue">
33-
</TelerikMaskedTextBox>
31+
<br /><br />
32+
The component value is: @MaskedValue
3433
3534
@code{
36-
string TheValue { get; set; }
35+
private string MaskedValue { get; set; }
3736
}
3837
````
3938

40-
>caption The result from the code snippet above before you start writing
39+
## Validation
40+
41+
You can validate the content of the `TelerikMaskedTextBox` using the Data Annotation attributes. [See the Input Validation article for an example on how to validate the content of the MaskedTextBox]({%slug common-features/input-validation%}#maskedtextbox).
4142

42-
![Masked Textbox first look](images/masked-textbox-first-look.png)
43+
## Events
4344

45+
The [MaskedTextBox component fires events for value changes and blur]({%slug maskedtextbox-events%}). Use them to respond to user actions.
4446

4547
## Mask-Related Parameters
4648

47-
The table below provides a quick overview of the mask-related parameters. You can see the [Mask and Prompt article for additional details.]({%slug maskedtextbox-mask-prompt%})
49+
The table below provides a quick overview of the mask-related parameters. See the [Mask and Prompt article]({%slug maskedtextbox-mask-prompt%}) for additional details.
4850

4951
@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)
5052

5153
| Parameter | Type and Default value | Description |
52-
|-----------|------------------------|-------------|
53-
| `IncludeLiterals` | `bool` | Controls if the literal characters from the mask (those characters that don't carry a special meaning such as brackets or dashes) are included in the `Value`. |
54-
| `Mask` | `string` | Defines the mask (pattern) that the user has to follow. |
55-
| `MaskOnFocus` | `bool` | Controls if the mask will be shown to the user only while the input is focused. When set to `true`, the user will see the [FloatingLabel]({%slug floatinglabel-overview%}) (if used) or `Placeholder` (if present) instead of the mask in case the textbox is empty. When there is some value in the input, the mask and input will be shown. |
56-
| `Prompt` | `char` <br /> `_` | Defines the prompt character the user will see in the mask where there is no user value already. |
57-
| `PromptPlaceholder` | `char?` <br /> ` ` (empty space) | Defines the character that is added to the raw `Value` for places where there is no user input yet. |
54+
|---|---|---|
55+
| `IncludeLiterals` | `bool` | Controls if the literal characters from the mask are included in the `Value`. These are the characters that don't carry a special meaning such as brackets or dashes. |
56+
| `Mask` | `string` | The mask (pattern) that the user has to follow. |
57+
| `MaskOnFocus` | `bool` | Controls if the mask appears only while the input is focused. When `true` and no value is set, the user sees the [FloatingLabel]({%slug floatinglabel-overview%}) or `Placeholder` instead of the mask. When a value is set, the user sees both the mask and value. |
58+
| `Prompt` | `char` <br /> (`_`) | The character that will show in the mask where there is no user input already. |
59+
| `PromptPlaceholder` | `char?` <br /> (` ` space) | The character that is added to the raw `Value` for places where there is no user input yet. |
5860

5961
## MaskedTextBox Parameters
6062

63+
See the [MaskedTextBox API Reference](/blazor-ui/api/Telerik.Blazor.Components.TelerikMaskedTextBox) for a full list of parameters, methods and events.
64+
6165
| Parameter | Type and Default value | Description |
62-
|-----------|------------------------|-------------|
63-
| `Class` | `string` | Adds a custom CSS class to the `<div class="k-maskedtextbox">` element. |
64-
| `Width` | `string` | Controls the width of the `<input>` element. |
65-
| `DebounceDelay` | `int` <br /> (`150`) | Specifies the time in milliseconds between the last typed symbol and the updating of the value. |
66-
| `Enabled` | `bool` <br /> (`true`) | Controls if the users can type in the component. |
67-
| `Id` | `string` | Renders as the `id` attribute on the `<input />` element, so you can attach a `<label for="">` to the input |
68-
| `Name` | `string` | Renders as the `name` attribute of the HTML element. |
69-
| `Placeholder` | `string` | Renders as the `placeholder` attribute of the HTML element. |
70-
| `TabIndex` | `int` | Maps to the `tabindex` attribute of the HTML element. You can use it to customize the order in which the inputs in your form focus with the `Tab` key. |
71-
| `Title` | `string` | Maps to the `title` attribute of the HTML element. You can use it to add a [tooltip]({%slug tooltip-overview%}). |
72-
| `ValidateOn` | `ValidationEvent` enum <br /> (`Input`) | configures the event that will trigger validation (if validation is enabled). See the [Validation Modes for Simple Inputs]({%slug common-features/input-validation%}#validation-modes-for-simple-inputs) article for more information. |
73-
| `Value` | `string` | Get/set the value of the input, can be used for binding. |
66+
|---|---|---|
67+
| `AriaDescribedBy` | `string` | The [`aria-describedby` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) of the `input`. |
68+
| `AriaLabel` | `string` | The [`aria-label` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) of the `input`. |
69+
| `AriaLabelledBy` | `string` | The [`aria-labelledby` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) of the `input`. |
70+
| `DebounceDelay` | `int` <br /> (`150`) | The time in milliseconds between the last typed symbol and the value update. |
71+
| `Enabled` | `bool` <br /> (`true`) | Controls if users can type in the component. |
72+
| `Id` | `string` | The `id` attribute of the `input`. |
73+
| `InputMode` | `string` | The [`inputmode` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) of the `<input />` element. |
74+
| `Name` | `string` | The `name` attribute of the `input`. |
75+
| `Placeholder` | `string` | The `placeholder` attribute of the HTML element. |
76+
| `TabIndex` | `int` | The `tabindex` attribute of the `input`. |
77+
| `Title` | `string` | The `title` attribute of `input`. Use it to add a [tooltip]({%slug tooltip-overview%}). |
78+
| `ValidateOn` | `ValidationEvent` enum <br /> (`Input`) | The event that will trigger validation (if validation is enabled). See [Validation Modes for Simple Inputs]({%slug common-features/input-validation%}#validation-modes-for-simple-inputs). |
79+
| `Value` | `string` | The value of the component. Supports two-way binding. |
80+
81+
### Styling and Appearance
7482

75-
## Validation
83+
| Parameter | Type and Default value | Description |
84+
|---|---|---|
85+
| `Class` | `string` | The custom CSS class of the `<span class="k-maskedtextbox">` element. |
86+
| `Width` | `string` | The component width. |
87+
88+
Find more parameters to customize the masked textbox styling in the [Appearance article]({%slug maskedtextbox-appearance%}).
89+
90+
## MaskedTextBox Reference and Methods
7691

77-
You can validate the content of the `TelerikMaskedTextBox` using the Data Annotation attributes. [See the Input Validation article for an example on how to validate the content of the MaskedTextBox]({%slug common-features/input-validation%}#maskedtextbox)
92+
The MaskedTextBox proves a `FocusAsync` method that enables programmatic focus. To use it, obtain reference to the component instance.
93+
94+
````CSHTML
95+
<TelerikButton OnClick="@FocusTextBox">Focus TextBox</TelerikButton>
96+
97+
<TelerikMaskedTextBox @ref="@MaskedTextBoxRef"
98+
@bind-Value="@MaskedValue"
99+
Mask="0000-0000-0000-0000"
100+
Width="300px" />
101+
102+
@code{
103+
private TelerikMaskedTextBox MaskedTextBoxRef { get; set; }
104+
105+
private string MaskedValue { get; set; }
106+
107+
private async Task FocusTextBox()
108+
{
109+
await MaskedTextBoxRef.FocusAsync();
110+
}
111+
}
112+
````
78113

79114
## Mask Examples
80115

@@ -183,12 +218,13 @@ The examples below demonstrates how to create a few [masks]({%slug maskedtextbox
183218

184219
## Next Steps
185220

186-
* [Explore the behavior of the MaskedTextBox when pasting content]({%slug maskedtextbox-paste%})
187-
* [Learn more about the MaskedTextBox events]({%slug maskedtextbox-events%})
221+
* [Configure the MaskedTextBox mask]({%slug maskedtextbox-mask-prompt%})
222+
* [Explore the MaskedTextBox behavior when pasting content]({%slug maskedtextbox-paste%})
223+
* [Handle MaskedTextBox events]({%slug maskedtextbox-events%})
188224

189225
## See Also
190226

191-
* [Live Demo: MaskedTextbox](https://demos.telerik.com/blazor-ui/maskedtextbox/overview)
192-
* [Live Demo: MaskedTextbox Validation](https://demos.telerik.com/blazor-ui/maskedtextbox/validation)
193-
* [Add Floating Label]({%slug inputs-kb-floating-label%})
194-
* [API Reference](https://docs.telerik.com/blazor-ui/api/Telerik.Blazor.Components.TelerikMaskedTextBox)
227+
* [Live Demo: MaskedTextbox](https://demos.telerik.com/blazor-ui/maskedtextbox/overview)
228+
* [Live Demo: MaskedTextbox Validation](https://demos.telerik.com/blazor-ui/maskedtextbox/validation)
229+
* [Add Floating Label]({%slug inputs-kb-floating-label%})
230+
* [API Reference](https://docs.telerik.com/blazor-ui/api/Telerik.Blazor.Components.TelerikMaskedTextBox)

components/numerictextbox/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The Blazor Numeric TextBox allows you to define your desired custom format throu
8484
| `Decimals` | `int` | The number of allowed decimal places during typing. Takes effect only while the input is focused. The default value depends on the culture. |
8585
| `Format` | `string` | The number format when the input is not focused. Read more at [Standard Numeric Format Strings in .NET](https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings) |
8686
| `Id` | `string` | The `id` attribute on the `<input />` element. |
87-
| `InputMode` | `string` | The [`inputmode` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) on the `<input />` element. |
87+
| `InputMode` | `string` | The [`inputmode` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) of the `<input />` element. |
8888
| `Max` | numeric type | The maximum value the input can accept. Must match the `Value` type. |
8989
| `Min` | numeric type | The minimum value the input can accept. Must match the `Value` type. |
9090
| `Placeholder` | `string` | The `placeholder` attribute of the HTML element. The placeholder will appear if the component is bound to a **nullable** value type and there is no value set. |

0 commit comments

Comments
 (0)