Metadata-Version: 2.1
Name: dash-id-utils
Version: 0.0.2
Home-page: https://github.com/pragmatic-dash/dash-id-utils
Author: mapix
Author-email: mapix.me@gmail.com
License: MIT
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown

# Dash ID Utils

## Install

```bash
pip install dash-id-utils
```

## Usage

```python
from dash import html, ALL, callback


class AnnotatedImageListSidebar(html.Div):
    class slots:
        id = DashIDGenerator(page="session", type="view", name="image-list")
        image = DashIDGenerator(page="session", type="view", name="image")

    def __init__(self, items, **kwargs):
        self.items = items
        super().__init__(self.render(), id=self.slots.id.get_identifier(), **kwargs)        


    def render(self):
        return [
            html.Img(src=item.url, id=self.slots.image.get_identifier(item.id))
            for item in items
        ]

@callback(
    [...]
    AnnotatedImageListSidebar.slots.image.get_input("n_clicks", ALL),
)
def x(all_n_clicks):
    ...

@callback(
    [
        AnnotatedImageListSidebar.slots.id.get_output("children"),
    ]
    ...
)
def y(...):
    ...
```
