Skip to main content
5.0.3Next5.0.35.0.25.0.15.0.04.0.94.0.84.0.73.2.03.1.03.0.13.0.02.1.12.0.101.0.0
Version: 5.0.3

ColorPicker

Color picker is an input field for colors selection. Clicking it opens up a panel with color paletтes. The user can select a hue from the hue map and after that to select a current color from the palette. The user can use the eyedropper to select any color from the page. The user can see the color hex and rgb codes of the color and also to change them from the inputs.

Basic Usage

<triton-color-picker></triton-color-picker>
<TritonColorPicker/>
<html> 
<head>
<script type="module">
import { defineCustomElements } from '~node_modules/@kognifai/triton-cl-core/loader/index.es2017.js';
defineCustomElements();
</script>
</head>
<body>
<triton-color-picker></triton-color-picker>
</body>
</html>

Behavior

Initial Color

Use the initial color prperty to set the color which is selected when the Color Picker loads. Only a valid color can be passed.

<triton-color-picker initialColor="#2020E8"></triton-color-picker>

Appearance

Colorpicker label

Use the label prperty to display a label above the color picker

<triton-color-picker label="This is a colorpicker"></triton-color-picker>

Playground

API

Properties

PropertyDescriptionTypeDefault
disabledIf true, the component will look disabled and not be interactablebooleanfalse
errorIf true the input element will be displayed as invalidbooleanfalse
error-textError text displayed at the bottom of the field, if error is truestring-
formatSet the color value response typehex hsl hsv rgb'hex'
helper-textA brief text for the user, at the bottom of the fieldstring-
initial-colorSet the initial color of the colorpickerstring'#ffffff'
labelSet the label of the colorpickerstring-
placementSet the position the dropdown will open in, relative to the context elementbottom bottomLeft bottomRight left leftBottom leftTop right rightBottom rightTop top topLeft topRight'bottomLeft'
requiredIf true, the user must fill in a value before submitting a formbooleanfalse
sizeSet the size of the componentbase body large medium small tiny xlarge xxlarge xxxlarge'body'
valueThe value of the color pickerstring-

Events

NameTypeDescriptionExtra
atBlurCustomEvent<void>Emitted when the input loses focus.-
atChangeCustomEvent<string>Emitted when the value has changed.-
atFocusCustomEvent<void>Emitted when the input has focus.-
atInputCustomEvent<KeyboardEvent>Emitted when a keyboard input occurred.-