Function Repository Resource:

InsertCellButton

Source Notebook

Generate a button that inserts cells next to itself

Contributed by: Bob Sandheinrich

ResourceFunction["InsertCellButton"][cell]

returns a button that inserts cell after itself.

ResourceFunction["InsertCellButton"][label,cell]

uses label as the button label.

ResourceFunction["InsertCellButton"][label,cell,direction]

inserts the cell in the specified direction.

Details and Options

The direction can be Before or After.
cell can be any valid Cell expression.
ResourceFunction["InsertCellButton"] is not a holding function. cell is evaluated when the button is created.

Examples

Basic Examples (1) 

Create a button and click it:

In[1]:=
ResourceFunction["InsertCellButton"][Cell["Hello World", "Text"]]
Out[1]=

Hello World

Scope (2) 

Specify a button label:

In[2]:=
ResourceFunction["InsertCellButton"][
 Style["Add a bullet", Bold, Blue], Cell["Hello World", "Text"]]
Out[2]=

Hello World

Insert a print cell above the button:

In[3]:=
ResourceFunction["InsertCellButton"][
 Style["Add a bullet", Bold, Blue], Cell["Hello World", "Print"], Before]
Out[3]=

Click the button three times to make three cells:

In[4]:=
ResourceFunction["InsertCellButton"][Cell[":)", "Text"]]
Out[4]=

:)

:)

:)

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 01 February 2019

License Information