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

mui-prompt

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mui-prompt

Easy, simple, stackable and global prompt and popover

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Mui-Prompt

Awesome and simple prompt components

with mui-prompt you can easily ask user for confirmation before executing an important action

drawing

Demo

Dialog

drawing

Inline

drawing
Demo

Install it

Mui-Prompt uses standard theme provider and will take your theme aswell!

nikandlv@nikandlv.ir:~$ npm i mui-prompt

Import it

import Prompt from "mui-prompt";

Dialog variant

render the prompt view

export default class PromptDemo extends React.Component {
  render() {
    function simplePrompt() {
      Prompt.ask("simple", {
        callback: status => {
          console.log(status);
        },
      });
    }

    return (
      <div>
        <Prompt.View />
        <button onClick={simplePrompt}>click me!</button>
      </div>
    );
  }
}

API

Prompt.ask first parameter is the key of dialog and second parameter is the configuration which can be these values

const config = {
  callback: callback,
  title: "Are you sure?",
  body: "This action can not be undone!",
  cancel: "Cancel",
  continue: "Continue",
  nested: false,
};

Note: nested should be only applied on the parents and not the last nested item

Inline variant

In order to use inline variant simply wrap your Button, IconButton or any other component you want with Prompt.Inline component

export default class InlineDemo extends React.Component {
  render() {
    return (
      <div>
        <Prompt.Inline variant="button">
          <button onClick={simplePrompt}>click me!</button>
        </Prompt.Inline>
        <Prompt.Inline variant="icon">
          <button onClick={simplePrompt}>click me!</button>
        </Prompt.Inline>
      </div>
    );
  }
}

Component props

<Prompt.Inline
  variant={"button" || "icon"}
  cancelText="Cancel"
  continueText="Continue"
  cancelIcon={CancelIcon}
  continueIcon={DeleteIcon}
  callback={callback}
/>

Keywords

FAQs

Package last updated on 18 Dec 2019

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