interface

SplitScreen

A two-pane split layout — left and right content panes (any JSX) divided by a thin token line. A container that wraps arbitrary content; the two panes slide in from their outer edges on the house spring.

$ npx ondajs add split-screen

SplitScreen

A two-pane split layout. Pass left and right content (any JSX); they sit side-by-side (or stacked when orientation="vertical"), divided by a thin token line. Like browser-frame and device-frame, it's a container — the documented exception to the component contract's "self-contained" rule, since wrapping arbitrary content is its entire purpose. When animate, the two panes slide in from their outer edges on the house spring (a 16px settle), each from the opposite side. Use ratio to make one pane larger than the other.

Because the panes are React.ReactNode, they live on the component's TS props rather than in the Zod schema (splitScreenSchema covers only the serializable layout props) — the same approach browser-frame / device-frame take for children.

Props

PropTypeDefaultNotes
leftReactNode?Left (or top) pane content.
rightReactNode?Right (or bottom) pane content.
orientation'horizontal' | 'vertical''horizontal'Pane axis — side-by-side or stacked.
rationumber0.5Fraction (0..1) of the main axis given to the left/top pane.
gapnumber0Gap between panes in px.
dividerbooleantrueThin token line between panes.
animatebooleantrueSlide the panes in from their outer edges.
delaynumber0Frames before the entrance.
widthnumber1280Overall width in px.
heightnumber720Overall height in px.
placementregion or {x,y,anchor}Canvas placement.

Usage

TSX
import { SplitScreen } from './components/onda/split-screen/SplitScreen';

export const CompareScene = () => (
  <SplitScreen
    placement="center"
    ratio={0.5}
    left={
      <div style={{ display: 'grid', placeItems: 'center', height: '100%', color: '#8E8E98', fontFamily: '"Clash Display", sans-serif', fontSize: 64 }}>
        Before
      </div>
    }
    right={
      <div style={{ display: 'grid', placeItems: 'center', height: '100%', color: '#F2F2F4', fontFamily: '"Clash Display", sans-serif', fontSize: 64 }}>
        After
      </div>
    }
  />
);