Skip to content

FillPickerRoot

FillPickerRoot is a headless popover-based fill picker for solid, gradient, and image fills.

Props

PropDefaultType
fill*
Current fill value.
Fill
contentClass
Optional class for the popover content.
string | undefined
swatchClass
Optional class for the default trigger button.
string | undefined

Events

EventPayloadDescription
updatefill: FillEmitted when the fill changes.

Slots

SlotPropsDescription
triggerswatch styleCustom trigger with swatch background style.
defaultfill state + conversion helpersMain fill editor content.

Trigger slot props

ts
{
  style: Record<string, string>
}

Default slot props

ts
{
  fill: Fill
  category: 'SOLID' | 'GRADIENT' | 'IMAGE'
  toSolid: () => void
  toGradient: () => void
  toImage: () => void
  update: (fill: Fill) => void
}

Example

vue
<FillPickerRoot :fill="fill" @update="fill = $event">
  <template #default="{ fill, category, toSolid, toGradient, update }">
    <div>{{ category }}</div>
    <button @click="toSolid">Solid</button>
    <button @click="toGradient">Gradient</button>
    <MyFillEditor :fill="fill" @change="update" />
  </template>
</FillPickerRoot>

Released under the MIT License.