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.


                <label for="string">Slug:</label>
<input id="string" type="text" autocomplete="off">
<input type="checkbox" id="titlecase" />&nbsp;<span for="titlecase">Title Case</span>
<button onclick="convertString()">Apply</button>
<label for="results">Results:</label>
<input id="results" type="text" readonly/>


                label {
  display: block;
  width: 80px;

input[type="text"], a, button {
  margin: 10px 0;
  padding: 10px;
  width: 300px;
  max-width: 100%;

a, button {
  border: 1px solid #777;
  background-color: #ccc;
  width: auto;
  margin: 10px;


 * Convert string into title style capitalization (each word)
 * @param {string}  string string to capitalize
var titleStyle = (string) => {
  'use strict';
	var stringArray = string.split(' '),
		  jointString = [],

  //capitalizing each word on array
	for (i in stringArray) {
      if (stringArray.hasOwnProperty(i)) {
          //console.log(typeof i, i);
          itemValue = stringArray[i];
          if (itemValue.length > 2 || (itemValue.length < 2 && Math.abs(i) === 0)) {
              itemValue.substring(0, 1).toUpperCase()
              + itemValue.substring(1, itemValue.length));
			    } else {
  //joining capitalized worlds or returning string as is
	tStyle = (jointString.length > 0) ? jointString.join(' ') : string;
	return tStyle;

 * Convert slugged string into user readable friendly format, title format optional
 * @param {string}  slug string formatted for easy developing
 *                  and data transport with no spaces
 * 							    only alphanumerics, hashes and underscores.
 * @param {boolean} titleStyle value true by default
var slugToString = (slug, tStyle = true) => {
	//converting hashes and underscore into blank spaces
	var newString = slug.replace(/-|_/g, ' ');
  //optional, converting into title case
	if (tStyle) { newString = titleStyle(newString); }
	return newString;

function convertString () {
  var stringField = $('#string'),
      resultField = $('#results'),
      tstyleField = $('#titlecase'),
      tstyle =':checked');
  if (stringField.val().length === 0) {
    alert('Enter slug string');
    return false;
  resultField.val( slugToString( stringField.val(), tstyle ) );
  return false;