Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
<pre class="ts"><code class="ts">
// BOOLEAN:
let isDone: boolean = false;

// NUMBERS:
let decimal: number = 6;
let hex: number = 0xf00d;
let binary: number = 0b1010;
let octal: number = 0o744;

// STRINGS
let color: string = "blue";
let otherColor: string = 'Red';

// Template strings ( Strings with expressions)
// Notice the backtick ` and mutltiline support

let fullName: string = `Keno`;
let age: number = 101;
let sentence: string = `Hello, my name is ${ fullName }.

I'll be ${ age + 1 } years old next month.`
console.log(sentence);

// "Hello, my name is Keno.

// I'll be 102 years old next month."

// ARRAYS
let listA: number[] = [1, 2, 3];
let numList: Array<number> = [1, 2, 3];

// TUPLES : Paired values 
let coords: [number, number, number, boolean];
coords = [2,4,2,false];

// ENUM  a way of giving more friendly names 
// to sets of numeric values.
enum Color {Red, Green, Blue};
let c: Color = Color.Green; // 1

// ANY  as in any type
let notSure: any = 4;
let list: any[];

</code></pre>




              
            
!

CSS

              
                body{
  background-color: #888;
  padding: 10px;
}

code{
  font-size:15px;
  border-radius: 5px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.40), 0 1px 2px rgba(0, 0, 0, 0.60);
  padding-left:20px !important;
}

pre.es5:before{
  content: "ES5: ";
}

pre.ts:before{
  content: "TypeScript: ";
}


pre.es6:before{
  content: "ES6: (Babel) ";
}

code.es6{
background-color: #222;
}
              
            
!

JS

              
                //Highlighter stuff ignore
hljs.initHighlightingOnLoad();
//Highlighter stuff ignore

//Just a dump from the docs:
// https://www.typescriptlang.org/docs/handbook/basic-types.html

// BOOLEAN:
let isDone: boolean = false;

// NUMBERS:
let decimal: number = 6;
let hex: number = 0xf00d;
let binary: number = 0b1010;
let octal: number = 0o744;

// STRINGS
let color: string = "blue";
let otherColor: string = 'Red';

// Template strings ( Strings with expressions)
// Notice the backtick ` and mutltiline support

let fullName: string = `Keno`;
let age: number = 101;
let sentence: string = `Hello, my name is ${ fullName }.

I'll be ${ age + 1 } years old next month.`
console.log(sentence);

// "Hello, my name is Keno.

// I'll be 102 years old next month."

// ARRAYS
let listA: number[] = [1, 2, 3];
let numList: Array<number> = [1, 2, 3];

// TUPLES : Paired values 
let coords: [number, number, number, boolean];
coords = [2,4,2,false];

// ENUM  a way of giving more friendly names to sets of numeric values.
enum Color {Red, Green, Blue};
let c: Color = Color.Green; // 1

// ANY  as in any type
let notSure: any = 4;
let list: any[];
              
            
!
999px

Console