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


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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

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.


              <div class="demo-container">
  <label>Limbo's MultiLineInput Component</label>
  <div id="example-multiline-input">
    <textarea cols="40" rows="3" id="example-multiline-textarea"></textarea>


              /* Limbo's main stylesheet is included in the Settings of this Pen */

/* Demo-only styles */
html, body {
  height: 100%;
body {
  align-items: center;
  display: flex;
  justify-content: center;

.demo-container {
  background-color: #fff;
  border-radius: 3px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
  max-width: 50em;
  padding: 2em;
  width: 95%;


 * This is a copy/paste of the MultiLineInput.js module in Limbo's codebase
 * You can see a working example on the site when creating a Profile or another isolated
 * example in Limbo Pattern Library:
const defaultProps = {
  appendAfter: null,
  container: null,
  containerClasses: "",
  listClasses: "",
  textarea: null,
  items: [],
  maxItems: 3

const listItem = (itemContent, mode = "view") => `
    <div class="item-view" ${mode === "edit"
      ? 'aria-hidden="true" hidden'
      : ""}>
      <span class="item-contents">${encodeHtml(itemContent)}</span>
      <div class="item-controls">
        <button type="button" class="btn-text btn-text-small btn-delete">
        <button type="button" class="btn-text btn-text-small btn-edit">

    <div class="item-edit" ${mode === "view"
      ? 'aria-hidden="true" hidden'
      : ""}>
      <div class="profile-projects-input">
        <textarea aria-label="Notable project" rows="2" name="projects-input"
          placeholder="ex; Built an image processing system transcoding XK images a day"
        <div class="multiline-input-counter">&nbsp;</div>

      <div class="field-inline-btn-container">
        <button type="button" class="btn btn-small btn-save">

 * A MultiLineInput is an input control that allows a line-by-line manipulation
 * of a specific field, separated by newlines. Its primary use presently is
 * in the Notable Projects field on the profile form.
class MultiLineInput {
  constructor(props = {}) {
    this.props = $.extend({}, defaultProps, props);

    const {
    } = this.props;

    // Retrieve any items from the textarea in the DOM.
    const items = textarea.val().split(/[\n\r]/).filter(p => p);
    this.props.items = items;

    // Adds the main containing element to the dom after the specified element.
    const container = $(
      `<div class="field-inline-btn ${containerClasses}"><ul class="multiline-output ${listClasses}"></ul></div>`

    appendAfter.prop("hidden", true).after(container);
    this.props.container = container;

    const list = container.find("ul");
    this.props.list = list;

    // Save item when hitting the enter key
    container.on("keypress", "textarea", event => {
      if (event.which === 13) {

    container.on("input", "textarea", event => {
      const target = $(;
      const max = parseInt(target.attr("maxlength"), 10);
      const len = target.val().length;

      const counterEl = target.parent().find(".multiline-input-counter");
      counterEl.toggleClass("counter-low", max - len < 11);
      counterEl.text(max - len);

    // Save item on click of 'add' button
    container.on("click", ".btn-save", event => {

    container.on("click", ".btn-edit", this.enterEditMode.bind(this));
    container.on("dblclick", ".item-contents", this.enterEditMode.bind(this));

    // Delete item
    container.on("click", ".btn-delete", event => {
      const parentListItem = $("li");
      const index = container.find("li").index(parentListItem);
      this.props.items.splice(index, 1);

    // Do initial rendering of the list items based on any items found in the
    // textarea on page load.
    list.append(, i) => listItem(item)));

    // If we're under the maxItems on page load, add a blank item in edit mode.
    if (items.length < maxItems) {
      list.append(listItem("", "edit"));

  // Re-render a list item putting it in "edit mode".
  // This can happen when tapping the Edit button or double clicking the
  // item contents.
  enterEditMode(event) {
    const { container } = this.props;
    const parentListItem = $("li");
    const text = parentListItem.find("textarea").val();
    const index = container.find("li").index(parentListItem);
    parentListItem.replaceWith(listItem(text, "edit"));
    container.find(`li:eq(${index}) textarea`).focus().trigger("input");

  // Update the text of this item in props.items and re-render the list item
  // putting it in "view mode".
  saveInput(target) {
    const { container } = this.props;

    const parentListItem = target.parents("li");
    const text = parentListItem.find("textarea").val();

    if (text.length) {
      const index = container.find("li").index(parentListItem);
      this.props.items[index] = text;

  // An item was added, updated, or deleted.
  inputValueChanged() {
    const { items, list, maxItems, textarea } = this.props;

    const nextVal = items.join("\n");
    const prevVal = textarea.val();

    if (nextVal !== prevVal) {
      const nextLen = items.length;
      const prevLen = prevVal.split(/[\n\r]/).filter(p => p).length;

      // If the next length is greater than the previous we know we just added
      // another item. and we're still under the max number of items allowed,
      // add another blank item in edit mode.
      const addedItemUnderMax = nextLen > prevLen && nextLen < maxItems;

      // If the next length is less than the previous, we know we just deleted
      // an item and the prevLen was the max, we know we have an empty slot,
      // so add another blank item in edit mode.
      const deletedItemDroppedBelowMax =
        nextLen < prevLen && prevLen === maxItems;

      if (addedItemUnderMax || deletedItemDroppedBelowMax) {
        list.append(listItem("", "edit"));

      // Update the value of the hidden textarea that contains the full string
      // of items and trigger the change event so the form saves.

// NOTE: This is imported from an external module in Limbo's codebase.
 * encodeHtml - Replace alligators with their html entity equivilent.
 * @param {String} s - Any string of text. Likely a block of code.
 * @return {String}
const encodeHtml = s => s.replace(/</g, "&lt;").replace(/>/g, "&gt;");

// NOTE: Example instatiation of the MultiLineInput component:
new MultiLineInput({
  appendAfter: $("#example-multiline-input"),
  containerClasses: "profile-projects-field",
  listClasses: "profile-projects-output",
  textarea: $("#example-multiline-textarea"),
  maxItems: 5 // We default and use 3 on Limbo