Skip to content

ColorInputRoot

ColorInputRoot ist ein headless Hilfsmittel für Farb-Eingabe-UIs.

Es leitet einen Hex-Wert aus einer Farbe ab und gibt Aktualisierungs-Hilfsmittel für Hex- und vollständige Farbänderungen zurück.

Props

PropDefaultType
color*
Aktueller Farbwert.
Color
editable
Ob der Verbraucher den Wert als bearbeitbar darstellen soll.
boolean | undefined

Ereignisse

EventPayloadDescription
updatecolor: ColorAusgelöst, wenn sich die Farbe ändert.

Slots

SlotPropsDescription
default{ color: Color, editable: boolean, hex: string, updateFromHex: (value: string) => void, updateColor: (color: Color) => void }Haupt-Farb-Eingabe-Render-Vertrag.

Beispiel

vue
<ColorInputRoot :color="color" @update="color = $event" v-slot="{ hex, updateFromHex }">
  <input :value="hex" @input="updateFromHex(($event.target as HTMLInputElement).value)" />
</ColorInputRoot>

Verwandte APIs

Released under the MIT License.