Skip to main content

Color Picker

shadow

Color picker is an element that displays a color palette and allows users to select one of its colors. Displays the hex code of the selected color, which can be easily copied by the user.

Basic usage​

The sample represents a basic color selection flow without further integrations. It is the best start to understand the behavior of a component.

When to use​

Use wje-color-picker when the user enters a value, selects options, or performs an action on a form.

When not to use​

Don't just use it as a visual decorative element without interaction. In this case, give priority to the presentation components.

Accessibility​

Always link the component to the description (label/aria-label), keep keyboard control, and display a clear message on validation errors.

  • Keep validation rules and error states consistent across the entire form.
  • For asynchronous operations, display the load status or disabled status.
  • For complex forms, prefer smaller sections and immediate feedback.

Attributes and properties​

color​

PopisNastavuje farbu komponentu.
Atribútcolor
Typstring
Predvolené#000000

inputEditable​

PopisUrčuje, či je voľba input-editable zapnutá a ovplyvňuje správanie komponentu.
Atribútinput-editable
Typboolean
Predvolenéfalse

noColorArea​

PopisRiadi farebné štýlovanie súvisiace s voľbou no-color-area.
Atribútno-color-area
Typboolean
Predvolenéfalse

noControls​

PopisUrčuje, či je voľba no-controls zapnutá a ovplyvňuje správanie komponentu.
Atribútno-controls
Typboolean
Predvolenéfalse

noSwatches​

PopisUrčuje, či je voľba no-swatches zapnutá a ovplyvňuje správanie komponentu.
Atribútno-swatches
Typboolean
Predvolenéfalse

swatches​

PopisNastavuje textovú hodnotu uloženú vo voľbe swatches.
Atribútswatches
Typstring
Predvolené-

Events​

NázovPopis
wje-color-picker:selectVyvolá sa pri výbere položky.

Methods​

parseSwatches​

PopisSpustí metódu parseSwatches na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra(value: string) => string[]

createSwatches​

PopisVytvorí swatches a pripojí ho do štruktúry komponentu.
Signatúra(node: any) => void

setSliders​

PopisNastaví sliders a aplikuje súvisiace zmeny stavu.
Signatúra(color: any) => void

dimension​

PopisSpustí metódu dimension na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => object

getPointerPosition​

PopisVráti pointer position z aktuálneho stavu komponentu.
Signatúra(e: any) => {x: number, y: number}

setMarkerPosition​

PopisNastaví marker position a aplikuje súvisiace zmeny stavu.
Signatúra(x: any, y: any) => void

clampMarkerPosition​

PopisSpustí metódu clampMarkerPosition na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra(x: number, y: number) => {x: number, y: number}

setColorAtPosition​

PopisNastaví color at position a aplikuje súvisiace zmeny stavu.
Signatúra(x: any, y: any, alpha: any) => *|tinycolor

getHueAreaColor​

PopisVráti hue area color z aktuálneho stavu komponentu.
Signatúra(color: string) => string

CSS shadow parts​

NázovPopis
anchorŠtýluje shadow časť anchor.
pickerŠtýluje shadow časť picker.
markerŠtýluje shadow časť marker.
color-areaŠtýluje shadow časť color-area.
hueŠtýluje shadow časť hue.
alphaŠtýluje shadow časť alpha.
color-previewŠtýluje shadow časť color-preview.
inputŠtýluje shadow časť input.

CSS custom variables​

NázovPopis
--wje-color-picker-areaVlastná CSS premenná na štýlovanie komponentu (area).
--wje-color-picker-valueVlastná CSS premenná na štýlovanie komponentu (value).
--wje-color-picker-swatchVlastná CSS premenná na štýlovanie komponentu (swatch).
--wje-color-picker-sizeVlastná CSS premenná na štýlovanie komponentu (size).
--wje-color-picker-radiusVlastná CSS premenná, ktorá riadi zaoblenie rohov.

Slots​

NázovPopis
defaultPredvolený slot pre hlavný obsah komponentu.