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="app"></app>


                html, body{
  height: 100%;
body {
  background: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: Helvetica Neue;
.container {
  width: 64px;
  overflow: hidden;
  border: 1px solid white;

button {
  width: 50%;
.slide-container {
  position: relative;
  display: flex;
  margin: 0;
  padding: 0;
li {
  list-style: none;
  font-size: 112px;
  color: white;
  padding: 0 4px 0 4px 
li:nth-child(1) {
  background: #1abc9c
  background: #e67e22
  background: #2ecc71
li:nth-child(4) {
  background: #8e44ad
li:nth-child(5) {
  background: #e74c3c


class Application extends React.Component {
  constructor() {
    this.state = {
      activeIndex: 0
    this.onNextClick = this.onNextClick.bind(this);
    this.onPrevClick = this.onPrevClick.bind(this);
  onNextClick() {
    if(this.state.activeIndex < 4){
      this.setState({activeIndex: this.state.activeIndex + 1});
    } else {
      this.setState({activeIndex: 0})
    onPrevClick() {
      if(this.state.activeIndex > 0) {
        this.setState({activeIndex: this.state.activeIndex - 1});
      } else {
        this.setState({activeIndex: 4})
  render() {
    let sliderStyle ={
      transform:`translateX(${this.state.activeIndex * -100}%)`,
      transition: '0.2s'
    return (
      <div className='container'>
        <div className='buttons'>
          <button onClick={this.onPrevClick}>◀</button>
          <button onClick={this.onNextClick}>▶</button>
        <ol className='slide-container' style={sliderStyle}>
          <li key={0}>{1}</li>
          <li key={1}>{2}</li>
          <li key={2}>{3}</li>
          <li key={3}>{4}</li>
          <li key={4}>{5}</li>

ReactDOM.render(<Application />, document.getElementById('app'));