Metadata-Version: 2.4
Name: streamlit-number-controller
Version: 0.1.0
Summary: A compact plus/minus number controller for Streamlit apps.
Project-URL: Homepage, https://github.com/KentaroAOKI/streamlit-number-controller
Project-URL: Repository, https://github.com/KentaroAOKI/streamlit-number-controller
Project-URL: Issues, https://github.com/KentaroAOKI/streamlit-number-controller/issues
Author: Kentaro
License-Expression: MIT
License-File: LICENSE
Keywords: component,controller,counter,number-input,streamlit
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: User Interfaces
Requires-Python: >=3.10
Requires-Dist: streamlit>=1.50
Description-Content-Type: text/markdown

# streamlit-number-controller

A compact plus/minus number controller for Streamlit apps.

```python
import streamlit as st
from streamlit_number_controller import number_controller

value = number_controller(
    title="Quantity",
    min_value=0,
    max_value=10,
    default_value=1,
    key="quantity",
    minus_color="#ef4444",
    plus_color="#2563eb",
    minus_button_color="#fee2e2",
    plus_button_color="#dbeafe",
)

st.write("Current value:", value)
```

## Installation

```bash
pip install streamlit-number-controller
```

## API

```python
number_controller(
    title: str,
    min_value: int,
    max_value: int,
    default_value: int,
    *,
    key: str | None = None,
    step: int = 1,
    minus_icon: str = ":material/remove:",
    plus_icon: str = ":material/add:",
    minus_color: str | None = None,
    plus_color: str | None = None,
    minus_button_color: str | None = None,
    plus_button_color: str | None = None,
) -> int
```

The controller stores its value in `st.session_state`, keeps the displayed value and returned value in sync, and clamps changes to `min_value` / `max_value`.

## Development

Run the example app:

```bash
streamlit run examples/app.py
```

Build the package:

```bash
python -m build
```

Upload to TestPyPI:

```bash
python -m twine upload --repository testpypi dist/*
```

Upload to PyPI:

```bash
python -m twine upload dist/*
```
