-
-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement ButtonIcon and achieve parity with Button/Toggle widgets #6138
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #6138 +/- ##
==========================================
+ Coverage 84.69% 84.72% +0.02%
==========================================
Files 296 296
Lines 44184 44437 +253
==========================================
+ Hits 37423 37650 +227
- Misses 6761 6787 +26
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Okay I think this is ready! params demo Screen.Recording.2023-12-28.at.4.34.01.PM.movjs on click demo Screen.Recording.2023-12-28.at.4.34.57.PM.movimport panel as pn
pn.extension()
button_icon = pn.widgets.ButtonIcon(
icon="clipboard",
active_icon="check",
toggle_duration=1000,
size="5em",
description="Hey",
)
toggle_icon = pn.widgets.ToggleIcon(
icon="heart", active_icon="heart-filled", description="Hey", size="5em"
)
pn.Column(
pn.Row(
button_icon,
button_icon.param.clicks,
button_icon.param.value,
button_icon.param.toggle_duration,
button_icon.param.size,
button_icon.param.disabled,
),
pn.Row(
toggle_icon,
toggle_icon.param.value,
toggle_icon.param.icon,
toggle_icon.param.active_icon,
toggle_icon.param.size,
toggle_icon.param.disabled,
),
).servable() import panel as pn
pn.extension()
button = pn.widgets.ButtonIcon(description="Hello", size="3em")
button.js_on_click(code="alert('Hello, world!')")
button.show() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just one more comment.
Once you've removed the clicks property and it's working this is looking really great, thanks! |
With the latest changes: Screen.Recording.2024-01-09.at.5.44.28.PM.mov |
If you could remove the |
Closes #6038
Abstracts away ToggleIcon into ClickableIcon and makes both inherit from that.
Eventually used for
ChatCopyIcon
, but also many other uses, similar to mobile appsScreen.Recording.2023-12-27.at.6.04.24.PM.mov
Needs tests + docs