Working with files
Connecting to data sources
Coding and analysis tools
Security and privacy
Deepnote for education
Adding input blocks
Input blocks are a great way to add different user inputs to be used as variables within your code and SQL blocks.
You can easily add an input block to your notebook by clicking on the + (add block) button. From there, scroll down to the Inputs section to choose from 4 different types of input blocks: text, select, slider or date input.
Once you've added an input block, you can click on its name to adjust various settings.
- Customize your variable name.
- Explore more options for the given input type. For instance, for slider input, you can set minimum and maximum values.
- Delete the input block.
Using input variables
You can use these inputs as variables within part of your code. For example, you can use text input variables within print statements, as seen in the image below.
You can also pass on input variables as parameters in your SQL blocks.
Input blocks can also be used to create interactive apps and dashboards from your published projects.
Dynamic input variables
In some cases, you may want to dynamically generate the list of available values in select inputs instead of using pre-defined values. You can do so by clicking on input settings and select the 'From variable' option at the Values section. In the dropdown you will need to pick one of your existing variables (supported python types that can be used are:
Once you select the variable, the values in the list will be then made available as user inputs in the select input dropdown.