Dialog Context
A lightweight, customizable modal/dialog provider using React Context API. Easily control dialogs across your app using a simple show()
and close()
interface.
✨ Features
- ⚙️ Context-based API with
show()
andclose()
- 🎨 Customizable: width, background, color, padding, shadow
- 🎞️ Built-in animations:
bounce
,opacity
,scale
, orplain
- 🖱️ Optional click-outside and ESC-to-close behavior
- 🧼 Automatic CSS injection (no manual styles needed)
📦 Installation
- Copy
DialogContextProvider.tsx
to your project. - Wrap your root or layout component with it.
🚀 Usage
1. Wrap your app with the provider
`
tsx
import DialogContextProvider from '@jtech-works/dialog';
import App from './App';
export default function Root() { return ( <DialogContextProvider width="500px" background="#fff" color="#000" closeOnClickOutside closeOnClickEsc padding="1rem" animation="bounce" > <App /> </DialogContextProvider> ); }