No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Notify close button

    Framework
    3
    4
    1779
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sebag last edited by

      Hi,

      Is it possible to add a closing button in the top corner in Notify?

      080ddde4-07c9-4613-89a4-4b1501f098e2-image.png

      Thank you.

      1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel last edited by

        You can use and modify the ‘html’ message.

        https://quasar.dev/quasar-plugins/notify#Example--Unsafe-HTML-message

        1 Reply Last reply Reply Quote 0
        • S
          sebag last edited by

          This is what I’ve done, let me know if that can be done better. For example grouping doesn’t work with this, I’m not sure why:

          import Vue from "vue";
          import { Platform } from "quasar";
          import { Notify } from "quasar";
          import { uid } from "quasar";
          
          const notification = (msg = "", type = "info") => {
            // id for the notification message so it can be dismissed if user clicks the button
            const alert_uid = uid();
            if (!window.dismiss) window.dismiss = [];
            // add a close button to the notification
            msg += `
            <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
            <button style="position:absolute;top:-4px;right:-13px;background-color: inherit;
            border: none;
            border-radius: 50%;
            margin: 0px 0px 0px 0px;
            padding: 0px 0px 0px 0px;
            cursor: pointer;
            height:18px;width:18px;
            outline:none;
            "
            onclick="window.dismiss['${alert_uid}']();
            delete window.dismiss['${alert_uid}'];
            "
            >
            <svg style="width:18px;height:18px" viewBox="0 0 24 24">
              <path fill = "${
                type === "info" ? "black" : "white"
              }" d = "M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z" />
          </svg >
          </button>`;
          
            // create dismissable notification
            const dismiss = Notify.create({
              progress: true,
              message: msg,
              textColor: type === "info" ? "black" : "white",
              multiLine: true,
              type: type,
              html: true,
              position: Platform.is.mobile ? "top" : "bottom-right",
            });
          
            // store dismissable notification in the global array
            window.dismiss[alert_uid] = dismiss;
          };
          
          export default ({ Vue }) => {
            Vue.prototype.$notification = notification;
          };
          
          1 Reply Last reply Reply Quote 0
          • P
            pd76 last edited by

            @sebag well, late to the party, but you could do something like…

                      actions: [
                        {
                          icon: 'close',
                          color: 'white',
                          handler: () => {},
                        },
                      ],
            

            and your css could be…

            .q-notification__actions .q-btn__wrapper.col.row.q-anchor--skip {
              padding: 0px !important;
              font-size: 8px !important;
            }
            
            .q-notification__actions .q-btn__wrapper.col.row.q-anchor--skip i {
              position: absolute;
              top: -10px;
              font-weight: bold;
            }
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post