A widget is a program created that facilitates the user's interaction with different functions of a system. Widgets include visual elements such as icons, menus, buttons, scroll bars, pop-ups, countdowns, etc.
In web development, a widget is a generic term describing parts of GUI (graphical user interface) used to compose a program interface. It is prewritten code that defines a widget, and its behavior, allowing programmers to build applications quickly.
Many languages come with a ready-made library of widgets that a developer can incorporate and modify easily without having to start working from scratch.