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

              
                <html>
<body>
	<div id="app">
		
		<modal>
			<template slot="callToActionText">
				Test the VueJS modal here
			</template>
			<template slot="modalHeader">
				Sign in to your account
			</template>
			<template slot="modalBody">
				<label>E-mail</label>
				<input type="email" placeholder="[email protected]">
				<label>Password</label>
				<input type="password" placeholder="+8 chars" auto-complete="new-password">
				
			</template>
			<template slot="modalFooter">
				<button class="button">Sign in</button>
			</template>
		</modal>
		
		<script type="text/x-template" id="modal">
			<div class="modal">
				
				<!-- The call to action text -->
				<div class="modal__cta">
					<slot name="callToActionText"></slot>
				</div>
				
				<!-- The modal button -->
				<div class="modal__button">
					<button class="button" @click="click">Open modal</button>
				</div>
				
				<!-- The modal dialog -->
				<div class="modal__dialog" :class="{'active' : active}">
					<div class="modal__content">
						<button class="modal__close" @click="click">
							<i class="fa fa-times"></i>
						</button>
						<h3 class="modal__header">
							<slot name="modalHeader"></slot>
						</h3>
						<div class="modal__body">
							<slot name="modalBody"></slot>
						</div>
						<div class="modal__footer">
							<slot name="modalFooter"></slot>
						</div>
					</div>
				</div>
					
				<!-- The overlay for the modal -->
				<div class="modal__overlay"></div>
			</div>
		</script>
	</div>
	

</body>
</html>
              
            
!

CSS

              
                body, button, input, select
	font-family: 'Catamaran', sans-serif

#app
	display: flex
	justify-content: center
	align-items: center
	height: 100vh

label
	color: rgba(0, 0, 0, .45)
	font-size: 12px
	display: block
input
	border: 1px solid rgba(0, 0, 0, .10)
	background: #ffffff
	box-shadow: none
	color: #000
	padding: 16px
	outline: 0
	margin-bottom: 12px
	border-radius: 2px
	font-weight: 300
	font-size: 11px
	letter-spacing: 1px
	&::placeholder
		color: #c9c9c9
		font-size: 11px
	&:focus
		color: #555555
		background: #ffffff
		border-color: #673ab7

.button 
	cursor: pointer
	background: #673ab7
	border: 0
	border-radius: 50px
	color: #ffffff
	padding: 12px 60px
	font-weight: 700
	font-size: 15px
	outline: 0
	text-transform: uppercase
	margin: 0 auto
	display: table
	&:hover
		background: darken(#673ab7, 5%)

.modal
	display: flex
	justify-content: center
	align-items: center
	min-height: 250px
	flex-direction: column

	&__cta
		margin: 24px 0
		font-size: 24px
		color: rgba(0, 0, 0, .45)

	&__overlay
		position: fixed
		width: 100%
		height: 100%
		visibility: hidden
		top: 0
		left: 0
		z-index: 1000
		opacity: 0
		background: #000000
		transition: all .25s

	&__dialog
		position: fixed
		top: 50%
		left: 50%
		width: 50%
		max-width: 630px
		min-width: 320px
		height: auto
		z-index: 2000
		visibility: hidden
		backface-visibility: hidden
		transform: translateX(-50%) translateY(-50%)
		perspective: 1300px
		&.active 
			opacity: 1
			visibility: visible
			~ .modal__overlay
				opacity: .9
				visibility: visible
			.modal__content
				transform: rotateX(0deg)
				opacity: 1

	&__content
		background: #fafafa
		border-radius: 2px
		padding: 24px
		color: #131313
		position: relative
		transform-style: preserve-3d
		transform: rotateX(-60deg)
		transform-origin: 50% 0
		opacity: 0
		transition: all .25s
		
	&__close
		position: absolute
		right: -16px
		top: -16px
		color: #fff
		background: #673ab7
		border: 0
		outline: 0
		border-radius: 50%
		font-size: 16px
		width: 32px
		height: 32px
		cursor: pointer
	&__header
		text-align: center
		font-weight: 300
		font-size: 24px
		color: rgba(0, 0, 0, .45)
	&__body
		color: #ffffff
		display: flex
		margin: 0 auto
		width: 100%
		max-width: 400px
		flex-direction: column
	&__footer
		margin: 24px 0
              
            
!

JS

              
                Vue.component('modal', {
	template: '#modal',
	data() {
		return {
			active: false
		}
	},
	methods: {
		click(e) {
			this.active =! this.active;
		}
	}
});

new Vue({
	el: '#app'
});
              
            
!
999px

Console