ColorPickerEdit
Colour edit panel for OrigamColorPicker. Renders a row of text inputs for the active colour mode (RGB, RGBA, HSL, HSLA, HEX, HEXA) and a cycle button to switch between enabled modes.
Aperçu
Rendu de l’aperçu en cours…
rgba modeRendu de l’aperçu en cours…
hex modeRendu de l’aperçu en cours…
disabledStructure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-color-picker-edit> — 4 internal parts. Each mode channel gets a __field ② wrapper containing an __input ③ (native <input>) and a __label ④. The cycle button (origam-btn) appears only when more than one mode is enabled.- 1.origam-color-picker-edit
- Root element. flex row — channels sit inline. The cycle button appends at the end.
- 2.origam-color-picker-edit__field
- Per-channel wrapper. flex column + text-align: center. Full-width with margin-inline-end between siblings.
- 3.origam-color-picker-edit__input
- Native element for the channel value. onChange triggers update:colorHsv after mode conversion.
- 4.origam-color-picker-edit__label
- Channel label below the input (e.g. "R", "G", "B", "A", "#"). Font-size 0.75rem.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- colorHsvTHSVA | null
- Current colour in HSVA format ({ h, s, v, a }). The component converts to the active mode for display and re-converts on user input.
- disabledbooleanfalse
- Disables all text inputs. Prevents user from editing the colour values.
- modeTColorModesCOLOR_MODES_NAMES.RGBA
- Currently active colour mode. Determines which input fields are displayed (e.g. R/G/B/A for RGBA, H/S/L for HSL, #hex for HEX).
- modesArray<TColorModes>['rgb', 'rgba', 'hsl', 'hsla', 'hex', 'hexa']
- List of allowed colour modes. The cycle button only appears when more than one mode is enabled.
- ariaLabelstring
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
API
Emits
Événements émis par ce composant.
- @update:colorHsvTHSVA
- Fired when the user edits a field. Emits the converted THSVA value so the parent updates the colour.
- @update:modeTColorModes
- Fired when the cycle button is clicked. Emits the next mode in the enabled modes list.
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. Called on mount.
- () => void
- Removes the injected style sheet. Called on unmount.
- 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 each channel input field.
- Gap between channel fields.
- Colour of the channel label text (R, G, B, A, #).
- Font size of the channel label.
Inclusion
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Interactions clavier
| Touche | Action |
|---|---|
| Tab | Moves focus between channel inputs and the cycle button. |
| Enter | Commits the typed value in the focused channel input (native input onChange). |
Notes
- Each input is paired with a visible channel label (R, G, B, A, #…). Consumers should provide an accessible aria-label or wrap in a <fieldset><legend> when embedding standalone.
- When disabled=true, the native disabled attribute is set on every input, preventing keyboard and pointer interaction.
- The mode cycle button (origam-btn) has an icon only — always pair with an aria-label on the parent ColorPicker or provide a tooltip.
Fondation
Design tokens
Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.
- dimensionvar(--origam-space---2)
- Gap between fields.
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 edit panel
HEX mode only