A simple playground for HTML, CSS and JavaScript supporting module imports.
Playground is a React component that runs entirely in the browser and does not require loading any third party sites.
Install from npm
with npm install @agney/playground
or yarn add @agney/playground
import Playground from "@agney/playground";
const App = () => {
const snippet = {
markup: `<h1>Content</h1>`,
css: `h1 {color: red}`,
javascript: `console.log('this')`,
};
return (
<Playground
initialSnippet={snippet}
defaultEditorTab="css"
defaultResultTab="console"
/>
);
};
Soon
- Autoreloading preview for change
- Can load preview for predefined code.
- Allows for ES module imports. This means you can add imports for any library that supports ES Module resolution and playground will automatically load it into your code.
- Add to static blogs to present your HTML, CSS or JavaScript code.
- Allow users to change the code and see the output in real time. This could be big in educational articles and so.
Soon.
Soon.
Icons made by Freepik from www.flaticon.com