You can create an @Input attribute called “required” and have this bound to the “required” property of your text input. Another thing I usually do is have an abstract class that does all of the above and then any component that I want to turn into a custom form element extends it. That way the code is written just once.

Google Developer Expert in Angular, Consultant and Trainer at