When creating a widget, define its form, fields, and behavior using the template elements to specify the widget view and the way it is displayed with HTML and Widget Attributes. The widget template also allows end-users to enter data and interact with it. You can apply HTML tags to add and control elements such as buttons and various types of fields.