Skip to main content

Dash BaseComponent

A BaseComponent class for building modular Plotly Dash apps.

See this article for more info.

Installation

To install the dash-basecomponent package, use the following command:

pip3 install dash-basecomponent

Usage

To use these components in your own Dash application, simply import the component you want to use and add it to your application's layout.

For example:

from dash import Dash, html, callback
from dash_basecomponent import BaseComponent as bc

class Counter(html.Div, bc):
    def __init__(self, **kwargs):
        super().__init__([
            html.Button("Increment", id=self.child_id("button")),
            html.Span("0", id=self.child_id("count"), style={"marginLeft": "10px"}),
        ], **kwargs)
    
    @callback(
        bc.ChildOutput("count", "children"),
        bc.ChildInput("button", "n_clicks"),
        prevent_initial_call=True
    )
    def increment_count(n_clicks):
        return str(n_clicks)

app = Dash(__name__)
app.layout = Counter()

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

Examples

The examples directory contains several example applications that demonstrate how to use these components.

  • hello_world.py: An example application that uses the InputCombiner and ExpandContract components.
  • tic_tac_toe.py: An example application that uses the Game component.
  • snake.py: An example application that uses the SnakeGameBoard component.
  • example.py: An example application that uses the Counter component.

Contributing

Contributions to this project are welcome. If you have a new component you'd like to add, or if you've found a bug in one of the existing components, please submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for dash-basecomponent 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dash-basecomponent 0.1.4
File Size Uploaded Provenance Actions
dash_basecomponent-0.1.4.tar.gz 3.8 kB Without provenance Details for dash_basecomponent-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dash-basecomponent 0.1.4
File Interpreter ABI Platform Actions
dash_basecomponent-0.1.4-py3-none-any.whl Python 3 none any Details for dash_basecomponent-0.1.4-py3-none-any.whl

Total release size: 8.1 kB

Release files / dash_basecomponent-0.1.4.tar.gz

Download URL dash_basecomponent-0.1.4.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
995f3302d28c4b58137442660bd7fa2bcfc2ac46182b28c17f95c6f3f905c772
BLAKE2b-256 checksum
How to use checksums
a07e64625db332d7c5f580f51c7c292cc580fe7a80cd85681064ea8412fdd2ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / dash_basecomponent-0.1.4-py3-none-any.whl

Download URL dash_basecomponent-0.1.4-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cdc06d63f2a9746fcee00197ae7fa1ea24322e13797864a4b63ecdcb2fef67c2
BLAKE2b-256 checksum
How to use checksums
79db19a701665764448dc9450c17631a25e694a8a4b4310a8c1633b5f56829b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Security for dash-basecomponent 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page