1.1.1 • Published 5 years ago

simple-codesandbox v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

simple-codesandbox

easily display configurable codesandbox iframe

Codacy Badge NPM JavaScript Style Guide

Install

npm install --save simple-codesandbox

or

npm install --save simple-codesandbox

Embed Options

The options shown in the embed modal are not all options available. We need a new UI for the share model to reflect these options, in the meantime you can find them here.

OptionDescriptionValuesDefault
codeMirrorUse CodeMirror editor instead of Monaco (decreases embed size significantly).booleanfalse
editorSizeSize in percentage of editor.number50
eslintUse eslint (increases embed size significantly).booleanfalse
expandDevToolsStart with the devtools (console) open.booleanfalse
fontSizeFont size of editornumber (in px)14
forceRefreshForce a full refresh of frame after every edit.booleanfalse
hideNavigationHide the navigation bar of the preview.booleanfalse
highlightsWhich lines to highlight (only works in CodeMirror)comma separated list of line numbers
initialPathWhich url to initially load in address barstring/
moduleViewEvaluate the file that is open in the editor.booleanfalse
previewWindowWhich preview window to open by defaultconsole / tests / browserbrowser
runOnClickOnly load the preview when the user says so.booleanfalse
verticalLayoutWhether to show the editor and preview vertically.booleanfalse
viewWhich view to open by defaulteditor / split / previewsplit, preview for small screens
moduleWhich module to open by default. Multiple paths comma separated are allowed, in that case we show them as tabspath to module (starting with /)entry path

Example Embeds

These are some examples of embeds, based on their properties.

Usage

const App = () => (
  <CodeSandbox sandbox="github/glweems/empty-sandbox" />
)

Smallest Embed

const App = () => (
  <CodeSandbox sandbox="github/glweems/empty-sandbox" codeMirror />
)

License

MIT © glweems