In the future, please search for your answer before asking it here on the forum. If you put your exact question text into google, the top result is the Mendix documentation on building custom widgets.
As Eric says, try the search. You see the search button on the top right of the page? If you search for "widget development", you will find information on both the forum as well as the documentation.