a suite of UI Components for development of web apps
If you have any questions, don't hesitate to contact us at support@lidorsystems.com
Advanced User Interface Controls and Components
IntegralUI ColorPicker is a native web component for Angular, React and Vue that allows you to select a color by using a drop-down panel with color palette and slider. In this article, you will find general information about the color picker component, including its properties, events and methods that you can use.
If you have any questions, don't hesitate to contact us at support@lidorsystems.com
In this example, by clicking on the arrow button a panel will appear showing a color palette and slider. The slider shows a rainbow with all basic colors. Depending on slider position the color palette changes, from where you can select a color by moving the mouse cursor.
The color value appears in the input box below the palette where you can manually enter a specific color. The color format can be one of the following:
You can change the color format by clicking on the button next to the input box. The button title states the current format is use.
Once a color is selected, you can confirm the change by clicking on the check-mark button. To cancel the selection, click on the close button, click outside of the dropdown panel or press the ESCAPE key.
To use the ColorPicker component you need to do the following:
import { IntegralUIColorFormat } from './integralui/components/integralui.core';
. . .
@ViewChild('application', {read: ViewContainerRef, static: true}) applicationRef: ViewContainerRef;
public clrFormat: IntegralUIColorFormat = IntegralUIColorFormat.HEX;
public selColor: string = '#4899e5';
<iui-colorpicker [appRef]="applicationRef" [colorFormat]="clrFormat" [selectedValue]="selColor"></iui-colorpicker>
By default, the selected color is displayed in hexadecimal format. You can change the format during run-time by clicking on the format button in dropdown panel or manually from code by setting the colorFormat property.
The appRef property setting is required, because the dropdown panel appears in a popup window. This reference is used to determine the parent component (usually the app root component) that will contain the popup window, so that the dropdown panel appears above other components.
ColorPicker component is also usable as part of other components. For example, you can add a color picker to cells in the Grid or TreeGrid component.
You can use the following properties to change the appearance and behavior of the ColorPicker component:
Using the above properties, you can customize the ColorPicker component in a way best suited for your application.
Here is a list of available events:
When a color is selected from the dropdown panel, the valueChanged event is fired. You can handle this event in your code and add specific action based on the event data.
colorValueChanged(e: any){
console.log("Color value changes to: ", e.value);
}
<iui-colorpicker [appRef]="applicationRef" (valueChanged)="colorValueChanged($event)"></iui-colorpicker>
The following public methods are available:
The appearance of ColorPicker component is determined by a set of CSS classes. Using the controlStyle property, you can override these classes by providing your own. This property can accept an object in following format:
colorPickerStyle = {
general: {
disabled: 'iui-colorpicker-disabled',
focused: 'iui-colorpicker-focused',
normal: 'iui-colorpicker',
hovered: 'iui-colorpicker-hovered',
selected: 'iui-colorpicker-selected'
},
header: {
disabled: 'iui-colorpicker-header-disabled',
focused: 'iui-colorpicker-header-focused',
normal: 'iui-colorpicker-header',
hovered: 'iui-colorpicker-header-hovered',
selected: 'iui-colorpicker-header-selected'
}
}
To disable animations in the date picker component, set the allowAnimation property to false.
IntegralUI ColorPicker is a web component that you can use in Angular, React and Vue. Using the component properties, you can customize the color picker appearance and behavior. In addition whenever color changes you can handle the fired events in your code and provide specific actions.
The color picker is also usable as part of other components or in Angular Forms.
The ColorPicker component is part of IntegralUI Web.