0.15.0 • Published 9 months ago

@opentf/react-sandbox v0.15.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

 OPEN TECH FOUNDATION

React Sandbox

Demo gif

The CodeSandbox sandpack wrapper with additional features.

View Demo

Features

  • Multiple Layouts (Tabs, Code+Console, etc)
  • Choose between console types: Basic or Advanced(console-feed)

Installation

npm install @opentf/react-sandbox
yarn add @opentf/react-sandbox
pnpm add @opentf/react-sandbox
bun add @opentf/react-sandbox

Usage

import { SandBox } from '@opentf/react-sandbox';

export default function App() {
  const code = `export default function App() {
    return <h1>Hello world</h1>
  }`;

  return <SandBox code={code} />;
}

Props

NameTypeRequiredDefaultDescription
codestringYes''Template specific default file content Eg: nextjs -> pages/index.js
templatestringNo'react'The codesandbox template.
themeSandpackThemePropNo'auto'The codesandbox theme.
layoutstringNo'Default'Currently, there are three presets available: 1. Default 2.Tabs 3. Code_Console
depsstring[]No[]The npm dependencies. eg: 'lodash', 'immer@10.0.0'.
filesRecord<string, string>No{}The files prop accepts an object, where each key is the relative path of that file in the sandbox folder structure.
cdnsstring[]No[]Any third party external dependencies, eg: 'https://cdn.tailwindcss.com'
tabIndexnumberNo0The tab index to select in the Tabs layout
consoleTypestringNo'Basic'There are two types, Basic and Advanced. It uses console-feed for 'Advanced'

Related

License

Copyright (c) Thanga Ganapathy (MIT License).

0.15.0

9 months ago

0.14.0

10 months ago

0.13.0

11 months ago

0.12.0

1 year ago

0.11.0

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago