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

abaabil.dialog

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abaabil.dialog

  • 0.1.3
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-80%
Maintainers
0
Weekly downloads
 
Created
Source

Dialog Component

npm version npm downloads

The Dialog component is a versatile and customizable modal dialog built with React. It supports different variants, sizes, and provides accessibility features, making it suitable for a wide range of use cases.

Usage

import * as React from 'react';
import Dialog from 'abaabil.dialog';
import Button from 'abaabil.button';

const App = () => {
  const [isOpen, setIsOpen] = React.useState(false);

  const openDialog = () => setIsOpen(true);
  const closeDialog = () => setIsOpen(false);

  return (
    <div>
      <Button onClick={openDialog}>Open Dialog</Button>
      <Dialog
        isOpen={isOpen}
        onClose={closeDialog}
        title="Dialog Title"
        subtitle="Dialog Subtitle"
        variant="primary"
        size="df"
      >
        <p>This is the content of the dialog.</p>
      </Dialog>
    </div>
  );
};

export default App;

Props

PropTypeDefaultDescription
isOpenbooleanfalseWhether the dialog is open or not.
onClosefunctionnullCallback function to handle closing the dialog.
titlestring''The title of the dialog.
subtitlestring''The subtitle of the dialog.
childrennodenullThe content to display inside the dialog.
variantstringprimaryThe dialog variant. Can be primary, secondary, tertiary, success, or error.
sizestringmdThe size of the dialog. Can be cp, md, or sp.
classNamestring''Additional class names to apply to the dialog.
...propsobject{}Additional props to pass to the dialog element.

Variants

  • primary: Default dialog style with primary background and text.
  • secondary: Secondary dialog style with secondary background and text.
  • tertiary: Tertiary dialog style with tertiary background and text.
  • success: Success dialog style with success background and text.
  • error: Error dialog style with error background and text.

Sizes

  • cp: Small dialog size.
  • md: Medium dialog size.
  • sp: Large dialog size.

Example

import * as React from 'react';
import Dialog from 'abaabil.dialog';
import Button from 'abaabil.button';

const Example = () => {
  const [isOpen, setIsOpen] = React.useState(false);

  const openDialog = () => setIsOpen(true);
  const closeDialog = () => setIsOpen(false);

  return (
    <div>
      <Button onClick={openDialog}>Open Dialog</Button>
      <Dialog
        isOpen={isOpen}
        onClose={closeDialog}
        title="Dialog Title"
        subtitle="Dialog Subtitle"
        variant="primary"
        size="df"
      >
        <p>This is the content of the dialog.</p>
      </Dialog>
    </div>
  );
};

export default Example;

This example demonstrates various ways to use the Dialog component, showcasing different variants, sizes, and states.

Keywords

FAQs

Package last updated on 18 Aug 2024

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