Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <div id="root"></div>
              
            
!

CSS

              
                .container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 500px;
  margin: 30vh auto;  
}
.form-div {
  z-index: 1;
}
.form-div, .button-div {
  transition: .5s ease-out;
}
form {
  border: 1px solid lightgray;
  border-radius: 5px;  
  display: flex;
  flex-direction: column;
  background-color: white;
}
input, button {
  margin: 5px;
}

/*SKELETON CSS*/

/*INPUT STYLING*/
input[type="text"],
input[type="password"],
textarea,
select {
  height: 38px;
  padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */
  background-color: #fff;
  border: 1px solid #D1D1D1;
  border-radius: 4px;
  box-shadow: none;
  box-sizing: border-box; }
input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  border: 1px solid #2BCC9E;
  outline: 0; }

/*BUTTON STYLING*/
.button,
button,
input[type="submit"],
input[type="reset"],
input[type="button"] {
  display: inline-block;
  height: 38px;
  padding: 0 30px;
  color: #555;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 38px;
  letter-spacing: .1rem;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  background-color: transparent;
  border-radius: 4px;
  border: 1px solid #bbb;
  cursor: pointer;
  box-sizing: border-box; }
.button:hover,
button:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
input[type="button"]:hover,
.button:focus,
button:focus,
input[type="submit"]:focus,
input[type="reset"]:focus,
input[type="button"]:focus {
  color: #333;
  border-color: #888;
  outline: 0; }
.button.button-primary,
button.button-primary,
input[type="submit"].button-primary,
input[type="reset"].button-primary,
input[type="button"].button-primary {
  color: #FFF;
  background-color: #2BCC9E;
  border-color: #2BCC9E; }
.button.button-primary:hover,
button.button-primary:hover,
input[type="submit"].button-primary:hover,
input[type="reset"].button-primary:hover,
input[type="button"].button-primary:hover,
.button.button-primary:focus,
button.button-primary:focus,
input[type="submit"].button-primary:focus,
input[type="reset"].button-primary:focus,
input[type="button"].button-primary:focus {
  color: #FFF;
  background-color: #3FB594;
  border-color: #3FB594; }
              
            
!

JS

              
                class App extends React.Component {
  constructor() {
    super();    
    
    this.state = {form: 'login'};   
    
    // I like using objects to toggle values. We could just use true/false and just set to !self value as well. 
    this.toggle = {
      login: 'register',
      register: 'login'
    };
  }
  
  onSubmit(e) {
    e.preventDefault();
  }

  render() {    
    return (
      <div className="container">
        <div style={{transform: `translate(${this.state.form === 'login' ? 0 : 250}px, 0px)`}} className="form-div">
          <form onSubmit={this.onSubmit.bind(this)}>
            <input placeholder="Email" type="text" />
            <input placeholder="Password" type="password" />
            {this.state.form === 'login' ? '': <input placeholder="Re-typed password" type="password" />}
            <button className="button-primary">Submit</button>
          </form>
        </div>
        <div style={{transform: `translate(${this.state.form === 'login' ? 0 : -250}px, 0px)`}} className="button-div">
          <p>{this.state.form === 'login' ? 'Do not have an account?' : 'Already a member?'}</p>
          <button onClick={() => {this.setState({form: this.toggle[this.state.form]})}}>{this.toggle[this.state.form]}</button>
        </div>
      </div>
    );
  }
}
ReactDOM.render(<App />, document.querySelector("#root"));
              
            
!
999px

Console