Skip to main content

A base component library for Dash applications

Project description

Dash BaseComponent

A collection of reusable base components for building Dash applications.

Overview

This project provides a set of base components that can be used to build Dash applications. These components are designed to be reusable and customizable, making it easier to build complex Dash applications.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dash_basecomponent-0.1.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dash_basecomponent-0.1.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file dash_basecomponent-0.1.3.tar.gz.

File metadata

  • Download URL: dash_basecomponent-0.1.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for dash_basecomponent-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f4ba98c3341a389455d80657a67c9d0eda21e0fea201f4ed29ead5c5f4ccd253
MD5 d837a896e1f9c8d817eeb544df98dcbf
BLAKE2b-256 5e8be1fc1047eb596385b71d26e2ae2cc88b8c3b49daa8c21510157691b695df

See more details on using hashes here.

File details

Details for the file dash_basecomponent-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for dash_basecomponent-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3dd556dd7073440094cc7cc54a5bbee470f9d74f4ec3cc725a6fd8e1cc4a65b7
MD5 d2a6556fa80aa66ef8777b77ae5a624f
BLAKE2b-256 e786341638f8b74a91ce8a4d7fbd8d8c24ccfb8925fba0629ef5aa24f9976c08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page