ef-trim-handles

Draggable start/end trim handles. Overlays onto a thumbnail strip or track.

Renders draggable in/out handles with dimmed overlay regions. Fires trim-change events as the user drags. Typically layered over an ef-thumbnail-strip.

<div style="position: relative; height: 56px;">
  <ef-thumbnail-strip target="my-video" use-intrinsic-duration thumbnail-height="56"
    style="display: block; width: 100%; height: 56px;"></ef-thumbnail-strip>
  <ef-trim-handles intrinsic-duration-ms="5000" seek-target="my-video"
    style="position: absolute; inset: 0;"></ef-trim-handles>
</div>
document.querySelector('ef-trim-handles').addEventListener('trim-change', (e) => {
  const { startMs, endMs } = e.detail.value;
});

--trim-handle-color, --trim-handle-active-color, and --trim-overlay-color are part of the shared theme (ef-theme.css) rather than local to this component — override them globally, or scope an override to a specific ef-trim-handles instance the same way.

ef-trim-handles::part(handle-inner) { background: #e94560; }

Attributes

AttributeReact propTypeDefaultDescription
element-idelementIdstring""ID of the element these trim handles edit, included in the `trim-change` event detail.
intrinsic-durationintrinsicDurationnumberUntrimmed source duration in seconds, used to compute drag bounds.
modemodestandalone | track`standalone` (full overlay + draggable region) or `track` (handles pinned at container edges, for use inside a timeline track).
pixels-per-secondpixelsPerSecondnumber | nullZoom level — pixels rendered per second of composition time.
seek-targetseekTargetstring""ID of a temporal element to seek as the user drags a handle.
show-overlaysshowOverlaysbooleantrueShows dimmed overlays over the trimmed-away portions.

Slots

SlotDescription
handle-endThis slot holds custom content for the end trim handle's visible knob. The end handle sits on the right.
handle-startThis slot holds custom content for the start trim handle's visible knob. The start handle sits on the left.

CSS Parts

PartDescription
handleThis part matches both trim handles, the start handle and the end handle.
handle-endThis part is the end trim handle, on the right.
handle-innerThis part is the visible knob inside each trim handle.
handle-startThis part is the start trim handle, on the left.
overlayThis part matches both dimmed overlays. Each overlay covers a trimmed-away portion.
overlay-endThis part is the dimmed overlay over the trimmed-away end portion.
overlay-startThis part is the dimmed overlay over the trimmed-away start portion.
regionThis part is the draggable middle region. It appears only in standalone mode.
selected-borderThis part matches the selection indicator's borders. They appear only in standalone mode.
selected-border-bottomThis part is the bottom border of the selection indicator.
selected-border-topThis part is the top border of the selection indicator.

CSS Custom Properties

PropertyDefaultDescription
--trim-handle-active-color#3b82f6Handle color while hovered or dragging.
--trim-handle-border-radius-end0 2px 2px 0Border radius of the end (right) handle's visible knob.
--trim-handle-border-radius-start2px 0 0 2pxBorder radius of the start (left) handle's visible knob.
--trim-handle-colorrgba(255, 255, 255, 0.7)Handle color at rest.
--trim-handle-width8pxWidth of each trim handle's hit area.
--trim-overlay-colorrgba(0, 0, 0, 0.4)Color of the dimmed overlay drawn over trimmed-away regions.
--trim-selected-border-colortransparentColor of the selection indicator border (standalone mode).
--trim-selected-border-width0pxThickness of the selection indicator border (standalone mode).

Events

EventDetailDescription
trim-change{ elementId: string; type: "start" | "end" | "region"; value: { start: number; end: number } }This event fires continuously while the user drags a trim handle or the region.
trim-change-end{ elementId: string; type: "start" | "end" | "region" }This event fires once when the user releases a trim handle drag.