Skip to content

Framework Integration Guides ​

RedDokia shares the exact same layoutSchema and viewsSchema across four first-class official entrypoints tailored to each framework's native lifecycle.

FrameworkEntrypointView HostingController Access
React 18 / 19reddokia/reactcreatePortal (Zero-Unmount)useRef<RedDokiaController> or onReady
Vue 3reddokia/vue<Teleport> + Volar DefineComponentref<RedDokiaVueExpose> or @ready
Svelte 5reddokia/svelteNative mount/unmount + SvelteMaponReady callback or use:redDokia
Vanilla TS / JSreddokiaPure DOM mount functionnew RedDokia(...) instance directly

React 18 / 19 ​

  • Entrypoint: reddokia/react
  • Hosting: Zero-Unmount React createPortal into persistent core host nodes
tsx
import { useRef } from 'react';
import { RedDokia, type RedDokiaController } from 'reddokia/react';
import { layoutSchema } from './layoutSchema';
import { viewsSchema } from './viewsSchema';

export function App() {
  const dockRef = useRef<RedDokiaController>(null);

  return (
    <div style={{ width: '100vw', height: '100vh' }}>
      <RedDokia ref={dockRef} views={viewsSchema} layout={layoutSchema} />
    </div>
  );
}

Production Notes ​

  • Next.js / Remix SSR: <RedDokia /> renders a hydration-safe empty reddokia-react-host container during SSR with zero Hydration Mismatch warnings. Add 'use client' in Next.js App Router.
  • StrictMode: Safe under React 18/19 double-invocation effects with deterministic engine teardown and remount.

Vue 3 ​

  • Entrypoint: reddokia/vue
  • Hosting: Zero-Unmount Vue 3 <Teleport>
  • IDE Support: Full Volar prop, emit, and ref expose inference via DefineComponent<RedDokiaProps, RedDokiaVueExpose, ..., RedDokiaVueEmits>
vue
<script setup lang="ts">
import { ref } from 'vue';
import { RedDokia, type RedDokiaVueExpose } from 'reddokia/vue';
import { layoutSchema } from './layoutSchema';
import { viewsSchema } from './viewsSchema';

const dockRef = ref<RedDokiaVueExpose | null>(null);
</script>

<template>
  <div style="width: 100vw; height: 100vh">
    <RedDokia
      ref="dockRef"
      :views="viewsSchema"
      :layout="layoutSchema"
      @ready="(ctrl) => console.log('ready', ctrl)"
    />
  </div>
</template>

Production Notes ​

  • Register standard .vue SFC components directly in viewsSchema.
  • Both Vue events (@ready, @layout-change, @view-resize) and callback props are supported.

Svelte 5 ​

  • Entrypoint: reddokia/svelte
  • Hosting: Native Svelte 5 mount / unmount / onDestroy + svelte/reactivity SvelteMap reactive props bridge
svelte
<script lang="ts">
  import { RedDokia } from 'reddokia/svelte';
  import { layoutSchema } from './layoutSchema';
  import { viewsSchema } from './viewsSchema';
</script>

<div style="width: 100vw; height: 100vh">
  <RedDokia views={viewsSchema} layout={layoutSchema} />
</div>

Or bind declaratively using the use:redDokia Svelte Action:

svelte
<div style="width: 100vw; height: 100vh" use:redDokia={{ views: viewsSchema, layout: layoutSchema }} />

Production Notes ​

  • Passing .svelte components directly in viewsSchema mounts them via Svelte 5 mount() with fine-grained reactive prop updates (width, height, active, visible, params) powered by SvelteMap.
  • <RedDokia /> automatically registers onDestroy() cleanup so conditional {#if} unmounts never leak listeners or observers.

Vanilla TypeScript ​

  • Entrypoint: reddokia (Zero-Dependency Pure ESM)
  • Hosting: (container, props) => ({ update?, unmount? }) mount handlers
ts
import { RedDokia } from 'reddokia';
import { layoutSchema } from './layoutSchema';
import { viewsSchema } from './viewsSchema';

const dock = new RedDokia(document.getElementById('app')!, {
  views: viewsSchema,
  layout: layoutSchema,
});

// Tear down when done:
// dock.destroy();

Production Notes ​

  • The dock instance directly exposes all RedDokiaController methods at the top level (dock.openView(...), dock.setTheme(...), etc.).
  • Return { update(nextProps), unmount() } from a view mount handler to handle live resize/visibility updates and clean teardown.