-
-
Notifications
You must be signed in to change notification settings - Fork 268
Expand file tree
/
Copy pathBitColorPickerDemo.razor
More file actions
92 lines (85 loc) · 4.32 KB
/
BitColorPickerDemo.razor
File metadata and controls
92 lines (85 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
@page "/components/colorpicker"
@page "/components/color-picker"
<PageOutlet Url="components/colorpicker"
Title="ColorPicker"
Description="colorpicker component of the bit BlazorUI components" />
<DemoPage Name="ColorPicker"
Description="The color picker (ColorPicker) is used to browse through and select colors. By default, it lets people navigate through colors on a color spectrum, or specify a color in either Red-Green-Blue (RGB), or alpha color code; or Hexadecimal textboxes."
Parameters="componentParameters"
SubClasses="componentSubClasses"
GitHubUrl="Inputs/ColorPicker/BitColorPicker.razor"
GitHubDemoUrl="Inputs/ColorPicker/BitColorPickerDemo.razor">
<DemoExample Title="Basic" RazorCode="@example1RazorCode" Id="example1">
<div class="example-content">
<BitColorPicker />
</div>
</DemoExample>
<DemoExample Title="Alpha & Preview" RazorCode="@example2RazorCode" Id="example2">
<div>Use alpha slider and preview option in the BitColorPicker, allowing to adjust the transparency of the color and preview the result.</div>
<br /><br />
<div class="example-content">
<BitColorPicker ShowAlphaSlider ShowPreview />
</div>
</DemoExample>
<DemoExample Title="Binding" RazorCode="@example3RazorCode" CsharpCode="@example3CsharpCode" Id="example3">
<div>
The color type (hex or rgb) of the BitColorPicker automatically matches the initial value of the Color parameter.
For example, if the initial value of this parameter is in hex format, the component will return the resulting colors in hex and vice versa.
</div>
<br /><br />
<div class="example-content">
<div>RGB:</div>
<br />
<BitColorPicker @bind-Color="rgbColor" />
<div>Color: @rgbColor</div>
<br /><br /><br />
<div>HEX:</div>
<br />
<BitColorPicker @bind-Color="hexColor" />
<div>Color: @hexColor</div>
<br /><br /><br />
<div>Two-way binding:</div>
<br />
<BitColorPicker @bind-Color="twoWayColor" ShowAlphaSlider ShowPreview />
<BitTextField Label="Enter Color (Hex or Rgb)" @bind-Value="twoWayColor" Style="width: 200px;" />
</div>
</DemoExample>
<DemoExample Title="Events" RazorCode="@example4RazorCode" CsharpCode="@example4CsharpCode" Id="example4">
<div>Handle color change events in the BitColorPicker. This example shows how to capture the selected color and its alpha value when the user makes a selection.</div>
<br /><br />
<div class="example-content">
<div>OnChange:</div>
<br />
<BitColorPicker OnChange="v => (changedColor, changedAlpha) = v" ShowAlphaSlider />
<br />
<div>Color: @changedColor</div>
<div>Alpha: @changedAlpha</div>
</div>
</DemoExample>
<DemoExample Title="Public API" RazorCode="@example5RazorCode" CsharpCode="@example5CsharpCode" Id="example5">
<div>Explore the public API of the BitColorPicker component, including how to access different color formats such as Hex, RGB, RGBA, and HSV using component references.</div>
<br /><br />
<div class="example-content">
<BitColorPicker @ref="colorPickerRef" @bind-Color="boundColor" ShowAlphaSlider ShowPreview />
<br />
<div>Color: @boundColor</div>
<div>Hex: @colorPickerRef?.Hex</div>
<div>Rgb: @colorPickerRef?.Rgb</div>
<div>Rgba: @colorPickerRef?.Rgba</div>
<div>Hsv: @colorPickerRef?.Hsv</div>
</div>
</DemoExample>
<DemoExample Title="Style & Class" RazorCode="@example6RazorCode" Id="example6">
<div>Apply custom CSS classes and styles to the BitColorPicker component for tailoring its appearance to fit your design needs.</div>
<br /><br />
<div class="example-content">
<div>Style</div>
<br />
<BitColorPicker ShowAlphaSlider Style="width: 230px; height: 150px;" />
<br /><br /><br />
<div>Class</div>
<br />
<BitColorPicker ShowAlphaSlider Class="custom-class" />
</div>
</DemoExample>
</DemoPage>