/toasts

UI Toast notifications

Primary LanguageClojure

README

tape.toasts

About

A Toast is a non-modal, unobtrusive window element used to display brief, auto-expiring windows of information to a user.

Install

deps.edn
{:deps {tape/toasts {:local/root "../toasts"}}}

Usage

List toasts

Add toasts listing to a layout view via toasts.v/index partial:

app/layout/view.cljs
(ns my.app.layout.view
  (:require [tape.toasts.view :as toasts.v]))

(defn layout []
  [:div
    ...
    [toasts.v/index]])

The style is based on Bulma, but you can use your own style based on it’s classes or make your own partial for listing. To include the style add:

hiccup
[:link {:rel "stylesheet" :href "/tape/toasts.css"}]

Create a toast

app/some/controller.cljs
(ns my.app.some.controller
  (:require [re-frame.core :as rf]
            [tape.toasts.controller :as toasts.c]))

(rf/dispatch [::toasts.c/create :info "Some message"])
;; Toast kind can be one of: :success, :danger, :warning, :info

License

Copyright © 2020 clyfe

Distributed under the MIT license.