Pen Settings

HTML

CSS

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

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

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.

HTML

              
                meta(name="viewport" content="width=device-width, initial-scale=1.0")
#app.chatbox
	.colorPanel(:style='{display: colorPanelShown ? "flex":"none",opacity: colorPanelShown ? "flex":"none"}')
		.colorPanel__colorSlot(v-for='color in colors')
			.colorPanel__color(:style='{background: color}',@click='setColor(color)')
	.chatbox__header
		.chatbox__headerText Robert Smith
			.chatbox__onlineDot
		.chatbox__button(v-on:click='colorPanelShown = !colorPanelShown')
	.chatbox__messages
		.chatbox__messageBox(v-for='message in messages',:class='{"chatbox__messageBox--primary": message.primary}')
			.chatbox__message(:class='{"chatbox__message--primary": message.primary}',:style='{background: message.primary ? chatColor:"inital"}') {{message.text}}
				.chatbox__tooltip.chatbox__tooltip--left {{message.date}}
	.chatbox__inputPanel
		input.chatbox__input(v-model='newMessage',@keyup.enter='send',placeholder='Aa')
		.chatbox__tooltip.chatbox__tooltip--bottom(:style='{opacity: (newMessage.length > 2 && !this.tutorialSeen) ? 0.7:0}') Press enter to send the message
		//.chatbox__button +
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Roboto')
borderRadius = 15px
body
	margin 0
	font-family 'Roboto'
.visible
	opacity 1
.colorPanel
	position absolute
	margin 70px auto
	left 0
	right 0
	height 200px
	width 200px
	z-index 3
	background white
	display flex
	flex-wrap wrap
	justify-content center
	align-items center
	border-radius borderRadius
	box-shadow 0 0 30px #aaa
	transition all 0.12s
	&__colorSlot
		box-sizing border-box
		width 33%
		height 33%
		padding 10px
	&__color
		height 100%
		width 100%
		border-radius 100px
		cursor pointer
		background #eee
		transition-duration 0.12s
		&:hover
			opacity 0.7
.chatbox
	display block
	position relative
	max-width 400px
	margin 70px auto
	padding 10px
	background white
	border-radius borderRadius
	box-shadow 0 0 30px #eee
	font-size 17px
	@keyframes blinking
		0%
			opacity 1
		50%
			opacity 0.3
		100%
			opacity 1
	&__header
		display flex
		justify-content center
		align-items center
		flex-wrap nowrap
		font-weight 900
		padding 10px 0
		width 100%
		text-align center
		cursor default
		justify-content space-between
		border-bottom 2px solid #f5f5f5
	&__headerText
			width 100%
			display flex
			justify-content center
			align-items center
			padding-left 20px
	&__onlineDot
		display block
		background #00C853
		height 10px
		width 10px
		border-radius 10px
		margin-left 5px
		animation-name blinking
		animation-duration 1.5s
		animation-iteration-count infinite
	&__tooltip
		opacity 0
		z-index 2
		width auto
		font-size 12px
		text-align center
		padding 3px 10px
		cursor default
		position absolute
		color white
		box-sizing border-box
		border-radius borderRadius
		background #111
		transition all 0.14s
		&--bottom
			top 115%
			margin-left 110px
			opacity 0.2
		&--left
			right calc(100%+5px)
			right -moz-calc(100%+5px)
			margin-left 5px
			top 5px
	&__messages
		width 100%
		padding 10px
		box-sizing border-box
	&__messageBox
		width 100%
		margin-top 5px
		position relative
		&--primary
			text-align right
	&__message
		position relative
		display inline-block
		padding 5px 20px
		border-radius borderRadius
		cursor default
		background #f1f1f1
		transition all 0.12s
		&:hover
			opacity 0.7
			.chatbox__tooltip
				opacity 1
		&--primary
			color white
	&__inputPanel
		width 100%
		position relative
		display flex
		justify-content space-between
		align-items center
	&__input
		font-family 'Roboto'
		font-size 1em
		width 100%
		border none
		background #f3f3f3
		margin 0 10px
		padding 5px 15px
		color #444
		border-radius borderRadius
		box-sizing border-box
	&__button
		display inline-block
		height 20px
		width 22px
		color white
		border-radius borderRadius
		background #0084ff
		cursor pointer
		font-weight 900
		transition-duration 0.1s
		&:hover
			opacity 0.7
@media screen and (max-width: 450px)
	.chatbox
		box-sizing border-box
		margin 0
		max-width 100%
		width 100%
		border-radius 0
		height 100%
              
            
!

JS

              
                new Vue({
	el: '#app',
	data: {
		chatColor: '#0084ff',
		colorPanelShown: false,
		newMessage: '',
		tutorialSeen: false,
		colors: ['#0084ff','#ffc300','#4af844',
						 '#7646ff','#a695c7','#ff5ca1',
						 '#fa3c4c','#f56b78','#33343f'],
		messages: [
			{id: 0, text: 'Hi there', primary: false, date: moment().format('hh:mm')},
			{id: 1, text: 'Hi rob!', primary: true, date: moment().format('hh:mm')},
			{id: 2, text: 'This is better than messenger xD', primary: false, date: moment().format('hh:mm')},
			{id: 3, text: 'ofc', primary: true, date: moment().format('hh:mm')},
			{id: 4, text: 'everything is better than messenger.. XD', primary: true, date: moment().format('hh:mm')},
			{id: 2, text: 'ok, chill bro ಠ_ಠ thats just ez script made with vue.js', primary: false, date: moment().format('hh:mm')},
			{id: 4, text: 'but look how it is cute <3', primary: true, date: moment().format('hh:mm')}
		]
	},
	methods: {
		send: function(){
			if(this.newMessage.length > 0){
				let lastId = this.messages[this.messages.length-1];
				this.messages.push({id: lastId+1, text: this.newMessage, primary: true, date: moment().format('hh:mm')});
				this.newMessage = '';
				this.tutorialSeen = true;
			}
		},
		setColor: function(color){
			this.chatColor = color;
			this.colorPanelShown = false;
		}
	}
});
              
            
!
999px

Console