Toasts

View code

Use

HTML

<rg-toasts></rg-toasts>

JavaScript

var tags = riot.mount('rg-toasts', {
  toasts: {
    position: 'bottomright|bottomleft|topleft|topright',
    toasts: [{
      type: 'primary',
      text: 'Made you look!',
      sticky: true // Turn off timeout
    }, {
      type: 'secondary',
      text: 'Careful now...'
    }, {
      type: 'success',
      text: 'You did it!'
    }, {
      type: 'error',
      text: 'Oops!',
      timeout: 4000 // Default to 6000 if not set
    }]
  }
})

tags[0].on('close', function (toast) { ... })
       .on('select', function (toast) { ... })