michael_teter
Is it possible to toggle a cell on/off?
I use Livebook for experimentation, sort of like REPL-driven development. I find many times when I would like to disable a cell without deleting it.
For example, let’s say I have a cell near the top which does some mutations. But later on, I want to break it down and test some elements incrementally. I still want my “how this should work” example to exist at the top, but I don’t want to run it. I’d like to disable it so my subsequent cells can run.
Yes, I could move the cell down, down, down, down some number of times; or I could select all within the cell and comment out. But I’m hoping for a simple on/off checkbox. If the cell is disabled, then it will be skipped when a lower cell is run from a fresh state.
Most Liked
NduatiK
Last Post!
NduatiK
To toggle a whole cell, I would do:
In Cell 1, create some data
a = 1
In Cell 2, create a checkbox
input = Kino.Input.checkbox("Increment a")
In Cell 3, conditionally update state
a = if Kino.Input.read(input) do
# Do your stuff in here
a + 1
else
a
end
You might need to enable auto re-evaluation using the settings icon on cell 3
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex










