Skip to main content

A base component library for Dash applications

Project description

Dash Base Component

=====================

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.2.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.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dash_basecomponent-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 f2701dc11ea87a4ad27494f2e1a711dfc56f297eeff9f0975642b3149a33bc95
MD5 f7abb84098b2da18e3263370955d82c3
BLAKE2b-256 372f91eb08ddcc6e611b865ce892235235c1df09c3bdcc89593627eeef617b72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dash_basecomponent-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 21be28527e9aa00603c8cae1ba775b32177cdd46719e2398e4629a47c0bc1c76
MD5 f672ef147b353aab454bf9eba5666d3a
BLAKE2b-256 2550a8b17f8bd137a6994013267163f031dd4e139163cc2dee6a2f9d6692d813

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