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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

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



// Just some quick and dirty demo styles, don't look here :)
html {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";

svg {
	margin-right: 1rem;

strong {
	display: inline-block;
	font-size: 1.2rem;
	min-width: 6ch;
	text-align: center;

button {
	appearance: none;
	border: 0;
	border-radius: 5px;
	background: indigo;
	color: white;
	font-family: inherit;
	font-size: 1rem;
	padding: 0.5em 1em;
	&:active {
		background: mediumorchid;
		outline: none;
	&[disabled] {
		background: darkgrey;


                class RadialProgressIndicator extends React.Component {
	render() {
		const { progress, strokeColor, strokeWidth, width } = this.props;
		// Determine the center of the circle, as that will be both the `cx` and the `cy` attribute.
		const center = width / 2;
		// The stroke is applied half inside the circle, so we need to account for it in order to make it appear outside the circle.
		const radius = (width / 2) - (strokeWidth / 2);
		// Set the circumference of the circle as our `stroke-dasharray` and our initial `stroke-dashoffset`
		const strokeDasharray = 2 * radius * Math.PI;
		// Express progress as a percentage of stroke-dasharray. The difference between stroke-dasharray and this percentage is the stroke-dashoffset
		const strokeDashoffset = progress > 0 ? (strokeDasharray - (strokeDasharray / 100 * progress)) : strokeDasharray;
		// We make a perfect circle, so it fits in a square.
		const height = width;
		return (
				viewBox={`0 0 ${width} ${height}`}
					transform={`rotate(270, ${center}, ${center})`}

RadialProgressIndicator.propTypes = {
	strokeColor: React.PropTypes.string.isRequired,
	strokeWidth: React.PropTypes.number.isRequired,
	width: React.PropTypes.number.isRequired,
	// The progress prop is just for demo purposes
	progress: React.PropTypes.number.isRequired

class App extends React.Component {
	constructor(props) {
		this._onIncreaseClick = this._onIncreaseClick.bind(this);
		this._onDecreaseClick = this._onDecreaseClick.bind(this);
		this.state = {
			progress: 20
	_onIncreaseClick() {
		// Increase progress but not further than 100.
			progress: Math.min(100, this.state.progress + 10)
	_onDecreaseClick() {
		// Decrease progress but not further than 0.
			progress: Math.max(0, this.state.progress - 10)
	render() {
		const { progress } = this.state;
		return (
					<button onClick={this._onDecreaseClick} disabled={progress === 0}>Decrease progress</button>
					<button onClick={this._onIncreaseClick} disabled={progress === 100}>Increase progress</button>
					<RadialProgressIndicator strokeColor="#BADA55" strokeWidth={10} width={100} progress={progress} />
					<RadialProgressIndicator strokeColor="#BADA55" strokeWidth={20} width={200} progress={progress} />
					<RadialProgressIndicator strokeColor="#BADA55" strokeWidth={30} width={300} progress={progress} />

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