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

              
                #app
  h1 TEST Notification
  notification(:notice="notice")


    
              
            
!

CSS

              
                *
  margin 0
  padding 0
  box-sizing border-box

$success = #03a9f4 //#1a7bb9
$danger = #ec4758
$warning = #f7a54a
$primary = #18a689
$info = #21b9bb

body
  font: 100%/1.6 sans-serif
#app
  display flex
  height 100vh
h1
  margin auto
  
  
.Notification
  width 320px
  position fixed
  z-index 100
  top 1em
  right 1em
  user-select none
  .notice
    background #FFF
    box-shadow 0 0 1em -.5em #000, -.5em 1em 5em -1em rgba(0,0,0,.7)
    padding 1em
    position relative
    //border-left .5em solid $success
  .close
    cursor pointer
    position absolute
    top .5em
    right .5em
    stroke #CCC
    &:hover
      stroke #000
  .title
    font-size 1.4rem
    line-height 1
    margin-bottom .7rem
  .body
    line-height 1.4
    color #333
    font-size 90%

.notice
  border-left .5em solid transparent  
  &.success
    border-color $success
  &.danger
    border-color $danger
  &.warning
    border-color $warning
  &.primary
    border-color $primary
  &.info
    border-color $info
    
.type
  font-size 80%  
  &.success
    color $success
  &.danger
    color $danger
  &.warning
    color $warning
  &.primary
    color $primary
  &.info
    color $info   
              
            
!

JS

              
                const TEST = [ 
  {
    title: 'Notification title',
    body: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Magnam explicabo repellat blanditiis, aperiam beatae eos dolor voluptas eveniet!',
    type: 'success'
  },{
    title: 'Notification title',
    body: 'Amet laborum aspernatur atque. Assumenda, impedit. Adipisci impedit laudantium odio, veritatis earum magni non voluptatem provident, sint iste voluptate ipsum repellendus accusamus.',
    type: 'danger'
  },{
    title: 'Notification title',
    body: 'Architecto ratione iste laboriosam inventore atque facere, iusto sunt error autem facilis voluptas culpa assumenda aliquam cumque! Unde explicabo est odit sit.',
    type: 'warning'
  },{
    title: 'Notification title',
    body: 'Labore id praesentium necessitatibus corporis odit ratione quos eum delectus porro, eos suscipit cum earum officia expedita deleniti. Laborum itaque libero rerum!',
    type: 'primary'
  },{
    title: 'Notification title',
    body: 'Vitae corporis fugit aspernatur praesentium impedit iste eaque adipisci ratione, animi porro libero deserunt, est dolore omnis ullam. Quod nobis incidunt cum.',
    type: 'info'
  },{
    title: 'Notification title',
    body: 'Ducimus minima obcaecati tempore eaque libero aliquam commodi natus rerum cupiditate, doloribus culpa vitae dolorum? Culpa distinctio, deleniti hic dolores officia quo?',
    type: 'danger'
  },{
    title: 'Notification title',
    body: 'Repellendus quod aliquid ad, quae harum similique facilis aliquam. Dolorum deserunt alias officia atque dolor, voluptas harum. Inventore reiciendis reprehenderit provident!',
    type: 'primary'
  } 
];

function randomInt(min, max) {
  let rand = min - 0.5 + Math.random() * (max - min + 1);
  rand = Math.round(rand);
  return rand;
};

Vue.component('notification', {
  template: 
  `
  <div class="Notification" v-show="notice">
    <div class="notice" :class="notice.type">
      <svg @click="notice=!notice" class="close" width="20" height="20" viewbox="0 0 20 20" stroke-width="2">
        <line x1="3" y1="3" x2="17" y2="17"></line>
        <line x1="3" y1="17" x2="17" y2="3"></line>
      </svg>
      <div class="title">
        <i class="type" :class="notice.type">{{notice.type}}</i>
        {{notice.title}}
      </div>
      <div class="body">{{notice.body}}</div>
    </div>
  </div>
  `,
  props: {
     notice: {
      type: [Object, Array]
    },
  },
});

setInterval(() => ( vm.$data.index = randomInt(0, 6) ), randomInt(100, 5000) );
const vm = new Vue({
  el: "#app",
  data: {
    index: 0
  },
  computed: {
    notice() {return TEST[this.index]}
  },
  methods: {}
});


              
            
!
999px

Console