0.0.2

Overview

Structure of ScenaConfig and the principle of disabling components with false.

Every aspect of the widget — from the video source to the appearance of each UI element — is controlled through a single configuration object, ScenaConfig, passed to scena.mount(). The only required field is video.src; everything else has a sensible default or can be disabled entirely.

import {
  useScena,
  ComponentSize,
  ComponentShape,
  ComponentPosition,
  ComponentPlacement,
} from '@retoo/scena';

import '@retoo/scena/styles';

const scena = useScena();

const instance = await scena.mount({
  video: { src: '/video.mp4' },
  size: ComponentSize.MD,
  shape: ComponentShape.CIRCLE,
  container: {
    position: ComponentPosition.ABSOLUTE,
    placement: ComponentPlacement.MIDDLE_CENTER,
  },
  ctaButton: { text: 'Get in touch' },
});

Config structure

ScenaConfig is a flat object that combines component overrides and feature configs:

KeyDescription
videoVideo source, poster, autoplay, loop, muted, volume. Required.
sizeWidget size — xs, sm, md, lg, xl, xxl
shapeWidget shape — circle, square, portrait, landscape
containerPositioning — position, placement, custom classes/styles
videoContainerVideo container customization
videoLoaderLoading indicator. Pass false to disable.
videoProgressProgress bar. Pass false to disable.
videoControlsPlay/pause controls overlay. Pass false to disable.
videoVolumeVolume control. Pass false to disable.
closeButtonClose button. Pass false to disable.
ctaButtonCall-to-action button. Pass false to disable.
visibilityInitial visibility state and animation
previewPreview mode overrides

Disabling components

Pass false to any component key to remove it from the widget entirely:

import { useScena } from '@retoo/scena';

import '@retoo/scena/styles';

const scena = useScena();

await scena.mount({
  video: { src: '/video.mp4' },
  ctaButton: false,
  closeButton: false,
  videoControls: false,
  videoProgress: false,
  videoVolume: false,
});

This is different from hiding — a disabled component is never rendered in the DOM.

Runtime updates

After mount, modify any config property through the instance:

import { useScena, ComponentSize } from '@retoo/scena';

import '@retoo/scena/styles';

const scena = useScena();

const instance = await scena.mount({
  video: { src: '/video.mp4' },
});

// Deep merge — only the specified fields are updated
instance.config.mergeConfig({
  size: ComponentSize.LG,
  ctaButton: { text: 'Buy now' },
});

// Full replacement
instance.config.setConfig({
  video: { src: '/new-video.mp4' },
  size: ComponentSize.SM,
});

Both methods trigger a reactive update — the widget re-renders immediately without remounting.

Customization

Most components accept customClasses and customStyles for visual overrides without modifying the source. Classes are merged with the defaults; styles are applied as inline CSS.

import { useScena } from '@retoo/scena';

import '@retoo/scena/styles';

const scena = useScena();

await scena.mount({
  video: { src: '/video.mp4' },
  ctaButton: {
    text: 'Contact us',
    customClasses: { 
      button: 'bg-red-500 text-white'
    },
    customStyles: { 
      root: {
        marginTop: '8px'
      } 
    },
  },
});