Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@windui/snackbar

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@windui/snackbar

WindUI | Snackbar Package | by Swôth

  • 2.0.4
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source
Developed with ❤️ by Swôth

npm install npm version

Installation

npm i @windui/snackbar --save
yarn add @windui/snackbar

Snackbar Components ᴺᴱᵂ

new Snackbar({
    title: "Hello components!",
    message: "Confirm or cancel.",
    options: {
        type: "success",
        components: {
            // default: Confirm
            confirmText: "Approuver",
            // default: Cancel
            cancelText: "Annuler",
            confirmEvent: ({ $, event }) => {
                alert(`Clicked to ${$.snackbar.title}`);
                $.hide();
                // also you can use $.show() again
            },
            cancelEvent: ({ $, event }) => {
                alert(`Cancelled!`);
                $.hide();
            }
        }
    }
})

CDN & DOM Usage

<script src="https://cdn.jsdelivr.net/npm/@windui/snackbar@x.x.x/windui.snackbar.min.js"></script>
<script>
    new WuiSnackbar({
        // ...props
    }).show();
</script>

React Example

import Snackbar from "@windui/snackbar";

export default function Index() {
    const trigger = () => {
        const hello = new Snackbar({
            options: {
                duration: 3000,
                speed: 500, // animation speed
                type: "info", // snackbar types: info, success, error, warning
                align: "right", // right or left
                position: "bottom" // top or bottom
            },
            title: "Hello World!",
            message: "No post on Sundays!"
        });

        // show snackbar
        hello.show();

        // hide before timeout
        // hello.hide();
    };

    return (
        <button onClick={trigger}>
            Show Snackbar!
        </button>
    );
};

Keywords

FAQs

Package last updated on 13 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc