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.


	<title>How to use Toastr</title>
	<!-- jQuery -->
	<script src=""></script>
	<!-- Toastr -->
	<link rel="stylesheet" type="text/css" href="">
	<script type="text/javascript" src=""></script>
	<!-- Styles -->
	<style type="text/css">
		body {background: whitesmoke;text-align: center;}
		button{background-color: darkslategrey;color: white;border: 0;font-size: 18px;font-weight: 500;border-radius: 7px;padding: 10px 10px;cursor: pointer;white-space: nowrap;}
		#success{background: green;}
		#error{background: red;}
		#warning{background: coral;}
		#info{background: cornflowerblue;}
		#question{background: grey;}
		<h1>How to use <b>Toastr</b></h1>
			<h4>Popup Type</h4>
			<p>Toastr have 4 popup type and the different is icon and background</p>
			<button id="success" >Success</button>
			<button id="info" >Info</button>
			<button id="error" >Error</button>
			<button id="warning">Warning</button>
			<h4>Image and Loading</h4>
			<p>Popup notification with image and progress bar</p>
			<button id="image">Image and Loading</button>
			<p>There is 8 Toastr position support</p>
			<form id="positionForm">
				<input type="radio" name="position" value="top-left" checked>Top Left
				<input type="radio" name="position" value="top-center">Top Center
				<input type="radio" name="position" value="top-right">Top Right
				<input type="radio" name="position" value="top-full-width">Top Full Width
				<input type="radio" name="position" value="bottom-left">Bottom Left
				<input type="radio" name="position" value="bottom-center">Bottom center
				<input type="radio" name="position" value="bottom-right">Bottom right
				<input type="radio" name="position" value="bottom-full-width">Bottom Full Width
			<button id="position">Show Toast</button>

	<script type="text/javascript">
	// Default Configuration
		$(document).ready(function() {
			toastr.options = {
				'closeButton': true,
				'debug': false,
				'newestOnTop': false,
				'progressBar': false,
				'positionClass': 'toast-top-right',
				'preventDuplicates': false,
				'showDuration': '1000',
				'hideDuration': '1000',
				'timeOut': '5000',
				'extendedTimeOut': '1000',
				'showEasing': 'swing',
				'hideEasing': 'linear',
				'showMethod': 'fadeIn',
				'hideMethod': 'fadeOut',

	// Toast Type
		$('#success').click(function(event) {
			toastr.success('You clicked Success toast');
		$('#info').click(function(event) {'You clicked Info toast')
		$('#error').click(function(event) {
			toastr.error('You clicked Error Toast')
		$('#warning').click(function(event) {
			toastr.warning('You clicked Warning Toast')

	// Toast Image and Progress Bar
		$('#image').click(function(event) {
			toastr.options.progressBar = true,'<img src="" style="width:150px;">', 'Toast Image')

	// Toast Position
		$('#position').click(function(event) {
			var pos = $('input[name=position]:checked', '#positionForm').val();
			toastr.options.positionClass = "toast-" + pos;
			toastr.options.preventDuplicates = false;'This sample position', 'Toast Position')