3-Minute Quick Start
Live Examples
1. Install
Install reddokia from npm:
npm install reddokiaOr load the pure ESM bundle directly in the browser without a bundler via CDN or GitHub Pages:
<script type="module">
// via jsDelivr CDN (npm)
import { RedDokia, RedDokiaIcons } from 'https://cdn.jsdelivr.net/npm/reddokia/dist/reddokia.js';
// or directly from GitHub Pages
// import { RedDokia, RedDokiaIcons } from 'https://redcamel.github.io/RedDokia/dist/reddokia.js';
</script>Automatic Style Injection
By default, RedDokia injects its required CSS into <head> automatically. For Strict CSP environments using static CSS bundling, see Strict CSP & Production.
2. Define a Shared Layout Schema (layoutSchema.ts)
The same layoutSchema works identically across React, Vue 3, Svelte 5, and Vanilla TS. When type is omitted on a split object, it defaults to 'row' (horizontal split), and a string[] array declares a tab group shorthand.
import type { RedDokiaLayoutSchema } from 'reddokia';
export const layoutSchema: RedDokiaLayoutSchema = {
contents: {
children: [
['explorer'],
['editor', 'preview'],
],
},
};3. Mount in Your Framework
Pass native framework components (.tsx, .vue, .svelte) or mount handlers directly in views. If title is omitted, RedDokia automatically formats id ('explorer' → 'Explorer').
import { RedDokia, RedDokiaIcons, type RedDokiaViewSchema } from 'reddokia/react';
import { layoutSchema } from './layoutSchema';
import ExplorerPanel from './ExplorerPanel';
import EditorPanel from './EditorPanel';
import PreviewPanel from './PreviewPanel';
const views: RedDokiaViewSchema[] = [
{ id: 'explorer', icon: RedDokiaIcons.Layout, component: ExplorerPanel },
{ id: 'editor', title: 'App.tsx', icon: RedDokiaIcons.Layers, component: EditorPanel },
{ id: 'preview', title: 'Preview', icon: RedDokiaIcons.Terminal, component: PreviewPanel },
];
export default function App() {
return (
<div style={{ width: '100vw', height: '100vh' }}>
<RedDokia views={views} layout={layoutSchema} />
</div>
);
}<script setup lang="ts">
import { RedDokia, RedDokiaIcons, type RedDokiaViewSchema } from 'reddokia/vue';
import { layoutSchema } from './layoutSchema';
import ExplorerPanel from './ExplorerPanel.vue';
import EditorPanel from './EditorPanel.vue';
import PreviewPanel from './PreviewPanel.vue';
const views: RedDokiaViewSchema[] = [
{ id: 'explorer', icon: RedDokiaIcons.Layout, component: ExplorerPanel },
{ id: 'editor', title: 'App.tsx', icon: RedDokiaIcons.Layers, component: EditorPanel },
{ id: 'preview', title: 'Preview', icon: RedDokiaIcons.Terminal, component: PreviewPanel },
];
</script>
<template>
<div style="width: 100vw; height: 100vh">
<RedDokia :views="views" :layout="layoutSchema" />
</div>
</template><script lang="ts">
import { RedDokia, RedDokiaIcons, type RedDokiaViewSchema } from 'reddokia/svelte';
import { layoutSchema } from './layoutSchema';
import ExplorerPanel from './ExplorerPanel.svelte';
import EditorPanel from './EditorPanel.svelte';
import PreviewPanel from './PreviewPanel.svelte';
const views: RedDokiaViewSchema[] = [
{ id: 'explorer', icon: RedDokiaIcons.Layout, component: ExplorerPanel },
{ id: 'editor', title: 'App.tsx', icon: RedDokiaIcons.Layers, component: EditorPanel },
{ id: 'preview', title: 'Preview', icon: RedDokiaIcons.Terminal, component: PreviewPanel },
];
</script>
<div style="width: 100vw; height: 100vh">
<RedDokia {views} layout={layoutSchema} />
</div>import { RedDokia, RedDokiaIcons, type RedDokiaViewSchema } from 'reddokia';
import { layoutSchema } from './layoutSchema';
import ExplorerPanel from './ExplorerPanel';
import EditorPanel from './EditorPanel';
import PreviewPanel from './PreviewPanel';
const views: RedDokiaViewSchema[] = [
{ id: 'explorer', icon: RedDokiaIcons.Layout, component: ExplorerPanel },
{ id: 'editor', title: 'App.tsx', icon: RedDokiaIcons.Layers, component: EditorPanel },
{ id: 'preview', title: 'Preview', icon: RedDokiaIcons.Terminal, component: PreviewPanel },
];
const dock = new RedDokia(document.getElementById('app')!, {
views,
layout: layoutSchema,
});Explicit Host Height Required
RedDokia fills 100% × 100% of its host container. Ensure the parent element has an explicit height (e.g., height: 100vh or flex: 1; min-height: 0).
4. Write a Panel Component (EditorPanel)
Every panel receives RedDokiaViewRenderProps, including live dimensions (width, height), active state (active), and the controller API.
import type { RedDokiaViewRenderProps } from 'reddokia/react';
export default function EditorPanel({ width, height, controller }: RedDokiaViewRenderProps) {
return (
<div style={{ padding: 16 }}>
<h3>Editor ({Math.round(width)} × {Math.round(height)} px)</h3>
<button onClick={() => controller.floatView('editor')}>Float View</button>
</div>
);
}<script setup lang="ts">
import type { RedDokiaViewRenderProps } from 'reddokia/vue';
const props = defineProps<RedDokiaViewRenderProps>();
</script>
<template>
<div style="padding: 16px">
<h3>Editor ({{ Math.round(props.width) }} × {{ Math.round(props.height) }} px)</h3>
<button @click="props.controller.floatView('editor')">Float View</button>
</div>
</template><script lang="ts">
import type { RedDokiaViewRenderProps } from 'reddokia/svelte';
let { width, height, controller }: RedDokiaViewRenderProps = $props();
</script>
<div style="padding: 16px">
<h3>Editor ({Math.round(width)} × {Math.round(height)} px)</h3>
<button onclick={() => controller.floatView('editor')}>Float View</button>
</div>import type { RedDokiaViewMountHandler } from 'reddokia';
const EditorPanel: RedDokiaViewMountHandler = (el, { width, height }) => {
el.textContent = `Editor (${Math.round(width)} × ${Math.round(height)} px)`;
return {
update: ({ width: w, height: h }) => {
el.textContent = `Editor (${Math.round(w)} × ${Math.round(h)} px)`;
},
};
};
export default EditorPanel;Next Steps
- Framework Guides — SSR, StrictMode, Volar, and Svelte Action checkpoints
- Workbench Shell & Menus — 6-slot EdgeBars, TopBar, and StatusBar
- Recipes & Troubleshooting — Zero-height host,
storageKey, and pop-out blockers