Metadata-Version: 2.4
Name: instaui-mermaid
Version: 0.2.0
Summary: A Python package for generating mermaid diagrams in InstaUI.
Author-email: CrystalWindSnake <568166495@qq.com>
License-Expression: MIT
License-File: LICENSE
Keywords: gui,instaui,mermaid,ui,web
Requires-Python: <3.14,>=3.10
Requires-Dist: instaui>=0.8.5
Description-Content-Type: text/markdown

# instaui-mermaid

<div align="center">

English| [简体中文](./README.md)

</div>

## 📖 Introduction
instaui-mermaid is a Python package for generating mermaid diagrams in InstaUI. It is a part of the InstaUI project, which is a Python-based UI library for rapidly building user interfaces.


## 🚀Installation

```shell
pip install instaui-mermaid instaui[web]
```

```shell
uv add instaui-mermaid instaui[web] 
```

## 📚Usage

```python
from instaui_mermaid import Mermaid
from instaui import ui

@ui.page("/")
def index():
    graph = r"""
    graph TD
    a --> b
"""
    # ui
    Mermaid(graph)

ui.server(debug=True).run()
```

Dynamic graph:

```python
from instaui_mermaid import Mermaid
from instaui import ui, html


@ui.page("/")
def index():
    themes = ["default", "neutral", "dark", "forest", "base"]
    theme = ui.state(themes[0])

    graph = ui.str_format(
        r"""
---
config:
  theme: {theme}
---
    graph TD
    a --> b
""",
        theme=theme,
    )

    # ui
    html.select.from_list(themes, value = theme)
    Mermaid(graph)

ui.server(debug=True).run()
```