Get help from the marimo community

Updated 2 weeks ago

use mo.ui.refresh without displaying the button in the app

At a glance

The community member wants to use the mo.ui.refresh functionality to periodically update figures in their app, but they don't want to display the refresh button. The community members discuss a solution where they can hide the refresh component by setting its display property to none. The solution provided is to create the refresh component, set its style to hide it, and then use it in the app view without the component being visible.

Useful resources
I'd like to use the mo.ui.refresh https://docs.marimo.io/api/inputs/refresh/?h=refresh functionality in my app to periodically update some figures in my app, but I would rather not display the refresh button in the app, is there a way to get the refresh functionality without rendering the refresh button in the app?
Attachment
image.png
Marked as solution
ohh, sorry maybe my example wasn't clear.
Plain Text
refresh = mo.ui.refresh(default_interval="1s")
refresh.style({"display": "none"})

another cell
Plain Text
refresh
# rest of your code here

in the app view, the component shouldn't show up.
View full solution
S
A
M
8 comments
Plain Text
refresh = mo.ui.refresh(default_interval="1s")
refresh.style({"display": "none"})

Might be able to achieve this with styling.
sadly the style method isn't doing anything for me 😦
Attachment
image.png
ohh, sorry maybe my example wasn't clear.
Plain Text
refresh = mo.ui.refresh(default_interval="1s")
refresh.style({"display": "none"})

another cell
Plain Text
refresh
# rest of your code here

in the app view, the component shouldn't show up.
refresh.style({"display": "none"}) this is sufficient to render the refresh component although invisible
lmk if there's still issues/unintuitive!
so, even this should work
Plain Text
mo.vstack([
    refresh.style({"display": "none"}),
    mo.md(f"Time is counting: {datetime.now()}")
], gap=0)
oh yeah! thank you so much @Shahmir ! that worked perfectly!
(sorry deleted my message, didn't see the solution above)
Add a reply
Sign up and join the conversation on Discord