Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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.


Auto Save

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.


                <h1>Different types to render a component</h1>

<h2>Type #1:</h2>
<div data-bind='component: "my-component"'></div>

<h2>Type #2:</h2>
<div data-bind='component: { name: "my-component" }'></div>

<h2>Type #3:</h2>

<h2>Type #4:</h2>
<p>Type #4 is in the JS side (see how my-divider-component is introduced)</p>




                // This is another way to use a component (by declaring it as an object)
// Which basically passes the component name to be rendered in another component
const MyDividerComponent = function() {
  const self = this;
  self.component = () => {
    return {
      name: 'my-divider-component'

const myDividerComponent = new MyDividerComponent();

// Create the view model that will server later to a component (it will handle the states)
var MyViewModel = function(first, last) {
    this.firstName = ko.observable('Cesar');
    this.lastName = ko.observable('K');
    this.fullName = ko.pureComputed(function() {
        return this.firstName() + " " + this.lastName();
    }, this);

// Register component 1
ko.components.register('my-component', {
  viewModel: {
    createViewModel: function(params) {
      return new MyViewModel(params);
  synchronous: true,
  template: `
      <p>First name: <input data-bind="textInput: firstName" /></p>
      <p>Last name: <input data-bind="textInput: lastName" /></p>
      <strong>Hello, <span data-bind="text: fullName"> </span>!</strong>
      <div data-bind="component: myDividerComponent.component()"></div>

// Register component 2
ko.components.register('my-divider-component', {
  template: `
    <div style="border-top: 3px solid #bbb;"></div>