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


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.


                <div id="app">
  <test-component />

<script src=""></script>
<script src=""></script>


                #app {
  text-align: center;
  font-family: sans-serif;
  font-size: 20px;


  First create a Global API Class where you handel the
  Controller and Model parts, leaving all the code in
  Vue JS to act as the View.
  With this setup you get a complete MVC.
  Example with a global number, string and a bool.
  The class, for Controller and Model:
class MyNameApi extends Listener {
  // Were using the constructor to set the vars up
  constructor() { 
    // call the Listener contructor first
    // set up a var you want to sync with the component
    // This is usually done in sub classes in the model = '...';
    this.age = 0;
    this.ok = false;
    // Fake API call, using a timer
    const that = this;
    setInterval(() => { = that.getNewName();
      that.age = Math.floor((Math.random() * 100) + 1);
      that.ok = !that.ok;
    }, 3000);

  // Could be an external REST service, now it's just a random response
  getNewName() {
    const names = ['Lokes', 'Thor', 'Oden', 'Freya', 'Balder'];
    const num = Math.floor((Math.random() * names.length-1) + 1);
    return names[num];

// Declare API to be used in Vue
const GlobalApi = new MyNameApi();

  Here is the component with a template drawing the API response
  We include our Global API class and tie the 'name' var with 
  a Listener function.
Vue.component('test-component', {
  data() {
    return {
      name: 'not decided yet',
      age: 0,
      ok: false,
  template: '<p>👶<br>My name is {{name}}.<br>I\'m {{age}} years old, <br>and that\'s <span v-if="!ok">not</span> great...</p>',
  mounted() {
    // This is where the magic happens...
    // The Listen function in the Global API connects the
    // Component with the Model name var
    // Insert more vars in the array to connect them all at once.
    this.GlobalApi.Listen(['name', 'age', 'ok'], this);

// Start a new Vue app
new Vue({ el: '#app' });