Create TMP Buttons through code

Is there a way to create Unity’s default TMP Buttons with some internal function?
I’ve been searching and I’ve only found the attached code, which is used to create the Legacy ones.
Is there any way or do I have to create the GameObject and add all the components by hand?

[MenuItem(GameObject/UI/MyScript Button")]
private static void CreateButtonWithMyScript()
{
    GameObject buttonGO = DefaultControls.CreateButton(new DefaultControls.Resources());
    buttonGO.layer = 5;
    buttonGO.AddComponent<MyScript>();
}

Thanks in advance :slight_smile:

I´ve found the solution.
It isn't in UnityEngine.UI, it is in TMPro.
A code that work for me is the next but I have to put the images by hand.

[MenuItem(GameObject/UI/MyScript Button")]
private static void CreateButtonWithMyScript()
{
   GameObject buttonGO = TMP_DefaultControls.CreateButton(new TMP_DefaultControls.Resources());
   buttonGO.AddComponent<MyScript>();
   // rest of the code
}