Grid layout system for moving components around.
Project description
Dash Dynamic Grid Layout
Dash Dynamic Grid Layout is a Dash component library that provides a flexible grid layout system for arranging and moving components within a Dash application.
Features
- Drag-and-drop functionality for rearranging components
- Resizable grid items
- Customizable layout with responsive breakpoints
- Option to add or remove items dynamically
- Customizable drag handles for each item
Installation
pip install dash-dynamic-grid-layout
Usage
Here's a basic example of how to use the DashGridLayout component:
import dash_dynamic_grid_layout as dgl
from dash import Dash, html, dcc
import plotly.express as px
app = Dash(__name__)
df = px.data.iris()
app.layout = html.Div([
dgl.DashGridLayout(
id='grid-layout',
children=[
dgl.DraggableWrapper(
children=[
html.Div('Drag me!', style={'height': '100%', 'display': 'flex', 'alignItems': 'center', 'justifyContent': 'center', 'border': '1px solid #ddd', 'borderRadius': '5px'})
],
handleText='Move'
),
dgl.DraggableWrapper(
children=[
dcc.Graph(
figure=px.scatter(df, x="sepal_width", y="sepal_length", color="species"),
style={'height': '100%'}
)
],
handleText='Move Graph'
)
],
rowHeight=150,
cols={'lg': 12, 'md': 10, 'sm': 6, 'xs': 4, 'xxs': 2},
style={'height': '600px'},
)
])
if __name__ == '__main__':
app.run_server(debug=True)
Prop Reference
DashGridLayout
Property | Type | Default | Description |
---|---|---|---|
id | string | - | The ID used to identify this component in Dash callbacks |
children | list | - | A list of dash components to be rendered in the grid |
currentLayout | list | [] | The current layout of the grid items |
rowHeight | number | 100 | The height of a single row in pixels |
cols | dict | { lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 } | An object containing breakpoints and column numbers |
compactType | string | 'vertical' | Compaction type. Can be 'vertical', 'horizontal', or null |
showRemoveButton | bool | True | Whether to show remove buttons for grid items |
showResizeHandles | bool | True | Whether to show resize handles for grid items |
DraggableWrapper
Property | Type | Default | Description |
---|---|---|---|
children | node | - | The content to be wrapped and made draggable |
handleBackground | string | "rgb(85,85,85)" | Background color of the drag handle |
handleColor | string | "white" | Text color of the drag handle |
handleText | string | "Drag here" | Text to display in the drag handle |
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
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_dynamic_grid_layout-0.0.3.tar.gz
(280.7 kB
view hashes)
Built Distribution
Close
Hashes for dash_dynamic_grid_layout-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11013e763063412ba69dba39d5345eb557b6e865540e436773549f7966a9249b |
|
MD5 | a973a99be94b774753103c13fc9ece2b |
|
BLAKE2b-256 | 20e25361cfe0c46e26e544f8223a6e4d75a53d5fe8503cbb1961c478f4b58ca4 |
Close
Hashes for dash_dynamic_grid_layout-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d373d1a5a138adeb6cdf739e091b1f0f049fcafa608e4ad115e6633b3cc2d860 |
|
MD5 | 3dc8530c7771690d0ee24cca2d111cd0 |
|
BLAKE2b-256 | 3c48c26e537090facfeb478d5c0ef4082446caf97dd149593ea2203c88b521f0 |