Widgets are reusable building blocks used in [views](structure-views.md) to create complex and configurable user
interface elements in an object-oriented fashion. For example, a date picker widget may generate a fancy date picker
that allows users to pick a date as their input. All you need to do is just to insert the code in a view
like the following:
Widgets are self-contained building blocks for your views, a way to combine complex logic, display, and functionality into a single component. A widget:
```php
<?php
useyii\bootstrap\DatePicker;
?>
<?=DatePicker::widget(['name'=>'date'])?>
```
There are a good number of widgets bundled with Yii, such as [[yii\widgets\ActiveForm|active form]],