|
| 1 | +--- |
| 2 | +title: ColorPicker |
| 3 | +page_title: ColorPicker | Telerik UI for ASP.NET Core Tag Helpers |
| 4 | +description: "Learn the basics when working with the ColorPicker tag helper for ASP.NET Core (MVC 6 or ASP.NET Core MVC)." |
| 5 | +previous_url: /aspnet-core/helpers/colorpicker |
| 6 | +slug: taghelpers_colorpicker_aspnetcore |
| 7 | +--- |
| 8 | + |
| 9 | +# ColorPicker Tag Helper Overview |
| 10 | + |
| 11 | +The ColorPicker tag helper helps you configure the Kendo UI ColorPicker widget in ASP.NET Core applications. |
| 12 | + |
| 13 | +## Basic Usage |
| 14 | + |
| 15 | +The following example demonstrates how to define the ColorPicker by using the ColorPicker tag helper. |
| 16 | + |
| 17 | +###### Example |
| 18 | + |
| 19 | + <kendo-colorpicker name="picker"> |
| 20 | + <messages apply="Change" cancel="Close" /> |
| 21 | + </kendo-colorpicker> |
| 22 | + |
| 23 | +## Configuration |
| 24 | + |
| 25 | +The ColorPicker tag helper configuration options are passed as attributes of the tag and through nested tags (`<messages>`). |
| 26 | + |
| 27 | +###### Example |
| 28 | + |
| 29 | +```tab-cshtml |
| 30 | +
|
| 31 | + @(Html.Kendo().ColorPicker() |
| 32 | + .Name("picker") |
| 33 | + .Value("#fff") |
| 34 | + .Messages(m => m.Apply("Change").Cancel("Close")) |
| 35 | + .Events(events => events.Select("preview")) |
| 36 | + ) |
| 37 | +``` |
| 38 | +```tab-tagHelper |
| 39 | +
|
| 40 | + <kendo-colorpicker name="picker" value="#fff" on-select="preview"> |
| 41 | + <messages apply="Change" cancel="Close" /> |
| 42 | + </kendo-colorpicker> |
| 43 | +``` |
| 44 | + |
| 45 | +The ColorPalette tag helper configuration options are passed as attributes of the tag and through nested tags (`<tile-size>`). |
| 46 | + |
| 47 | +###### Example |
| 48 | + |
| 49 | +```tab-cshtml |
| 50 | +
|
| 51 | + @(Html.Kendo().ColorPalette() |
| 52 | + .Name("palette") |
| 53 | + .Columns(4) |
| 54 | + .TileSize(s => s.Width(34).Height(19)) |
| 55 | + .Palette(new string[] { |
| 56 | + "#f0d0c9", "#e2a293", "#d4735e", "#65281a", |
| 57 | + "#eddfda", "#dcc0b6", "#cba092", "#7b4b3a", |
| 58 | + "#fcecd5", "#f9d9ab", "#f6c781", "#c87d0e", |
| 59 | + "#e1dca5", "#d0c974", "#a29a36", "#514d1b", |
| 60 | + "#c6d9f0", "#8db3e2", "#548dd4", "#17365d" |
| 61 | + }) |
| 62 | + .Events(events => events.Change("preview")) |
| 63 | + ) |
| 64 | +``` |
| 65 | +```tab-tagHelper |
| 66 | +
|
| 67 | + @{ |
| 68 | + string[] colorPickerPalette = new string[] { |
| 69 | + "#f0d0c9", "#e2a293", "#d4735e", "#65281a", |
| 70 | + "#eddfda", "#dcc0b6", "#cba092", "#7b4b3a", |
| 71 | + "#fcecd5", "#f9d9ab", "#f6c781", "#c87d0e", |
| 72 | + "#e1dca5", "#d0c974", "#a29a36", "#514d1b", |
| 73 | + "#c6d9f0", "#8db3e2", "#548dd4", "#17365d" |
| 74 | + }; |
| 75 | + } |
| 76 | + <kendo-colorpalette name="palette" columns="4" on-change="preview" palette-colors="colorPickerPalette"> |
| 77 | + <tile-size height="19" width="34" /> |
| 78 | + </kendo-colorpalette> |
| 79 | +``` |
| 80 | + |
| 81 | +## See Also |
| 82 | + |
| 83 | +* [Overview of Telerik UI for ASP.NET Core]({% slug overview_aspnetmvc6_aspnetmvc %}) |
| 84 | +* [Get Started with Telerik UI for ASP.NET Core in ASP.NET Core Projects]({% slug gettingstarted_aspnetmvc6_aspnetmvc %}) |
| 85 | +* [Get Started with Telerik UI for ASP.NET Core in ASP.NET Core Projects on Linux]({% slug gettingstartedlinux_aspnetmvc6_aspnetmvc %}) |
| 86 | +* [Known Issues with Telerik UI for ASP.NET Core]({% slug knownissues_aspnetmvc6_aspnetmvc %}) |
0 commit comments