Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <!-- Credit: Form Design is inspired by Aswin Madhulal (https://dribbble.com/shots/7209761-Feedback-much-appreciated) -->
<div class="content">
	<header>
		<h1>Feel free to drop us your feedback.</h1>
		<!-- 	Credit: https://undraw.co/ -->
		<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1457119/feedback-form.svg"
			  alt="A woman is sitting on the floor and working on a laptop (vector illustration)" />
	</header>
	<main mv-app="feedbackForm" mv-mode="read">
		<form mv-action="add(group('score': score, 'comment': comment, 'startDate': group('month': month, 'year': year)), feedbackFormData.feedback) set(score, 5) set(comment, '') set(month, '') set(year, '')">
			<label>
				<h2>
					How satisfied are you overall with the support of your Delivery Partner?
				</h2>

				<div class="tickmarks">
					<span mv-multiple="tickmark"
							mv-value="0 .. 10"
							class="[if($this = score, highlight)]"
							mv-action="set(score, $this)"></span>
				</div>

				<input property="score"
						 type="range" max="10"
						 style="--score: [score * 10]%" />

				<div class="legend">
					<span mv-action="set(score, 0)">
						Not at all likely
					</span>
					<span mv-action="set(score, 10)">
						Extremely likely
					</span>
				</div>
			</label>

			<textarea property="comment"
						 cols="30" rows="10"
						 placeholder="Please tell us your reasons for giving this score here..."></textarea>

			<h2>
				Now please tell us the month and the year on which the following first happened
			</h2>

			<section property="startDate">
				<p>
					I first started to trade (selling goods / delivering services) and receiving income
				</p>

				<select property="month">
					<option value="">Month</option>
					<option mv-multiple="monthOption"
							  mv-value="1 .. 12"
							  mv-attribute="value"
							  mv-mode="read"> <!-- This attribute is used here only to force Firefox work properly! -->
						[month('2019-' & digits(2, $this) & '-01', 'shortname')]
					</option>
				</select>

				<select property="year">
					<option value="">Year</option>
					<option mv-multiple="yearOption"
							  mv-value="2010 .. year($today)"
							  mv-attribute="value"
							  mv-mode="read"> <!-- This attribute is used here only to force Firefox work properly! -->
						[$this & '']
					</option>
				</select>
			</section>
			
			<button type="submit" disabled="[!month or !year]">
				Send Feedback
			</button>
		</form>
	</main>
</div>

<footer mv-app>
	<h3>Stored Data</h3>
	<pre>[if(count(feedbackFormData.feedback) > 0, log(feedbackFormData))]</pre>
</footer>

<!-- Storage -->
<div mv-app="feedbackFormData"
	  mv-storage="https://github.com/DmitrySharabin"
	  mv-storage-branch="master"
	  mv-bar="none"
	  mv-autosave="1">
	
	<p class="mv-logged-out"><a href="?feedbackFormData-login">Log in to GitHub</a> to be able to collect feedback.</p>

	<article hidden mv-multiple="feedback"
				mv-initial-items="0"
				mv-order="desc"></article>
</div>
              
            
!

CSS

              
                :root {
	--bg-color: #DDEFF0;
	--primary-color: #3B7885;
	--secondary-color: #58959D;
	--accent-color-1: #B1D6D9;
	--accent-color-2: #EFF7F8;
}

*, *::before, *::after {
	box-sizing: border-box;
}

html {
	height: 100%;
	
	display: grid;
	justify-content: center;
	align-items: center;
}

body {
	max-width: 60em;
	
	color: var(--primary-color);
	background-color: #FAFCFE;
	
	font-family: sans-serif;
}

a {
	color: inherit;
	font-weight: bold;
}

.content {
	display: grid;
	grid-template-columns: 1fr 1fr;

	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

header {
	display: flex;
	flex-direction: column;
	justify-content: center;
	
	background-color: var(--bg-color);
	
	h1 {
		margin: 2em 1em;
		font-size: 250%;
	}
	
	img {
		height: auto;
		max-width: 30em;
		
		margin-bottom: 2em;
	}
}

[mv-app] {
	padding: 2em 2.5em;
	
	h2 {
		font-size: 100%;
		font-weight: 600;
		
		line-height: 1.3;
		
		color: var(--secondary-color);
	}
}

.tickmarks {
	display: grid;
	grid-template-columns: repeat(11, 1fr);
	gap: 1.25em;
	justify-items: center;
	
	margin-top: 2.5em;
	
	color: var(--accent-color-1);

	font-size: 90%;
	font-weight: bold;
	
	.highlight {
		color: var(--primary-color);
	}
	
	span {
		cursor: pointer;
	}
}

// Slider
[property="score"] {
	display: block;
	margin: 1em 0 1.5em 0;
	
	width: 100%;
	
	cursor: pointer;
	
	// Google Chrome
	-webkit-appearance: none;
	
	&:focus {
		outline: none;
		box-shadow: 0 0 3px 3px var(--accent-color-1);
	}
	
	&::-webkit-slider-thumb {
		--thumb-size: 1em;
		
		margin-top: calc(var(--thumb-size) * -1 / 3);
		height: var(--thumb-size);
		width: var(--thumb-size);
		
		background-color: var(--primary-color);

		border-radius: 50%;
		
		box-shadow: 0 0 0 5px var(--bg-color);
		
		-webkit-appearance: none;
	}
	
	&::-webkit-slider-runnable-track {
		height: 0.5em;
		
		border-radius: 0.3em;
		
		background-color: var(--bg-color);
		background-image: linear-gradient(to right, var(--primary-color) var(--score, 0%), transparent var(--score, 0%));	
	}
	
	// Mozilla Firefox
	&::-moz-range-thumb {
		background-color: var(--primary-color);

		border-radius: 50%;
		border-color: var(--bg-color);
		border-width: 5px;
	}
	
	&::-moz-range-track {
		height: 0.5em;
		
		border-radius: 0.3em;
		
		background-color: var(--bg-color);
		background-image: linear-gradient(to right, var(--primary-color) var(--score, 0%), transparent var(--score, 0%));
	}
}

.legend {
	display: flex;
	justify-content: space-between;
	
	margin: -0.2em 0 0;
	
	font-size: 80%;
	
	color: var(--accent-color-1);
	
	span {
		cursor: pointer;
	}
}

[property="comment"] {
	resize: none;
	
	width: 100%;
	height: 12em;
	
	margin: 3em 0 2.5em;
	padding: 1em;
	
	border: none;
	border-radius: 0.3em;
	
	color: var(--secondary-color);
	background-color: var(--bg-color);
	
	&::placeholder {
		font-size: 110%;
		
		color: var(--primary-color);
		
		// For Chrome 
		filter: opacity(45%);
	}
	
	&:focus {
		outline: none;
		box-shadow: 0 0 3px 3px var(--accent-color-1);
	}
}

[property="startDate"] {
	display: grid;
	grid-template-columns: 3fr 1fr 1fr;
	gap: 0.3em;
	align-items: center;
	
	margin: 1.5em 0;
	padding: 0;
	
	border: none;
	
	color: var(--secondary-color);
	
	p {
		font-size: 80%;
	}
	
	select {
		display: block;
		
		padding: 0.3em 0.4em;
		
		background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%2358959D" d="M15.3 9.3a1 1 0 0 1 1.4 1.4l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 0 1 1.4-1.4l3.3 3.29 3.3-3.3z"/></svg>');
		background-position: center right;
		background-size: 2em 2em;
		background-repeat: no-repeat;
		
		border-radius: 0.5em;
		border: 1px solid var(--bg-color);
		
		appearance: none;
		color: inherit;
		
		cursor: pointer;
		
		transition: background-color 100ms ease;
		
		&:hover {			
			background-color: var(--bg-color);
		}
		
		&:focus {
			outline: none;
			box-shadow: 0 0 3px 3px var(--accent-color-1);
		}
	}
}

// The Send Feedback button
button[type="submit"] {
	width: 100%;
	margin: 2em 0 1em;
	padding: 0.7em 1em;
	
	border: none;
	border-radius: 0.5em;
	
	color: var(--accent-color-2);
	background-color: var(--primary-color);
	
	font-size: 90%;
	font-weight: 200;
	
	transition: background-color 300ms ease;
	
	&:disabled {
		color: var(--accent-color-1);
		background-color: var(--bg-color);
	}
	
	&:not(:disabled):hover {
		background-color: var(--secondary-color);
		
		cursor: pointer;				
	}
	
	&:not(:disabled):focus {
		outline: none;
		box-shadow: 0 0 5px 5px var(--accent-color-1);
	}
}


pre {
	tab-size: 2;
	-moz-tab-size: 2;
	
	// Credit: https://css-tricks.com/solved-with-css-logical-styling-based-on-the-number-of-given-elements/#article-header-id-0
	&:empty::after {
		content: "No feedback yet 😔";
	}
}

::-moz-focus-inner {
    border: 0;
}
              
            
!

JS

              
                
              
            
!
999px

Console