GradientEditorBar
GradientEditorBar is the draggable bar primitive used inside gradient editors.
Props
| Prop | Default | Type |
|---|---|---|
stops*Current gradient stops. | — | GradientStop[] |
activeStopIndex*Active stop index. | — | number |
barBackground*CSS background string for the bar. | — | string |
Events
| Event | Payload | Description |
|---|---|---|
selectStop | index: number | Emitted when a stop is selected. |
dragStop | index: number, position: number | Emitted while a stop is dragged. |
Slots
| Slot | Props | Description |
|---|---|---|
default | bar state + drag handlers | Full gradient bar render contract. |
Default slot props
ts
{
stops: GradientStop[]
activeStopIndex: number
barBackground: string
barRef: (el: unknown) => void
onStopPointerDown: (index: number, event: PointerEvent) => void
onPointerMove: (event: PointerEvent) => void
onPointerUp: () => void
draggingIndex: number | null
}Example
vue
<GradientEditorBar
:stops="stops"
:active-stop-index="activeStopIndex"
:bar-background="barBackground"
@select-stop="selectStop"
@drag-stop="dragStop"
v-slot="ctx"
>
<MyGradientBar v-bind="ctx" />
</GradientEditorBar>