cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


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.

              <div ng-app="sortableApp" ng-controller="sortableController" class="container">
  <h2>ui.sortable form builder demo</h2>
  <div class="floatleft">
    <h3>Source<br>(form fields)</h3>
    <ul ui-sortable="sortableOptionsSource" ng-model="fieldTypes" class="list logList">
      <li ng-repeat="item in fieldTypes" class="item">
  <div class="floatleft">
    <h3>Destination<br>(form builder canvas)</h3>
    <ul id="canvas" ui-sortable="sortableOptions" ng-model="list" class="list logList">
      <li ng-repeat="item in list" class="item">
    <button ng-click="addItem()">Add Item</button>

  <div class="floatleft">
    <ul class="list logList" style="width:600px">
      <li ng-repeat="entry in sortingLog track by $index" class="logItem">
  <div class="clear"></div>

  <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
  <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.4/angular.min.js"></script>
  <script src="https://rawgithub.com/angular-ui/ui-sortable/master/src/sortable.js"></script>

              .list {
	list-style: none outside none;
	margin: 10px 0 30px;

.item {
	width: 200px;
	padding: 5px 10px;
	margin: 5px 0;
	border: 2px solid #444;
	border-radius: 5px;
	background-color: #EA8A8A;

	font-size: 1.1em;
	font-weight: bold;
	text-align: center;
	cursor: pointer;

.ui-sortable-helper {
  cursor: move;

/***  Extra ***/

body {
	font-family: Verdana, 'Trebuchet ms', Tahoma;

.logList {
	margin-top: 20px;
	width: 250px;
	min-height: 200px;
	padding: 5px 15px;
	border: 5px solid #000;
	border-radius: 15px;

.logList:before {
	padding: 0 5px;
	position: relative;
	top: -1.1em;
	background-color: #FFF;

.container {
	width: 600px;
	margin: auto;

h2 {
	text-align: center;

.floatleft {
  float: left;

.clear {
  clear: both;
button {
  margin:0 auto;

              var myapp = angular.module('sortableApp', ['ui.sortable']);

myapp.controller('sortableController', function ($scope) {
  //sample data of available form fields
  $scope.fieldTypes = [
    {text: 'Text Entry', value: 'Text Entry'},
    {text: 'Radio Button', value: 'Radio Button'},
    {text: 'Checkboxes', value: 'Checkboxes'},
    {text: 'Select Box', value: 'Select Box'},
    {text: 'File input', value: 'File input'}
  //keep track of the original model to restore it later
  var originalModel = angular.copy($scope.fieldTypes); 
  $scope.list = [];
  $scope.sortingLog = [];
  $scope.sortableOptionsSource = {
    connectWith: "#canvas",
    stop: function (e, ui) {
        // clone the original model to restore the removed item
        $scope.fieldTypes = angular.copy(originalModel);   
  $scope.sortableOptions = {
    axis: 'y',
    update: function(e, ui) {
      var logEntry = $scope.list.map(function(i){
        return i.value;
      }).join(', ');
      $scope.sortingLog.push('Update: ' + logEntry);
    stop: function(e, ui) {
      // this callback has the changed model
      var logEntry = $scope.list.map(function(i){
        return i.value;
      }).join(', ');
      $scope.sortingLog.push('Stop: ' + logEntry);

  $scope.addItem = function() {    
    $scope.list.push( {text: 'Text Entry', value: 'Text Entry'} );

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................