    slider_input = st.slider('My slider', 0, 10, 5, key='my_slider')
    checkbox_input = st.checkbox('Yes or No', key='my_checkbox')
    submit_button = st.form_submit_button(label='Submit', on_click=form_callback)
```
Caveats and limitations
Only the st.form_submit_button has a callback in forms. Other widgets inside a form are not allowed to have callbacks.
on_change and on_click events are only supported on input type widgets.
Modifying the value of a widget via the Session state API, after instantiating it, is not allowed and will raise a StreamlitAPIException. For example:
```python
  slider = st.slider(
      label='My Slider', min_value=1,
      max_value=10, value=5, key='my_slider')
st.session_state.my_slider = 7
# Throws an exception!
  ```
Setting the widget state via the Session State API and using the value parameter in the widget declaration is not recommended, and will throw a warning on the first run. For example:
