ColorPicker Blazor API

ColorPicker Properties

NameTypeDefaultDescription
EditableboolfalseThis property allows editting of colors via the input inside the element's action section. Accepts values in all supported types. This property works when 'valueDisplayMode' is set to default or colorCode.
AutoCloseDelayint100Determines the delay before the opened drop down closes when dropDownOpenMode is set to 'auto'.
ApplyValueModeColorApplyValueModeColorApplyValueMode.InstantlySpecifies how the user applies the selected value. In 'instantly' mode the value is applied immediately when color is selected. In 'useButtons' mode are shown 'Ok' and 'Cancel' buttons at the botom of the colorpicker's drop down. Only click on 'OK' button applies the value.
ColumnCountint8Defines the number of columns for the colors in displayModes 'grid', 'hexagonal' and 'spectrumGrid'.
DisplayModeColorDisplayModeColorDisplayMode.DefaultDetermines the colors that will be displayed and their layout.
DisabledboolfalseEnables or disables the element.
DisableUndoboolfalseBy default clicking on color panel's preview container returns the color value to it's previous state. 'disableUndo' prevents this functionality.
DropDownAppendTostring"body"Sets the parent container of the dropDown (the popup). The expected value is CSS Selector, ID or 'body'. Used when a CSS property of unknowned parent is interfering with the visibility of the dropDown. Example: 'body'.
DropDownOpenModeDropDownOpenModeDropDownOpenMode.DefaultDetermines how the drop down is going to open.
DropDownButtonPositionDropDownButtonPositionDropDownButtonPosition.RightDetermines the position of the drop down button.
DropDownPositionDropDownPositionDropDownPosition.AutoDetermines the vertical position of the dropDown. 'Auto' means its automatically determined depending on the viewport size.
DropDownHeightstring"auto"Sets the height of the drop down. Default value of null means that CSS variables are used. This property should be used when the browser doesn not support CSS variables.
DropDownOverlayboolfalseIf this property is enabled, when the element's dropdown is opened, a transparent overlay is positioned between the dropdown and the rest of the document.
DropDownWidthstring"auto"Sets the width of the drop down. Default value of null means that CSS variables are used. This property should be used when the browser doesn't support CSS variables.
EditAlphaChannelboolfalseAllows to edit the alpha(transparency) of the colors via an editor/slider in the following displayModes: 'palette', 'radial', 'hexagonal'
EnableCustomColorsboolfalseAllows to select a custom color via an editor popup. Custom color selection is available in modes that don't have this option by default, like: 'grid', 'default, 'spectrum grid'.
GridThemeColorsstring[]new string[]{}Defines an Array of colors that will be used as the Theme Colors in the corresponding section of displayMode: 'grid' and 'default'.
GridShadeColorsstring[]new string[]{}Defines an Array of colors that will be used as the Shade Colors in the corresponding section of displayMode: 'grid' and 'default'.
GridStandardColorsstring[]new string[]{}Defines an Array of colors that will be used as the Standart Colors in the corresponding section of displayMode: 'grid' and 'default'.
HideAlphaEditorboolfalseHides the alpha editor. Alpha editor is an input containing the value of the current color opacity. The input is available in the following modes: 'radial', 'palette', 'hexagonal'. The input is only visible if there's enough space. This editor is visible by default.
HideContentToFitstring[]new string[]{}Determines which color editors will be hidden first when there's not enough space for all of them to be visible. By default the editors are only visible in 'palette', 'radial' and 'hexagonal' display modes. This property allows to prioritize the visibility of the editors.
HideHEXEditorboolfalseHEX editor is an input containing the hexadecimal representation of a color. This editor is visible by default. Setting 'hideRGBeditor' to true hides it.
HidePreviewContainerboolfalseHides the preview container. Preview container is used to show the currently selected value in 'palette', 'radial' and 'hexagonal' display modes.
HideRGBEditorboolfalseHides the RGB editor. This editor is a group of three separate inputs for the Red, Green and Blue values of the color.
Hintstring""Sets additional helper text below the element that is only visible when the element is focused.
InvertedboolfalseInverts the colors in 'spectrumGrid', 'hexagonal', 'radial' modes.
Labelstring""Sets a label above the element.
Localestring"en"Sets or gets the language. Used in conjunction with the property messages.
MessagesobjectN/ASets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale.
Namestring""Sets or gets the name attribute for the element. Name is used when submiting HTML forms.
IsOpenedboolfalseDetermines whether the popup is opened or closed
PaletteColorPaletteColorPalette.DefaultDetermines what colors will be displayed in 'spectrumGrid', 'grid' and 'hexagonal' displayModes.
PaletteColorsIEnumerable<object>N/ADefines an array of colors that form a custom palette. This palette can be used in displayModes 'grid' and 'spectrum grid' if the palette property is set to custom. The value of the property can be an array of strings or objects that contain valid colors ( HEX, RGBA, etc).
PaletteCustomColorsstring[]new string[]{}Defines an array of colors that represent a predefined list of custom colors. This palette can be used in displayModes 'grid', 'default' and 'spectrum grid'. Custom colors are displayed at the bottom of the color grid below the button for custom color selection. They are only visible if enableCustomColor property is true.
Placeholderstring""The placeholder is shown when the value is not set yet or is set to null.
ReadonlyboolfalseDisables user interaction with the element.
ResizeIndicatorboolfalseDetermines whether the resize indicator in the bottom right corner of the drop down is visible or not. This property is used in conjunction with resizeMode.
ResizeModeResizeModeResizeMode.NullDetermines whether the dropDown can be resized or not. When resizing is enabled, a resize bar appears on the top/bottom side of the drop down.
RightToLeftboolfalseSets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts.
Themestring""Determines the theme. Theme defines the look of the element
TooltipDisplayModeColorTooltipDisplayModeColorTooltipDisplayMode.HexDetermines how the tooltip displays the value of the color that is being hovered.
UnfocusableboolfalseIf is set to true, the element cannot be focused.
Valuestring"null"Represents the value of the selected color as the value of the element.
ValueFormatColorValueFormatColorValueFormat.DefaultDetermines the format of the color. Whether it's in HEX, RGB or RGBA. By default it shows the color depending on the displayMode.
ValueDisplayModeColorValueDisplayModeColorValueDisplayMode.DefaultDetermines which elements will be displayed in color picker's action section.

ColorPicker Methods

NameTypeArgumentsDescription
ClosevoidN/ACloses the drop down of the color picker.
GetIsOpenedAsync()Task<bool>'N/A'Gets the &quot;IsOpened&quot; property as Task&lt;bool&gt;.
GetValueAsync()Task<string>'N/A'Gets the &quot;Value&quot; property as Task&lt;string&gt;.
OpenvoidN/AOpens the drop down of the color picker.
Refreshvoid'N/A'Refreshes the Blazor Component. Performs a layout of the HTML Elements and recalculates the measurements.
Rendervoid'N/A'Re-renders the Blazor Component. This method will make a full re-render.
StateHasChangedvoid'N/A'Refreshes the state and Re-renders the Blazor Component, if necessary.

ColorPicker Events

NameTypeDescriptionEvent Detail
OnActionButtonClickEventCallback<Event>This event is triggered when user clicks on the action button. 'Ok' button is visible only when "applyValueMode" is set to "useButtons".N/A
ActionButtonClickedevent ColorPickerActionButtonClickedEventHandlerThis event is triggered when user clicks on the action button. 'Ok' button is visible only when "applyValueMode" is set to "useButtons".ColorPickerActionButtonClickedEventArgs
OnCancelButtonClickEventCallback<Event>This event is triggered when the cancel button is clicked. 'Cancel' button is visible only when "applyValueMode" is set to "useButtons".N/A
CancelButtonClickedevent ColorPickerCancelButtonClickedEventHandlerThis event is triggered when the cancel button is clicked. 'Cancel' button is visible only when "applyValueMode" is set to "useButtons".ColorPickerCancelButtonClickedEventArgs
OnChangeEventCallback<Event>This event is triggered when the color value is changed.dynamic oldValue- The previously selected color., dynamic value- The new selected color.
Changedevent ColorPickerChangedEventHandlerThis event is triggered when the color value is changed.ColorPickerChangedEventArgs
OnCloseEventCallback<Event>This event is triggered when the drop down is closed.N/A
Closedevent ColorPickerClosedEventHandlerThis event is triggered when the drop down is closed.ColorPickerClosedEventArgs
OnClosingEventCallback<Event>This event is triggered when the drop down is about to be closed. This event allows to cancel the closing operation calling event.preventDefault() in the event handler function.N/A
Closingevent ColorPickerClosingEventHandlerThis event is triggered when the drop down is about to be closed. This event allows to cancel the closing operation calling event.preventDefault() in the event handler function.ColorPickerClosingEventArgs
OnCustomColorSelectionEventCallback<Event>This event is triggered when the custom color selection view is opened/closed. Custom color selection view is available when "enableCustomColors" property is true.dynamic value- A boolean that indicates whether the custom color view is shown or not.
CustomColorSelectionedevent ColorPickerCustomColorSelectionedEventHandlerThis event is triggered when the custom color selection view is opened/closed. Custom color selection view is available when "enableCustomColors" property is true.ColorPickerCustomColorSelectionedEventArgs
OnDropDownButtonClickEventCallback<Event>This event is triggered when user clicks on the drop down button.N/A
DropDownButtonClickedevent ColorPickerDropDownButtonClickedEventHandlerThis event is triggered when user clicks on the drop down button.ColorPickerDropDownButtonClickedEventArgs
OnOkButtonClickEventCallback<Event>This event is triggered when the ok button is clicked.N/A
OkButtonClickedevent ColorPickerOkButtonClickedEventHandlerThis event is triggered when the ok button is clicked.ColorPickerOkButtonClickedEventArgs
OnOpenEventCallback<Event>This event is triggered when the drop down is opened.N/A
Openedevent ColorPickerOpenedEventHandlerThis event is triggered when the drop down is opened.ColorPickerOpenedEventArgs
OnOpeningEventCallback<Event>This event is triggered when the drop down is about to be opened. This event allows to cancel the opening operation calling event.preventDefault() in the event handler function.N/A
Openingevent ColorPickerOpeningEventHandlerThis event is triggered when the drop down is about to be opened. This event allows to cancel the opening operation calling event.preventDefault() in the event handler function.ColorPickerOpeningEventArgs
OnResizeStartEventCallback<Event>This event is triggered when user starts resizing the drop down.dynamic position- An object containing the current left and top positions of the drop down.
ResizeStartedevent ColorPickerResizeStartedEventHandlerThis event is triggered when user starts resizing the drop down.ColorPickerResizeStartedEventArgs
OnResizeEndEventCallback<Event>This event is triggered when the resizing of the drop down is finished.dynamic position- An object containing the current left and top positions of the drop down.
ResizeEndedevent ColorPickerResizeEndedEventHandlerThis event is triggered when the resizing of the drop down is finished.ColorPickerResizeEndedEventArgs

Enums

ColorApplyValueMode

ColorApplyValueMode.Instantly
ColorApplyValueMode.UseButtons

ColorDisplayMode

ColorDisplayMode.Default
ColorDisplayMode.Grid
ColorDisplayMode.Palette
ColorDisplayMode.Radial
ColorDisplayMode.Hexagonal
ColorDisplayMode.SpectrumGrid
ColorDisplayMode.MaterialGrid
DropDownOpenMode.None
DropDownOpenMode.Default
DropDownOpenMode.DropDownButton
DropDownOpenMode.Auto
DropDownButtonPosition.Left
DropDownButtonPosition.Right
DropDownButtonPosition.Top
DropDownButtonPosition.Bottom
DropDownPosition.Auto
DropDownPosition.Top
DropDownPosition.Bottom
DropDownPosition.OverlayTop
DropDownPosition.OverlayCenter
DropDownPosition.OverlayBottom
DropDownPosition.CenterBottom
DropDownPosition.CenterTop

ColorPalette

ColorPalette.Default
ColorPalette.Gray
ColorPalette.Red
ColorPalette.Green
ColorPalette.Blue
ColorPalette.Custom

ResizeMode

ResizeMode.None
ResizeMode.Horizontal
ResizeMode.Vertical
ResizeMode.Both

ColorTooltipDisplayMode

ColorTooltipDisplayMode.None
ColorTooltipDisplayMode.Rgb
ColorTooltipDisplayMode.Rgba
ColorTooltipDisplayMode.Hex

ColorValueFormat

ColorValueFormat.Default
ColorValueFormat.Rgb
ColorValueFormat.Rgba
ColorValueFormat.Hex

ColorValueDisplayMode

ColorValueDisplayMode.Default
ColorValueDisplayMode.ColorBox
ColorValueDisplayMode.ColorCode
ColorValueDisplayMode.None