GradientEditorStop
GradientEditorStop renderuje polimorficzny punkt gradientu z udokumentowanym stanem zaznaczenia i przeciągania. Interaktywne punkty mają rolę suwaka (slider) i podają swoje położenie procentowe przez ARIA.
Na pasku gradientu używaj punktów interaktywnych. Klawisze strzałek przesuwają punkt o positionStep, a z wciśniętym Shift o krok 10 razy większy. Home i End przenoszą go na jedną z granic, a Delete i Backspace emitują remove, jeśli punkt można usunąć. Obsłużone klawisze zatrzymują propagację, więc skróty usuwania i przesuwania na poziomie edytora nie są wykonywane. Natywna kolejność klawisza Tab przechodzi między punktami.
Ustaw interactive="false", gdy używasz komponentu wokół złożonego wiersza punktu. Wiersz nadal udostępnia działania slotu oraz data-selected i data-dragging, ale nie wchodzi do kolejności Tab suwaków.
<script setup lang="ts">
import type { GradientStop } from '@pairdraw/scene-graph'
import { GradientEditorStop } from '@pairdraw/vue/primitives/GradientEditor'
const stop: GradientStop = {
color: { r: 0.4, g: 0.2, b: 0.9, a: 1 },
position: 0.5
}
</script>
<template>
<GradientEditorStop
:stop="stop"
:index="0"
active
label="Middle gradient stop"
@update-position="(_index, position) => console.log(position)"
/>
</template>Wygenerowana dokumentacja API
GradientEditorStop
Generated from packages/vue/src/primitives/GradientEditor/GradientEditorStop.vue
Props
| Prop | Default | Type |
|---|---|---|
stop* | — | GradientStop |
index* | — | number |
active* | — | boolean |
dragging | false | boolean | undefined |
interactive | true | boolean | undefined |
removable | true | boolean | undefined |
positionStep | 1 | number | undefined |
label | — | string | undefined |
colorProfileThe profile the stop's color is stored in; the hex reads it as the sRGB color drawn. | "srgb" | ColorProfile | undefined |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior.
Read our [Composition](https://www.reka-ui.com/docs/guides/composition) guide for more details. | false | boolean | undefined |
asThe element or component this component should render as. Can be overwritten by `asChild`. | "div" | AsTag | Component | undefined |
Events
| Event | Payload | Description |
|---|---|---|
select | [index: number] | |
updatePosition | [index: number, position: number] | |
updateColor | [index: number, hex: string] | |
updateOpacity | [index: number, opacity: number] | |
remove | [index: number] |
Slots
| Slot | Props | Description |
|---|---|---|
default | GradientEditorStopSlotProps |