represents an object which maintains the same local instance of the symbols x, y, in the course of all evaluations of Dynamic objects in expr. Symbols specified in a DynamicModule will by default have their values maintained even across Wolfram System sessions.


specifies initial values for x, y, .

Details and Options

  • DynamicModule first gives unique names to local variables in expr, just like Module, then evaluates the resulting expression, and then returns a version of this wrapped in DynamicModule.
  • In a notebook, this returned version will often be displayed in an output cell. An example is the output from Manipulate.
  • If interactive changing or editing of Dynamic objects within the displayed form of a DynamicModule results in changes in any values for local variables, then the DynamicModule object is modified to reflect these.
  • Values of local variables in a DynamicModule are by default automatically saved when a notebook containing the DynamicModule is saved, so that these values in effect persist across sessions of the Wolfram System.
  • If you make a copy of a piece of a notebook that contains a DynamicModule object, the local variables in the copy will be independent of the local variables in the original, though they will start with the same values.
  • The following options can be given:
  • BaseStyle{}base style specifications for the displayed object
    DeinitializationNonean expression to evaluate when the DynamicModule can no longer be displayed
    DynamicModuleValuesAutomaticdynamically updated data on variable values
    InheritScopeFalseconnect DynamicModule variables to another DynamicModule instance
    InitializationNonean expression to evaluate when the DynamicModule is first displayed
    SaveDefinitionsFalsewhether to save all definitions related to expr
    SynchronousInitializationTruewhether to perform initialization synchronously
    UndoTrackedVariablesNonevariables which, when changed, should be tracked by the front end's undo mechanism
    UnsavedVariablesNonevariables whose values should not be saved
  • When DynamicModule is first evaluated, initial assignments for local variables are made during the evaluation. Any setting for the Initialization option is evaluated only when the output of DynamicModule is displayed.
  • When a DynamicModule object is displayed for the first time in a particular notebook, saved values for local variables are restored, and then any setting for the Initialization option is evaluated.
  • All values of local variables are saved, except for those included in the UnsavedVariables list. Ordinary values of symbols are saved in the first argument of the DynamicModule; other values are saved in the setting for the DynamicModuleValues option.
  • DynamicModule has attribute HoldAll.
  • DynamicModule constructs can be nested in any way, with inner variables being renamed if necessary.
  • DynamicModule is a scoping construct that implements lexical scoping.


open allclose all

Basic Examples  (1)

Create a Slider with a dynamically updating localized variable:

Click for copyable input

Copy and paste the output above to get a standalone object:


Scope  (6)

Generalizations & Extensions  (1)

Options  (14)

Applications  (3)

Properties & Relations  (2)

Neat Examples  (2)

See Also

Dynamic  Module  Manipulate  LocalizeVariables  Interpretation


Introduced in 2007
| Updated in 2014