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 class="form-row">
        <label class="form-label" for="title">Title</label>
        <select id="title" data-bind="title">
            <option>Select title</option>
            <option value="Mr">Mr</option>
            <option value="Mrs">Mrs</option>
            <option value="Miss">Miss</option>
            <option value="Ms">Ms</option>
            <option value="Dr">Dr</option>
            <option value="Rev">Rev</option>
    <div class="form-row">
        <label class="form-label" for="first-name">First name</label>
        <input id="first-name" type="text" name="first-name" data-bind="firstName" />

    <div class="form-row">
        <label class="form-label" for="second-name">Second name</label>
        <input id="second-name" type="text" name="second-name" data-bind="secondName" />

    <div class="form-row">
        <label class="form-label" for="date-of-birth">Date of birth</label>
        <input id="date-of-birth" type="date" name="date-of-birth" data-bind="dateOfBirth" />

    <div class="form-row">
        <label class="form-label">Gender</label>
        <input id="gender-male" type="radio" name="gender" value="Male" data-bind="gender" />
        <label for="gender-male">Male</label>

        <input id="gender-male" type="radio" name="gender" value="Female" data-bind="gender" />
        <label for="gender-female">Female</label>

    <dd data-update="title"></dd>

    <dt>First name:</dt>
    <dd data-update="firstName"></dd>

    <dt>Second name:</dt>
    <dd data-update="secondName"></dd>

    <dt>Date of birth:</dt>
    <dd data-update="dateOfBirth"></dd>

    <dd data-update="gender"></dd>


                $spacing-unit: 20px;

*, *:before, *:after {
    box-sizing: border-box;

body {
    margin: $spacing-unit auto;
    max-width: ($spacing-unit * 15);
    line-height: 1.5;

input[type="text"], input[type="date"], select {
    width: 100%;

.form-row {
    margin: 0 0 $spacing-unit 0;

.form-label {
    display: block;
    font-weighT: 700;

dl:after {
    display: table;
    clear: both;

dt {
    float: left;
    clear: left;
    font-weight: 700;

dd {
    margin: 0;
    float: right;



                // Declare a global object to store view data.
var viewData;

viewData = {};

$(function() {
    // Update the viewData object with the current field keys and values.
    function updateViewData(key, value) {
        viewData[key] = value;

    // Register all bindable elements
    function detectBindableElements() {
        var bindableEls;

        bindableEls = $('[data-bind]');

        // Add event handlers to update viewData and trigger callback event.
        bindableEls.on('change', function() {
            var $this;
            $this = $(this);
            updateViewData($'bind'), $this.val());


        // Add a reference to each bindable element in viewData.
        bindableEls.each(function() {

    // Trigger this event to manually update the list of bindable elements, useful when dynamically loading form fields.
    $(document).on('updateBindableElements', detectBindableElements);


$(function() {
    // An example of how the viewData can be used by other functions.
    function updateDisplay() {
        var updateEls;

        updateEls = $('[data-update]');

        updateEls.each(function() {

    // Run updateDisplay on the callback.
    $(document).on('updateDisplay', updateDisplay);