Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <!-- web-interactive-terminal -->
<!-- -->
    <div id="web-terminal-ctn">
        <div id="web-terminal"></div>
        <form id="web-terminal-form">
            <input id="web-terminal-input" type="text" placeholder="$" autocomplete="off" autofocus />
            <input type="submit" />

    <script src="index.js"></script>
    <script src="script.js"></script>
              * {
    box-sizing: border-box;
		font-size: 15px;

body {
    background-color: #333;

#web-terminal-ctn {
    display: block;
    width: 100%;
    margin: 10px auto;

$fontHeight: 15px;
$terminalRows: 10;
#web-terminal {
    padding: 20px;
    color: white;
    font-family: monospace;
    background-color: #14121f;
    overflow-y: scroll;
    height: $fontHeight * $terminalRows;

#web-terminal-form, #web-terminal-input  {
    display: block;
    width: 100%;
    border: none;
    color: white;
    font-family: monospace;
    background-color: #14121f;

#web-terminal-input {
    border-top: solid 1px white;

#web-terminal-form {
    input[type=submit] {
        width: 0px;
        display: none;

    input[type=text]:focus {
        outline: none;

// index.es6

let terminalCtn = document.querySelector("#web-terminal-ctn"); // get terminal container element
let terminal = document.querySelector("#web-terminal"); // get terminal element
let terminalInput = document.querySelector("#web-terminal-input"); // get input element
let terminalForm = document.querySelector("#web-terminal-form"); // get input form element

let display = function (html) { //write to terminal
    terminal.insertAdjacentHTML("afterbegin", html);

let htmlElement = (element,text) => `<${element}>${text}</${element}>`;

let printf = function (string, newline = true) { //format, write to terminal
    let nl = newline ? "<br>" : "";

let fontHeight = 15;
let cls = function () { // clear screen
    for (let i = 0; i <= terminal.clientHeight/fontHeight; i++) {

let bufferHistory = [];
let bhIndex = 0;

let bhManage = function(){ // manage buffer history on input submit

    bhIndex = 0;

// cycle through terminal history
document.onkeydown = keyCheck;

function keyCheck(e)
  let keycode = window.event.keyCode;

  switch (keycode)
    case 38:  // up arrow 
        if(bhIndex < bufferHistory.length-1){
            terminalInput.value = bufferHistory[bhIndex];

    case 40:  // down arrow 
        if(bhIndex > 0){
            terminalInput.value = bufferHistory[bhIndex];

// script.js (on submit actions)

var buffer; // store user input

// initial message
printf("Enter your name or a word to see its base-10 representation (converted from base-36). Enter \"clear\" to clear the terminal.");

// handle buffer submit
terminalForm.addEventListener("submit", function (e) {
    buffer = terminalInput.value;
    bhManage(); // manage buffer history

    if(buffer == "clear")
			{ // display conversion
				printf(buffer + "_36 = " + parseInt(buffer,36) + "_10");

    terminalInput.value = "";

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.