openpencil/packages/docs/programmable/sdk/api/components/gradient-editor-stop.md
Danila Poyarkov 422f83331f feat(vue): promote color and fill primitives
- Add accessible OkHCL channel sliders and use Reka ColorSlider for standard color channels

- Split fill state and binding-aware swatches from application popover composition

- Add keyboard-operable gradient stops, shared demos, generated docs, and focused coverage
2026-07-13 23:41:04 +03:00

1.6 KiB
Raw Blame History

title description
GradientEditorStop Accessible primitive for a selected or draggable gradient stop.

GradientEditorStop

GradientEditorStop renders a polymorphic gradient stop with documented selection and dragging state. Interactive stops use the slider role and expose their percentage position through ARIA.

Use interactive stops on the gradient bar. Arrow keys nudge by positionStep; holding Shift uses a 10× step. Home and End move to either boundary, while Delete and Backspace emit remove when the stop is removable. Handled keys stop propagation so editor-level deletion and movement shortcuts do not run. Native Tab order cycles between stops.

Set interactive="false" when reusing the primitive around a composite stop row. The row still exposes slot actions and data-selected/data-dragging, but does not enter the slider tab order.

<script setup lang="ts">
import type { GradientStop } from '@open-pencil/scene-graph'
import { GradientEditorStop } from '@open-pencil/vue'

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>

Generated API reference