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"></div>


                html, body
  height: 100%
  // display: flex
  // flex-direction: column
  // justify-content: center
  // align-items: center
  font-family: Helvetica Neue

  text-align: center
  display: flex
  justify-content: center
  align-items: center
  height: 100vh

  position: relative
  height: 380px
  width: 400px
  position: absolute
  left: 0
  top: 0
  border-width: 0

  left: 255px
  left: 5px
  top: 48px
  left: 200px
  top: 182px

  left: -25px
  top: 182px
  cursor: pointer



                const IMAGES = {
  roof: '',
  wall: '',
  window: '',
  door_open: '',
  door_closed: '',
  cat_sleeping: '',
  cat_awake: '',

const Roof = ({ color }) => <img src={IMAGES.roof} className="roof" style={{background: 'blue'}}/>;
const Wall = () =>  <img src={IMAGES.wall} className='wall'/>;
const Window = () => <img src={IMAGES.window} className='window'/>;

class Door extends React.Component {
  constructor(props) {
    this.state = { isOpen: 'closed' };
  render() {
    const onClick = () => {
      if (this.state.isOpen === 'open')
        this.setState({ isOpen: 'closed' });
        this.setState({ isOpen: 'open' });
    return <img src={this.state.isOpen === 'open' ? IMAGES.door_open : IMAGES.door_closed } className='door' onClick={onClick} />;

// const Door = () => <img src='' className='door'/>

class House extends React.Component {
  render() {
    return (
      <div className='house'>      
        <Roof color='blue'/>
        <Wall />
        <Window />
        <Door />

const App = () => <House />;

 * Render the above component into the div#app
ReactDOM.render(<App />, document.getElementById('app'));