dash-prism 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Ludwig Jonsson
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,7 @@
1
+ recursive-include dash_prism *.js *.js.map *.json *.css *.html
2
+ include LICENSE
3
+ include README.md
4
+ prune tests
5
+ prune .github
6
+ global-exclude __pycache__
7
+ global-exclude *.py[cod]
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.4
2
+ Name: dash_prism
3
+ Version: 0.1.0
4
+ Summary: Prism: Advanced multi-panel workspace manager for Plotly Dash
5
+ Author-email: Ludwig Jonsson <developer-prism@protonmail.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/LudwigAJ/dash-prism
8
+ Project-URL: Repository, https://github.com/LudwigAJ/dash-prism.git
9
+ Project-URL: Issues, https://github.com/LudwigAJ/dash-prism/issues
10
+ Keywords: dash,plotly,plotly-dash,dashboard,workspace,tabs,panels,layout,ui,components,drag-and-drop
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Framework :: Dash
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: dash>=3.1.1
23
+ Provides-Extra: test
24
+ Requires-Dist: pytest>=7.0.0; extra == "test"
25
+ Requires-Dist: pytest-cov>=4.0.0; extra == "test"
26
+ Requires-Dist: pytest-xdist>=3.0.0; extra == "test"
27
+ Requires-Dist: dash[testing]>=3.1.1; extra == "test"
28
+ Provides-Extra: dev
29
+ Requires-Dist: dash[dev]>=3.1.1; extra == "dev"
30
+ Requires-Dist: build>=1.0.0; extra == "dev"
31
+ Requires-Dist: wheel>=0.40.0; extra == "dev"
32
+ Requires-Dist: pyyaml>=6.0.0; extra == "dev"
33
+ Provides-Extra: docs
34
+ Requires-Dist: sphinx>=7.0.0; extra == "docs"
35
+ Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == "docs"
36
+ Dynamic: license-file
37
+
38
+ # Dash Prism
39
+
40
+ [![CI](https://github.com/LudwigAJ/dash-prism/actions/workflows/ci.yml/badge.svg)](https://github.com/LudwigAJ/dash-prism/actions/workflows/ci.yml)
41
+ [![Docs](https://github.com/LudwigAJ/dash-prism/actions/workflows/docs.yml/badge.svg)](https://ludwigaj.github.io/dash-prism/)
42
+
43
+ A multi-panel workspace manager for Plotly Dash applications.
44
+
45
+ **Documentation:** https://ludwigaj.github.io/dash-prism/
46
+
47
+ ## What is Dash Prism?
48
+
49
+ Dash Prism provides a unified workspace where multiple Dash layouts coexist as
50
+ tabs within resizable, splittable panels. Users arrange their workspace via
51
+ drag-and-drop while developers focus on building content.
52
+
53
+ ## The Problem
54
+
55
+ Building dashboards with Plotly Dash typically means:
56
+
57
+ - **Fragmented applications** - Each dashboard lives in isolation, requiring
58
+ users to switch between browser tabs or navigate complex menus.
59
+ - **Repetitive UI work** - Developers spend time on layout scaffolding, tab
60
+ systems, and panel management instead of business logic.
61
+ - **One-size-fits-all layouts** - Users get a fixed arrangement that may not
62
+ match their workflow.
63
+ - **No personalization** - Workspaces reset on every visit; users cannot save
64
+ their preferred view.
65
+
66
+ ## The Solution
67
+
68
+ Dash Prism addresses these issues by providing:
69
+
70
+ - **Unified workspace** - Register any number of layouts; users open them as
71
+ tabs in a single interface.
72
+ - **User-driven design** - Drag tabs to split panels, resize areas, and
73
+ rearrange freely. Developers define content; users define structure.
74
+ - **Persistence** - Workspace state saves to localStorage, sessionStorage, or
75
+ memory so users return to exactly where they left off.
76
+ - **Minimal boilerplate** - A decorator-based API keeps layout registration
77
+ concise and readable.
78
+
79
+ ## Installation
80
+
81
+ **Requirements:** Python 3.10+, Dash 3.1.1+
82
+
83
+ ```bash
84
+ pip install dash-prism
85
+ ```
86
+
87
+ ## Quick Start
88
+
89
+ ```python
90
+ import dash
91
+ from dash import html
92
+ import dash_prism
93
+
94
+ app = dash.Dash(__name__)
95
+
96
+ @dash_prism.register_layout(id='home', name='Home', icon='Home')
97
+ def home():
98
+ return html.Div('Welcome to Dash Prism')
99
+
100
+ @dash_prism.register_layout(id='analytics', name='Analytics', icon='BarChart3')
101
+ def analytics():
102
+ return html.Div('Analytics content here')
103
+
104
+ app.layout = html.Div([
105
+ dash_prism.Prism(id='workspace', persistence=True)
106
+ ])
107
+
108
+ dash_prism.init('workspace', app)
109
+
110
+ if __name__ == '__main__':
111
+ app.run(debug=True)
112
+ ```
113
+
114
+ ## Development
115
+
116
+ ### Setup
117
+
118
+ ```bash
119
+ # Clone and enter the project
120
+ git clone https://github.com/LudwigAJ/dash-prism.git
121
+ cd dash-prism
122
+
123
+ # Create a virtual environment
124
+ python -m venv .venv
125
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
126
+
127
+ # Install dependencies
128
+ pip install -r requirements.txt
129
+ npm install
130
+
131
+ # Build
132
+ npm run build
133
+ ```
134
+
135
+ ### Using Just
136
+
137
+ If you have [just](https://github.com/casey/just) installed:
138
+
139
+ ```bash
140
+ just install # Install Python and npm dependencies
141
+ just build # Build the package
142
+ just test # Run tests
143
+ ```
144
+
145
+ ## Contributing
146
+
147
+ Contributions are welcome. Please:
148
+
149
+ 1. Fork the repository.
150
+ 2. Create a feature branch.
151
+ 3. Write tests for new functionality.
152
+ 4. Ensure all tests pass (`pytest`).
153
+ 5. Submit a pull request.
154
+
155
+ See the [Contributing Guide](https://ludwigaj.github.io/dash-prism/contributing.html)
156
+ in the documentation for more details.
157
+
158
+ ## License
159
+
160
+ Apache License 2.0. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,123 @@
1
+ # Dash Prism
2
+
3
+ [![CI](https://github.com/LudwigAJ/dash-prism/actions/workflows/ci.yml/badge.svg)](https://github.com/LudwigAJ/dash-prism/actions/workflows/ci.yml)
4
+ [![Docs](https://github.com/LudwigAJ/dash-prism/actions/workflows/docs.yml/badge.svg)](https://ludwigaj.github.io/dash-prism/)
5
+
6
+ A multi-panel workspace manager for Plotly Dash applications.
7
+
8
+ **Documentation:** https://ludwigaj.github.io/dash-prism/
9
+
10
+ ## What is Dash Prism?
11
+
12
+ Dash Prism provides a unified workspace where multiple Dash layouts coexist as
13
+ tabs within resizable, splittable panels. Users arrange their workspace via
14
+ drag-and-drop while developers focus on building content.
15
+
16
+ ## The Problem
17
+
18
+ Building dashboards with Plotly Dash typically means:
19
+
20
+ - **Fragmented applications** - Each dashboard lives in isolation, requiring
21
+ users to switch between browser tabs or navigate complex menus.
22
+ - **Repetitive UI work** - Developers spend time on layout scaffolding, tab
23
+ systems, and panel management instead of business logic.
24
+ - **One-size-fits-all layouts** - Users get a fixed arrangement that may not
25
+ match their workflow.
26
+ - **No personalization** - Workspaces reset on every visit; users cannot save
27
+ their preferred view.
28
+
29
+ ## The Solution
30
+
31
+ Dash Prism addresses these issues by providing:
32
+
33
+ - **Unified workspace** - Register any number of layouts; users open them as
34
+ tabs in a single interface.
35
+ - **User-driven design** - Drag tabs to split panels, resize areas, and
36
+ rearrange freely. Developers define content; users define structure.
37
+ - **Persistence** - Workspace state saves to localStorage, sessionStorage, or
38
+ memory so users return to exactly where they left off.
39
+ - **Minimal boilerplate** - A decorator-based API keeps layout registration
40
+ concise and readable.
41
+
42
+ ## Installation
43
+
44
+ **Requirements:** Python 3.10+, Dash 3.1.1+
45
+
46
+ ```bash
47
+ pip install dash-prism
48
+ ```
49
+
50
+ ## Quick Start
51
+
52
+ ```python
53
+ import dash
54
+ from dash import html
55
+ import dash_prism
56
+
57
+ app = dash.Dash(__name__)
58
+
59
+ @dash_prism.register_layout(id='home', name='Home', icon='Home')
60
+ def home():
61
+ return html.Div('Welcome to Dash Prism')
62
+
63
+ @dash_prism.register_layout(id='analytics', name='Analytics', icon='BarChart3')
64
+ def analytics():
65
+ return html.Div('Analytics content here')
66
+
67
+ app.layout = html.Div([
68
+ dash_prism.Prism(id='workspace', persistence=True)
69
+ ])
70
+
71
+ dash_prism.init('workspace', app)
72
+
73
+ if __name__ == '__main__':
74
+ app.run(debug=True)
75
+ ```
76
+
77
+ ## Development
78
+
79
+ ### Setup
80
+
81
+ ```bash
82
+ # Clone and enter the project
83
+ git clone https://github.com/LudwigAJ/dash-prism.git
84
+ cd dash-prism
85
+
86
+ # Create a virtual environment
87
+ python -m venv .venv
88
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
89
+
90
+ # Install dependencies
91
+ pip install -r requirements.txt
92
+ npm install
93
+
94
+ # Build
95
+ npm run build
96
+ ```
97
+
98
+ ### Using Just
99
+
100
+ If you have [just](https://github.com/casey/just) installed:
101
+
102
+ ```bash
103
+ just install # Install Python and npm dependencies
104
+ just build # Build the package
105
+ just test # Run tests
106
+ ```
107
+
108
+ ## Contributing
109
+
110
+ Contributions are welcome. Please:
111
+
112
+ 1. Fork the repository.
113
+ 2. Create a feature branch.
114
+ 3. Write tests for new functionality.
115
+ 4. Ensure all tests pass (`pytest`).
116
+ 5. Submit a pull request.
117
+
118
+ See the [Contributing Guide](https://ludwigaj.github.io/dash-prism/contributing.html)
119
+ in the documentation for more details.
120
+
121
+ ## License
122
+
123
+ Apache License 2.0. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,192 @@
1
+ """Action Component Wrapper.
2
+
3
+ User-facing wrapper for the Action component with comprehensive documentation.
4
+ This file provides a clean Python API that wraps the auto-generated PrismActionComponent.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from .PrismActionComponent import PrismActionComponent
10
+
11
+
12
+ class Action(PrismActionComponent):
13
+ """A clickable action button for the Prism status bar.
14
+
15
+ Action components are displayed in the status bar and provide
16
+ interactive buttons that users can click to trigger callbacks. Each action
17
+ is an independent Dash component with its own ``n_clicks`` property,
18
+ allowing for individual callback handling per button.
19
+
20
+ :param id: Unique identifier for this action in Dash callbacks.
21
+ Use this ID to create callbacks responding to button clicks.
22
+ :type id: str or None
23
+ :param label: Button label text displayed in the status bar.
24
+ This is the visible text users will see on the button. **Required**.
25
+ :type label: str
26
+ :param icon: Icon name to display before the label.
27
+ Use :func:`get_available_icons` to see all available icons, or check
28
+ if a specific icon exists with ``icon_name in AVAILABLE_ICONS``.
29
+ Examples: ``'Rocket'``, ``'Brain'``, ``'BarChart3'``, ``'Coffee'``.
30
+ :type icon: str or None
31
+ :param tooltip: Tooltip text shown on hover.
32
+ If not provided, defaults to ``"Click to trigger {label}"``.
33
+ :type tooltip: str or None
34
+ :param style: Button style variant or custom hex color.
35
+ Preset styles: ``'default'``, ``'primary'``, ``'secondary'``,
36
+ ``'success'``, ``'warning'``, ``'danger'``.
37
+ Custom color: Any valid hex color (e.g., ``'#FF5500'``).
38
+ :type style: str or None
39
+ :param disabled: Whether the button is disabled. Disabled buttons cannot
40
+ be clicked and appear grayed out. Can be controlled via Dash callbacks
41
+ for dynamic enabling/disabling. Defaults to ``False``.
42
+ :type disabled: bool
43
+ :param loading: Whether to show a loading spinner. When ``True``, replaces
44
+ the icon with a spinner and disables the button. Useful for indicating
45
+ async operations are in progress. Defaults to ``False``.
46
+ :type loading: bool
47
+ :param n_clicks: Number of times the button has been clicked. Use as an
48
+ ``Input`` in Dash callbacks to respond to clicks. Automatically
49
+ incremented each time the button is clicked. Defaults to ``0``.
50
+ :type n_clicks: int
51
+
52
+ .. rubric:: Examples
53
+
54
+ Basic action button:
55
+
56
+ .. code-block:: python
57
+
58
+ import dash_prism
59
+ from dash import Dash, html, Input, Output
60
+
61
+ app = Dash(__name__)
62
+
63
+ app.layout = html.Div([
64
+ dash_prism.Prism(
65
+ id='workspace',
66
+ actions=[
67
+ dash_prism.Action(
68
+ id='save-action',
69
+ label='Save',
70
+ icon='Save',
71
+ tooltip='Save current workspace'
72
+ )
73
+ ]
74
+ )
75
+ ])
76
+
77
+ @app.callback(
78
+ Output('save-action', 'loading'),
79
+ Input('save-action', 'n_clicks'),
80
+ prevent_initial_call=True
81
+ )
82
+ def handle_save(n_clicks):
83
+ # Perform save operation
84
+ import time
85
+ time.sleep(1) # Simulate async operation
86
+ return False # Stop loading spinner
87
+
88
+ Multiple actions with different styles:
89
+
90
+ .. code-block:: python
91
+
92
+ actions = [
93
+ dash_prism.Action(
94
+ id='save',
95
+ label='Save',
96
+ icon='Save',
97
+ style='primary'
98
+ ),
99
+ dash_prism.Action(
100
+ id='export',
101
+ label='Export',
102
+ icon='Download',
103
+ style='secondary'
104
+ ),
105
+ dash_prism.Action(
106
+ id='delete',
107
+ label='Delete All',
108
+ icon='Trash2',
109
+ style='danger',
110
+ tooltip='WARNING: This will delete all data'
111
+ ),
112
+ ]
113
+
114
+ app.layout = html.Div([
115
+ dash_prism.Prism(id='workspace', actions=actions)
116
+ ])
117
+
118
+ Dynamic enabling/disabling:
119
+
120
+ .. code-block:: python
121
+
122
+ from dash import State
123
+
124
+ @app.callback(
125
+ Output('save-action', 'disabled'),
126
+ Input('workspace', 'readWorkspace')
127
+ )
128
+ def update_save_button(workspace):
129
+ # Disable save button if no tabs are open
130
+ if not workspace or not workspace.get('tabs'):
131
+ return True # Disabled
132
+ return False # Enabled
133
+
134
+ Custom color action:
135
+
136
+ .. code-block:: python
137
+
138
+ custom_action = dash_prism.Action(
139
+ id='custom',
140
+ label='Custom',
141
+ icon='Palette',
142
+ style='#FF5500', # Custom orange color
143
+ tooltip='Custom colored action'
144
+ )
145
+
146
+ Loading state management:
147
+
148
+ .. code-block:: python
149
+
150
+ @app.callback(
151
+ Output('export-action', 'loading'),
152
+ Input('export-action', 'n_clicks'),
153
+ prevent_initial_call=True
154
+ )
155
+ def handle_export(n_clicks):
156
+ # Set loading=True while operation runs
157
+ import time
158
+ time.sleep(2) # Simulate export operation
159
+ return False # Loading complete
160
+
161
+ .. seealso::
162
+
163
+ :class:`Prism`
164
+ Main workspace component
165
+
166
+ :func:`dash_prism.init`
167
+ Initialize Prism with Dash app
168
+
169
+ .. note::
170
+
171
+ - Actions must be passed to the Prism component's ``actions`` parameter
172
+ - Each action has an independent ``n_clicks`` counter
173
+ - The ``loading`` state automatically disables the button
174
+ - Custom hex colors must be valid CSS hex colors (e.g., ``#RGB`` or ``#RRGGBB``)
175
+ - Icons use the Lucide icon library - ensure icon names match exactly
176
+ """
177
+
178
+ # Override _type to match what init.py expects (internal wire protocol)
179
+ _type = "PrismAction"
180
+
181
+ def __init__(self, **kwargs):
182
+ """Initialize Action component.
183
+
184
+ :param kwargs: All parameters accepted by the Action component.
185
+ See class docstring for full parameter list.
186
+ :type kwargs: dict
187
+ """
188
+ super().__init__(**kwargs)
189
+
190
+
191
+ # Backwards compatibility alias
192
+ PrismAction = Action