You can enable TextMeshPro support with Project Settings… / New UI Widgets / TextMeshPro Support / Enable. If TextMeshPro not installed option will not be available.
After enabling support:
widgets created with menu UI / New UI Widgets / will use TextMeshPro instead of the default Text
generated widgets will be using TextMeshPro instead of the default Text
You can disable support the same way with Project Settings… / New UI Widgets / TextMeshPro Support / Disable.
Support is enabled only to installed platforms. Platforms that were added after it requires enabling support again.
TextMeshPro support is enabled by adding
UIWIDGETS_TMPRO_SUPPORT directive to the Scripting Define Symbols in the Player Settings and forced scripts recompilation.
Starting with version 1.12 TextMeshPro support is done with
InputFieldAdapter components. Those are adapters for the actual Unity and TextMeshPro components. This allows replacing Text components without any code changes.