michael_teter

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

Last Post!

NduatiK

NduatiK

@christhekeele

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

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130286 1222
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36654 110
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44532 311
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement