Pen Settings



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


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.


Auto Save

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


                body {
  background: #6495ED;
  font-family: 'Poiret One', cursive;

p {
  font-size: 18px;
  font-family: 'Nunito Sans', sans-serif;

.dragon {
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: 'Nunito Sans', sans-serif;

.dragon li,
.gu-mirror {
  background: #BAFFF4;
  color: #000;
  box-shadow: 0 0 5px #000;
  border-radius: 5px;
  margin: 5px 0;
  padding: 15px;
  display: flex;
  align-items: center;
  width: 250px;

.dragon li button, .gu-mirror {
  cursor: -webkit-grab;

.dragon button,
.gu-mirror button {
  margin-right: 10px;
  background: transparent;
  border: none;
  transition: all 500ms;

.dragon button[aria-pressed="true"] {
  background: #6495ED;
  transition: background 500ms;

.add-item {
  font-size: 15px;
  font-weight: 100;
  padding: 10px;
  box-shadow: 0 1px 10px #000;
  border: none;
  color: #fff;
  background: #465F99;
  margin: 15px 0;

.gu-mirror {
  box-sizing: border-box;
  position: fixed !important;
  margin: 0 !important;
  z-index: 9999 !important;
  opacity: 0.8;

.gu-hide {
  display: none !important;

.gu-unselectable {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;

.gu-transit {
  opacity: 0.2;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
  filter: alpha(opacity=20);
  list-style: none;


                const { Component } = React;

class App extends Component {
  constructor() {
    this.state = { items: 3 };
    this.addItem = this.addItem.bind(this);
  componentDidMount() {
    const dragonDrop = new DragonDrop(this.dragon);
    this.setState({ dragonDrop });
  componentDidUpdate() {
    const { dragonDrop } = this.state;
    // this public method allows dragon drop to
    // reassess the updated items and handles
  render() {
    const lis = [];
    const { items } = this.state;
    for (let i = 0; i < items; i++) {
        <li key={i}>
          <button className='fa fa-bars' aria-label='Reorder' />
          {`Item ${i + 1}`}
    return (
        <h1>Dragon drop with React</h1>
        <h2>Sort the items</h2>
        <p id='help'>Activate the reorder button and use the arrow keys to reorder the list or use your mouse to drag/reorder.  Press escape to cancel the reordering.</p>
        <ol aria-labelledby='help' className='dragon' ref={el => this.dragon = el}>
        <button className='add-item' type="button" onClick={this.addItem}>Add Item</button>
  addItem() {
    this.setState(({items}) => ({
      items: items + 1

ReactDOM.render(<App />, document.getElementById('root'));