Skip to content

Commit 485daa2

Browse files
committed
Update EnumInput docs and adjust sidebar positions
Updated `EnumInputDocumentation.razor` to refine descriptions by removing references to "colors" and "states." Adjusted `sidebar_position` for multiple input component documentation files to maintain proper ordering. Added a new `enum-input.mdx` file with comprehensive documentation for the `EnumInput` component, including parameters, methods, events, examples, and visual demonstrations. Linked to relevant demos for better usability.
1 parent 10695a6 commit 485daa2

File tree

10 files changed

+265
-10
lines changed

10 files changed

+265
-10
lines changed

BlazorBootstrap.Demo.RCL/Components/Pages/Form/EnumInput/EnumInputDocumentation.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107
@code {
108108
private const string pageUrl = RouteConstants.Demos_EnumInput_Documentation;
109109
private const string pageTitle = "Blazor EnumInput";
110-
private const string pageDescription = "The Blazor Bootstrap EnumInput component renders a dropdown list from an enumeration (enum), enabling users to select from a predefined set of options. It simplifies data entry by binding directly to enum types and supports customization with colors, sizes, and states.";
110+
private const string pageDescription = "The Blazor Bootstrap EnumInput component renders a dropdown list from an enumeration (enum), enabling users to select from a predefined set of options. It simplifies data entry by binding directly to enum types and supports customization with sizes.";
111111
private const string metaTitle = "Blazor EnumInput Component";
112-
private const string metaDescription = "The Blazor Bootstrap EnumInput component renders a dropdown list from an enumeration (enum), enabling users to select from a predefined set of options. It simplifies data entry by binding directly to enum types and supports customization with colors, sizes, and states.";
112+
private const string metaDescription = "The Blazor Bootstrap EnumInput component renders a dropdown list from an enumeration (enum), enabling users to select from a predefined set of options. It simplifies data entry by binding directly to enum types and supports customization with sizes.";
113113
private const string imageUrl = "https://i.imgur.com/1mVjqQv.png";
114114
}

docs/docs/04-forms/enum-input.mdx

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
---
2+
title: Blazor Enum Input Component
3+
description: The Blazor Bootstrap EnumInput component renders a dropdown list from an enumeration (enum), enabling users to select from a predefined set of options. It simplifies data entry by binding directly to enum types and supports customization with sizes.
4+
image: https://private-user-images.githubusercontent.com/2337067/517874250-8a624590-1dfc-470a-8f9d-7636851d6c95.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjM5MjAxNzEsIm5iZiI6MTc2MzkxOTg3MSwicGF0aCI6Ii8yMzM3MDY3LzUxNzg3NDI1MC04YTYyNDU5MC0xZGZjLTQ3MGEtOGY5ZC03NjM2ODUxZDZjOTUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MTEyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTExMjNUMTc0NDMxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmVlNDlmZDZkNGQ5ZWUxMjE5MGM3NmEzMzc2OTdhYzk0MjY4YTU3NTk5M2JmMGIxNDNkYjI0ZWYyM2UwMDA5YyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.hvU9-57w9n41vwE3eyy3ZcDPDYXbQ3p_JW1RmDmT-c8
5+
6+
sidebar_label: Enum Input
7+
sidebar_position: 5
8+
---
9+
10+
import CarbonAd from '/carbon-ad.mdx'
11+
12+
# Blazor Enum Input
13+
14+
The Blazor Bootstrap `EnumInput` component renders a dropdown list from an enumeration (enum), enabling users to select from a predefined set of options. It simplifies data entry by binding directly to enum types and supports customization with sizes.
15+
16+
<CarbonAd />
17+
18+
<img src="https://private-user-images.githubusercontent.com/2337067/517874250-8a624590-1dfc-470a-8f9d-7636851d6c95.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjM5MjAxNzEsIm5iZiI6MTc2MzkxOTg3MSwicGF0aCI6Ii8yMzM3MDY3LzUxNzg3NDI1MC04YTYyNDU5MC0xZGZjLTQ3MGEtOGY5ZC03NjM2ODUxZDZjOTUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MTEyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTExMjNUMTc0NDMxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmVlNDlmZDZkNGQ5ZWUxMjE5MGM3NmEzMzc2OTdhYzk0MjY4YTU3NTk5M2JmMGIxNDNkYjI0ZWYyM2UwMDA5YyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.hvU9-57w9n41vwE3eyy3ZcDPDYXbQ3p_JW1RmDmT-c8" alt="Blazor Bootstrap: Enum Input Component" />
19+
20+
## Parameters
21+
| Name | Type | Default | Required | Description | Added Version |
22+
|:--|:--|:--|:--|:--|:--|
23+
| Disabled | bool | false | | Gets or sets the disabled state. | 3.5.0 |
24+
| Size | `EnumInputSize` | `EnumInputSize.None` | | Gets or sets the size of the input. | 3.5.0 |
25+
| Text | string | null | | Gets or sets the display text. | 3.5.0 |
26+
| Value | string | 0 | ✔️ | Gets or sets the value. | 3.5.0 |
27+
28+
## Methods
29+
30+
| Name | Returns | Description | Added Version |
31+
|:--|:--|:--|:--|
32+
| Disable() | void | Disables the enum input. | 3.5.0 |
33+
| Enable() | void | Enables the enum input. | 3.5.0 |
34+
35+
## Events
36+
37+
| Name | Description | Added Version |
38+
|:--|:--|:--|
39+
| ValueChanged | This event fires when the `Value` property changes. | 3.5.0 |
40+
| TextChanged | This event fires when the `Text` property changes. | 3.5.0 |
41+
42+
## Examples
43+
44+
### How it works
45+
46+
The **EnumInput** component displays enum values in a dropdown, allowing users to select from a predefined set of options.
47+
48+
<img src="https://private-user-images.githubusercontent.com/2337067/517874250-8a624590-1dfc-470a-8f9d-7636851d6c95.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjM5MjAxNzEsIm5iZiI6MTc2MzkxOTg3MSwicGF0aCI6Ii8yMzM3MDY3LzUxNzg3NDI1MC04YTYyNDU5MC0xZGZjLTQ3MGEtOGY5ZC03NjM2ODUxZDZjOTUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MTEyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTExMjNUMTc0NDMxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmVlNDlmZDZkNGQ5ZWUxMjE5MGM3NmEzMzc2OTdhYzk0MjY4YTU3NTk5M2JmMGIxNDNkYjI0ZWYyM2UwMDA5YyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.hvU9-57w9n41vwE3eyy3ZcDPDYXbQ3p_JW1RmDmT-c8" alt="Blazor Bootstrap Enum Input Component - How it works" />
49+
50+
```cshtml {} showLineNumbers
51+
<EnumInput TEnum="Status" @bind-Value="@selectedStatusValue" />
52+
<div class="mb-3">Selected value: @selectedStatusValue</div>
53+
54+
<EnumInput TEnum="Status" @bind-Text="@selectedStatusText" />
55+
<div class="mb-3">Selected text: @selectedStatusText</div>
56+
```
57+
58+
```cs {} showLineNumbers
59+
@code {
60+
private int selectedStatusValue;
61+
private string? selectedStatusText;
62+
63+
override protected void OnInitialized()
64+
{
65+
selectedStatusValue = (int)Status.Pending;
66+
selectedStatusText = Status.Inactive.ToString();
67+
}
68+
69+
public enum Status
70+
{
71+
Active,
72+
Inactive,
73+
Pending
74+
}
75+
}
76+
```
77+
78+
[See demo here](https://demos.blazorbootstrap.com/form/enum-input#how-it-works)
79+
80+
### Sizes
81+
82+
The **EnumInput** component can be rendered in various sizes to fit different UI requirements.
83+
84+
<img src="https://private-user-images.githubusercontent.com/2337067/517874558-0486fa89-6607-4009-a392-2a5e9cfb2851.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjM5MjAzMzEsIm5iZiI6MTc2MzkyMDAzMSwicGF0aCI6Ii8yMzM3MDY3LzUxNzg3NDU1OC0wNDg2ZmE4OS02NjA3LTQwMDktYTM5Mi0yYTVlOWNmYjI4NTEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MTEyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTExMjNUMTc0NzExWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MmNkYTE1MjU0NGNiNDNjM2I3MjhjYmJiZmEyMWYzODIwNjYxMzU0NDA5ZTAxMzUzMTRkNTBiODRhMGM1ZDVkYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.hzjHoqRtQhQgUsPLph4jsLBidEoV8lFwpQHm6rU0zxg" alt="Blazor Bootstrap Enum Input Component - Sizes" />
85+
86+
```cshtml {} showLineNumbers
87+
<EnumInput TEnum="Status" Class="mb-3" @bind-Value="@value1" />
88+
<EnumInput TEnum="Status" Size="EnumInputSize.Small" Class="mb-3" @bind-Value="@value2" />
89+
<EnumInput TEnum="Status" Size="EnumInputSize.Normal" Class="mb-3" @bind-Value="@value3" />
90+
<EnumInput TEnum="Status" Size="EnumInputSize.Large" @bind-Value="@value5" />
91+
```
92+
93+
```cs {} showLineNumbers
94+
@code {
95+
private int value1 = (int)Status.Pending;
96+
private int value2 = (int)Status.Pending;
97+
private int value3 = (int)Status.Pending;
98+
private int value4 = (int)Status.Pending;
99+
private int value5 = (int)Status.Pending;
100+
101+
public enum Status
102+
{
103+
Active,
104+
Inactive,
105+
Pending
106+
}
107+
}
108+
```
109+
[See demo here](https://demos.blazorbootstrap.com/form/enum-input#sizes)
110+
111+
### Disabled
112+
113+
Use the `Disabled` parameter to disable the `EnumInput`.
114+
115+
<img src="https://private-user-images.githubusercontent.com/2337067/517874631-84a88a37-65c3-47c6-a0bc-38a9b9e80ca3.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjM5MjAzODQsIm5iZiI6MTc2MzkyMDA4NCwicGF0aCI6Ii8yMzM3MDY3LzUxNzg3NDYzMS04NGE4OGEzNy02NWMzLTQ3YzYtYTBiYy0zOGE5YjllODBjYTMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MTEyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTExMjNUMTc0ODA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTJiODI1ZmE4MDM4NTk5M2JjZDg2NmQ1NTMyYWIyZWVkMDk0YzA0MGE2ZDViMjU5NThmZTYwMjRhYTJiNmEzMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.p5asOW55KH7KJ1wCQ87dO_COzMQO8CSKkYMyeN-ZdgU" alt="Blazor Bootstrap Enum Input Component - Disable" />
116+
117+
```cshtml {} showLineNumbers
118+
<EnumInput TEnum="Status" @bind-Value="@value1" Disabled="true" />
119+
```
120+
121+
```cs {} showLineNumbers
122+
@code {
123+
private int value1 = (int)Status.Pending;
124+
125+
public enum Status
126+
{
127+
Active,
128+
Inactive,
129+
Pending
130+
}
131+
}
132+
```
133+
134+
[See demo here](https://demos.blazorbootstrap.com/form/enum-input#disabled)
135+
136+
### Events
137+
138+
The **EnumInput** component supports event callbacks for value and text changes, enabling custom logic when the selection changes.
139+
140+
**ValueChanged Event**
141+
142+
```cshtml {} showLineNumbers
143+
<EnumInput TEnum="Status" Class="mb-3" Value="@value1" ValueChanged="OnValueChanged" />
144+
<div>Selected value: @value1</div>
145+
```
146+
147+
```cs {} showLineNumbers
148+
@code {
149+
private int value1 = (int)Status.Pending;
150+
151+
private void OnValueChanged(int value)
152+
{
153+
value1 = value;
154+
155+
if (value == (int)Status.Active)
156+
{
157+
// Do something when the value is Active
158+
}
159+
else if (value == (int)Status.Inactive)
160+
{
161+
// Do something when the value is Inactive
162+
}
163+
else if (value == (int)Status.Pending)
164+
{
165+
// Do something when the value is Pending
166+
}
167+
}
168+
169+
public enum Status
170+
{
171+
Active,
172+
Inactive,
173+
Pending
174+
}
175+
}
176+
```
177+
178+
**TextChanged Event**
179+
180+
```cshtml {} showLineNumbers
181+
<EnumInput TEnum="Status" Class="mb-3" Text="@text1" TextChanged="OnTextChanged" />
182+
<div>Selected text: @text1</div>
183+
```
184+
185+
```cs {} showLineNumbers
186+
@code {
187+
private string text1 = Status.Pending.ToString();
188+
189+
private void OnTextChanged(string value)
190+
{
191+
text1 = value;
192+
193+
if (value == "Active")
194+
{
195+
// Do something when the text is "Active"
196+
}
197+
else if (value == "Inactive")
198+
{
199+
// Do something when the text is "Inactive"
200+
}
201+
else if (value == "Pending")
202+
{
203+
// Do something when the text is "Pending"
204+
}
205+
}
206+
207+
public enum Status
208+
{
209+
Active,
210+
Inactive,
211+
Pending
212+
}
213+
}
214+
```
215+
216+
[See demo here](https://demos.blazorbootstrap.com/form/enum-input#events)
217+
218+
### Methods
219+
220+
The **EnumInput** component can be enabled or disabled dynamically at runtime.
221+
222+
```cshtml {} showLineNumbers
223+
<EnumInput TEnum="Status" Class="mb-3" @bind-Value="@value1" Disabled="isDisabled" />
224+
225+
<Buttons Size="ButtonSize.Small" Class="mt-3">
226+
<Button Color="ButtonColor.Primary" @onclick="EnableInput">Enable</Button>
227+
<Button Color="ButtonColor.Danger" @onclick="DisableInput">Disable</Button>
228+
</Buttons>
229+
```
230+
231+
```cs {} showLineNumbers
232+
@code {
233+
private bool isDisabled = true;
234+
private int value1 = (int)Status.Pending;
235+
236+
private void EnableInput()
237+
{
238+
isDisabled = false;
239+
}
240+
241+
private void DisableInput()
242+
{
243+
isDisabled = true;
244+
}
245+
246+
public enum Status
247+
{
248+
Active,
249+
Inactive,
250+
Pending
251+
}
252+
}
253+
```
254+
255+
[See demo here](https://demos.blazorbootstrap.com/form/enum-input#methods)

docs/docs/04-forms/number-input.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Blazor Bootstrap `NumberInput` component is built around HTML input
44
image: https://i.imgur.com/iUNBkki.png
55

66
sidebar_label: Number Input
7-
sidebar_position: 5
7+
sidebar_position: 6
88
---
99

1010
import CarbonAd from '/carbon-ad.mdx'

docs/docs/04-forms/password-input.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The Blazor Bootstrap PasswordInput component is constructed using a
44
image: https://i.imgur.com/0k1C2XS.png
55

66
sidebar_label: Password Input
7-
sidebar_position: 6
7+
sidebar_position: 7
88
---
99

1010
import CarbonAd from '/carbon-ad.mdx'

docs/docs/04-forms/radio-input.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The Blazor Bootstrap RadioInput component is constructed using an H
44
image: https://i.imgur.com/8koE00q.png
55

66
sidebar_label: Radio Input
7-
sidebar_position: 7
7+
sidebar_position: 8
88
---
99

1010
import CarbonAd from '/carbon-ad.mdx'

docs/docs/04-forms/range-input.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Blazor Bootstrap `NumberInput` component is built around HTML input
44
image: https://i.imgur.com/rWDDHaf.png
55

66
sidebar_label: Range Input
7-
sidebar_position: 8
7+
sidebar_position: 9
88
---
99

1010
import CarbonAd from '/carbon-ad.mdx'

docs/docs/04-forms/switch.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Use the Blazor Bootstrap `Switch` component to show the consistent
44
image: https://i.imgur.com/ALKzreq.png
55

66
sidebar_label: Switch
7-
sidebar_position: 9
7+
sidebar_position: 10
88
---
99

1010
import CarbonAd from '/carbon-ad.mdx'

docs/docs/04-forms/text-input.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The Blazor Bootstrap TextInput component is constructed using an HT
44
image: https://i.imgur.com/N2VUHIn.png
55

66
sidebar_label: Text Input
7-
sidebar_position: 10
7+
sidebar_position: 11
88
---
99

1010
import CarbonAd from '/carbon-ad.mdx'

docs/docs/04-forms/textarea-input.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The Blazor Bootstrap TextAreaInput component provides a multi-line
44
image: https://i.imgur.com/aSVKMqv.png
55

66
sidebar_label: TextArea Input
7-
sidebar_position: 11
7+
sidebar_position: 12
88
---
99

1010
import CarbonAd from '/carbon-ad.mdx'

docs/docs/04-forms/time-input.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The Blazor Bootstrap `TimeInput` component is constructed using an
44
image: https://i.imgur.com/TlvjRlP.png
55

66
sidebar_label: Time Input
7-
sidebar_position: 12
7+
sidebar_position: 13
88
---
99

1010
import CarbonAd from '/carbon-ad.mdx'

0 commit comments

Comments
 (0)