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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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="representation">
	<blockquote>Problem is (follow me closely here, the science is pretty complicated), if I cut a hole in the Hab, the air won't stay inside anymore.</blockquote><br>
― Andy Weir, The Martian



                .hidden {
  display: none;


                const {makeDOMDriver, div, form, input, p} = CycleDOM;
const {run} = Cycle;
const {identity, merge} = R;

const STOPPED = Symbol();
const STARTED = Symbol();
const ABORTED = Symbol();
const LAUNCHED = Symbol();

function intent(DOMSource) {
  return {
      .map(evt => {

      .map(evt => {

function model(intents, initialState) {
  const started$ = intents.start$.map(() => ({status: STARTED}));
  const aborted$ = intents.abort$.map(() => ({status: ABORTED}));
  const counter$ = Rx.Observable.timer(0, 1000)
    .map(() => ({counterChange: -1}));

  return Rx.Observable.of(initialState)
    .scan((state, update) => {
      const nextState = merge(state, update);
      if (state.status === STARTED && update.counterChange) {
        nextState.counter += update.counterChange;
      if (nextState.counter === 0) {
        nextState.status = LAUNCHED;
      return nextState;

const showIf = visible => visible ? "" : ".hidden";

function view(state$) {
  return state$.map(state => div([
    div(showIf(state.status === STOPPED), [
      form(".start", [
        input({type: "submit", value: "Start"})
    div(showIf(state.status === STARTED), [
      p(`Count down:${state.counter}`),
      form(".abort", [
        input({type: "submit", value: "Abort"})
    p(showIf(state.status === ABORTED), `Aborted at Counter:${state.counter}`),
    p(showIf(state.status === LAUNCHED), "Launched")

const Launcher = sources => ({ DOM: view(model(intent(sources.DOM), sources.initialState)) });

const main = function(sources) {
  const initialState = {
    counter: 10,
    status: STOPPED

  return Launcher({ DOM: sources.DOM, initialState });

const drivers = {
  DOM: makeDOMDriver("#representation")

run(main, drivers);