Skip to content

GradientEditorStop

GradientEditorStop is a headless primitive for rendering and editing a single gradient stop.

Props

PropDefaultType
stop*
Current stop value.
GradientStop
index*
Current stop index.
number
active*
Whether this stop is active.
boolean

Events

EventPayloadDescription
selectindex: numberEmitted when the stop is selected.
updatePositionindex: number, position: numberEmitted when the stop position changes.
updateColorindex: number, hex: stringEmitted when the stop color changes.
updateOpacityindex: number, opacity: numberEmitted when the stop opacity changes.
removeindex: numberEmitted when the stop is removed.

Slots

SlotPropsDescription
defaultstop state + update handlersFull gradient stop render contract.

Default slot props

ts
{
  stop: GradientStop
  index: number
  active: boolean
  positionPercent: number
  opacityPercent: number
  hex: string
  css: string
  select: () => void
  updatePosition: (position: number) => void
  updateColor: (hex: string) => void
  updateOpacity: (opacity: number) => void
  remove: () => void
}

Example

vue
<GradientEditorStop :stop="stop" :index="index" :active="active" v-slot="ctx">
  <MyGradientStopRow v-bind="ctx" />
</GradientEditorStop>

Released under the MIT License.