ColorPickerPreview

Form & Input
stable

Hue and alpha sliders with a colour preview swatch and optional eye-dropper button.

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

Anatomy of OrigamColorPickerPreviewSchematic of ColorPickerPreview with 4 internal parts. 1 2 3 4 origam-color-picker-preview
Anatomy of <origam-color-picker-preview> — 4 parts: root flex container ①, preview dot ②, hue slider ③, alpha slider ④ (hidden when hideAlpha).
1.origam-color-picker-preview
Root <div> with display: flex; align-items: center. Has --hide-alpha BEM modifier when hideAlpha=true.
2.origam-color-picker-preview__dot
Circular swatch showing the current colour. Uses a checkerboard background for transparency. 30x30px, border-radius: 50%.
3.origam-color-picker-preview__hue
OrigamSliderField ranging 0–360 for hue. Track background is the full hue gradient. Fill track is hidden.
4.origam-color-picker-preview__alpha
OrigamSliderField ranging 0–1 for alpha (step 1/256). Track background is a transparency-to-current-colour gradient. Conditionally rendered via v-if="!hideAlpha".

API

Props

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.

colorHsv
THSVA | null
Current colour in HSVA format { h, s, v, a }. Drives the hue slider position and the preview swatch fill.
disabled
boolean
false
Disables slider interaction. Passed through to both SliderField children.
hideAlpha
boolean
false
Hides the alpha slider. Applied as a BEM modifier --hide-alpha on the root element.
ariaLabel
string
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
height
number | string
Override height of the preview strip. Accepts a CSS length or a number (px).
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
width
number | string
Override width of the preview strip.

API

Emits

Événements émis par ce composant.

@update:colorHsv
THSVA
Fired when the user moves the hue or alpha slider, or picks a colour with the eye-dropper. Emits the updated HSVA object.

API

Membres exposés

Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.

<T extends object>(props: T, exclude?: string[]) => Partial<T>
Utility to forward a filtered subset of props to a child component.
Ref<string>
Reactive CSS string generated by useStyle.
string
Unique style-sheet ID for this instance.
() => void
Injects the computed style sheet into the document.
() => void
Removes the injected style sheet.
Ref<boolean>
True once the style sheet has been injected into the DOM.

Personnalisation

Variables CSS

Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.

Width of the preview dot swatch.
Height of the preview dot swatch.
Border-radius of the preview dot swatch.
CSS custom property injected at runtime with the current hue as a CSS colour. Used as the end stop of the alpha gradient track.

Inclusion

Accessibilité

Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.

Interactions clavier

Interactions clavier
ToucheAction
TabMoves focus between the hue slider, alpha slider, and eye-dropper button.
Arrow Left / RightAdjusts the focused slider (hue or alpha) by one step.

Notes

  • Each SliderField is a native range-like widget with aria-valuemin, aria-valuemax and aria-valuenow. Keyboard navigation is handled by OrigamSliderField.
  • The eye-dropper button is only rendered when window.EyeDropper is available (Chromium 95+). On unsupported browsers the slot is absent.

Interactif

Playground

Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.

Rendu de l’aperçu en cours…

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Standalone preview

vue

Without alpha slider

vue

Écosystème

Famille

Composants du même dossier qui partagent les conventions et se composent souvent ensemble.