Rendyn

Component library

189 components

Product blocks

Sandbox

Sandbox composes a Sandpack environment, file tabs, editor and preview.

Interactive exampleReact Tailwind CSS

Practical React example

Embed an explicitly labelled code playground for a small demonstration.

Before you copy and paste

Use the composed primitives together under their required provider, where one is present. Copy components/kibo-ui/sandbox/index.tsx and its returned support files from the Code tab; preserve the project-relative paths. This example also uses shadcn UI primitives: resizable; install compatible versions or replace them with your existing equivalents. Example-only packages: lucide-react. Replace fixture-generation helpers with application data if they are not needed.

Listed package dependencies: @codesandbox/sandpack-react.

Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.

Embed an explicitly labelled code playground for a small demonstration

// Usage adapted from Kibo UI's pinned MIT source.
// Copyright (c) 2023 — Present shadcnblocks. See ./LICENSES.md.
"use client";

import {
  SandboxCodeEditor,
  SandboxConsole,
  SandboxFileExplorer,
  SandboxLayout,
  SandboxPreview,
  SandboxProvider,
  SandboxTabs,
  SandboxTabsContent,
  SandboxTabsList,
  SandboxTabsTrigger,
} from "@/components/kibo-ui/sandbox";
import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup,
} from "@/components/ui/resizable";
import { AppWindowIcon, CodeIcon, TerminalIcon } from "lucide-react";

const Example = () => (
  <SandboxProvider>
    <SandboxLayout>
      <SandboxTabs defaultValue="preview">
        <SandboxTabsList>
          <SandboxTabsTrigger value="code">
            <CodeIcon size={14} />
            Code
          </SandboxTabsTrigger>
          <SandboxTabsTrigger value="preview">
            <AppWindowIcon size={14} />
            Preview
          </SandboxTabsTrigger>
          <SandboxTabsTrigger value="console">
            <TerminalIcon size={14} />
            Console
          </SandboxTabsTrigger>
        </SandboxTabsList>
        <SandboxTabsContent className="overflow-hidden" value="code">
          <ResizablePanelGroup direction="horizontal">
            <ResizablePanel
              className="overflow-y-auto"
              defaultSize={25}
              maxSize={40}
              minSize={20}
            >
              <SandboxFileExplorer />
            </ResizablePanel>
            <ResizableHandle withHandle />
            <ResizablePanel className="overflow-y-auto">
              <SandboxCodeEditor />
            </ResizablePanel>
          </ResizablePanelGroup>
        </SandboxTabsContent>
        <SandboxTabsContent value="preview">
          <SandboxPreview
            showOpenInCodeSandbox={false}
            showRefreshButton={false}
          />
        </SandboxTabsContent>
        <SandboxTabsContent value="console">
          <SandboxConsole />
        </SandboxTabsContent>
      </SandboxTabs>
    </SandboxLayout>
  </SandboxProvider>
);

export default Example;

Usage example adapted from Kibo UI's pinned MIT source. Retain the source licence notices when copying.

Use reviewed example files and dependencies and decide what network access and external content the playground permits. Keep execution separate from your application’s trusted server context.

Customization

SandboxTabsProps.defaultValue
Optional; string.
SandboxTabsProps.value
Optional; string.
SandboxTabsProps.onValueChange
Optional; (value: string) => void.
SandboxTabsTriggerProps.value
Required; string.
SandboxTabsContentProps.value
Required; string.
SandboxPreviewProps.className
Optional; string.

Integration notes

  • A visual playground wrapper is not a sufficient security boundary for arbitrary untrusted code.
  • Do not include credentials or private application data in files sent to the embedded environment.

Component source: Kibo UI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.

Better with your agent

Give your agent taste.

The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.

All components are free. Sign up only to connect MCP.

Connect to MCP