Is there a way to customize the appearance of the color picker popup window? For example, can I add a text separator, or perhaps a tooltip to each tile in the color picker?
Thanks
Matt
1 Answer, 1 is accepted
0
Ivan Danchev
Telerik team
answered on 04 Dec 2020, 03:56 PM
Hello Matt,
Text separator is not available out-of-the-box, however, you can display a Tooltip over the tiles. Here's an example showing how:
@(Html.Kendo().ColorPicker()
.Name("picker1")
.Palette(new string[] { "#ddd1c3", "#d2d2d2", "#746153", "#3a4c8b", "#ffcc33", "#fb455f", "#ac120f" })
.Value("#ffcc33")
.TileSize(30)
.Events(ev => ev.Open("onOpen").Close("onClose"))
)
<script>functiononOpen(e) {
//initialize a Tooltip when the ColorPicker's dropdown opens
$(".k-colorpalette").kendoTooltip({
filter: "td",
content: function (e) {
var target = e.target; // the tile for which the tooltip is shownvar targetColor = $(target[0]).attr("aria-label"); // the tile hex color// return the hex color, which will be displayed as tooltip contentreturn targetColor;
}
});
}
functiononClose(e) {
var tooltip = $(".k-colorpalette").data("kendoTooltip");
//destroy the existing Tooltip instanceif (tooltip) {
tooltip.destroy();
}
}
</script>
Regards,
Ivan Danchev
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.