Metadata-Version: 2.4
Name: callback_error_plugin_demo_8
Version: 0.0.1
Summary: A plugin to print Dash app errors on the header section of the page
Home-page: https://github.com/banana0000/Hook-test
Author: koveszter
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: dash>=3.0.3
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# Dash Error Plugin Demo

A Dash plugin to display callback errors in your Dash app.

## Installation

```bash
pip install callback-error-plugin_demo_8
```

## Usage

```python
from dash import Dash, dcc, html, callback, Input, Output, State
import callback_error_plugin_demo_7

# Add the error notification system to your app
callback_error_plugin_demo_7.add_error_notifications("Error message")

app = Dash(__name__)

app.layout = html.Div(
    [
        html.H2("Division Calculator"),
        # The error notification banner will be automatically added by the plugin
        html.Label("Enter a number:", htmlFor="input-number"),
        dcc.Input(id="input-number", type="number", value=1),
        html.Button("Calculate", id="calc-btn", n_clicks=0),
        html.Div(id="output-div"),
    ]
)

@callback(
    Output("output-div", "children"),
    Input("calc-btn", "n_clicks"),
    State("input-number", "value"),
)
def update_output(n_clicks, value):
    if not n_clicks:
        return ""
    try:
        result = 10 / value
        return f"The result is {result}"
    except Exception as e:
        # The error banner will display the error automatically
        return ""

if __name__ == "__main__":
    app.run(debug=True)
```

## Running the Example

```bash
python example.py
```

## Notes

- The error banner will automatically appear at the top of your app when a callback error occurs.
- You can customize the error message by changing the argument to `add_error_notifications`.
- The plugin handles showing and hiding the error banner for you.

---

**Enjoy building with Dash!**
