Skip to content

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.

vue
<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

PropDefaultType
stop*—GradientStop
index*—number
active*—boolean
draggingfalseboolean | undefined
interactivetrueboolean | undefined
removabletrueboolean | undefined
positionStep1number | undefined
label—string | undefined
colorProfile
The profile the stop's color is stored in; the hex reads it as the sRGB color drawn.
"srgb"ColorProfile | undefined
asChild
Change 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.
falseboolean | undefined
as
The element or component this component should render as. Can be overwritten by `asChild`.
"div"AsTag | Component | undefined

Events

EventPayloadDescription
select[index: number]
updatePosition[index: number, position: number]
updateColor[index: number, hex: string]
updateOpacity[index: number, opacity: number]
remove[index: number]

Slots

SlotPropsDescription
defaultGradientEditorStopSlotProps

Zobacz też ​

Released under the MIT License.