I have customized my gridview in Yii2 to show columns, headers, and pager in a certain way
'dataProvider' => $dataProvider, //'filterModel' => $searchModel, 'filterSelector' => 'select[name="per-page"]', 'tableOptions'=> ['class'=>'table datatable-header-footer datatable-header-footer'], 'showFooter' => true, 'layout'=>"{items}\n\n{summary}\n\n<div class='text-right'>{pager}</div>\n", //'summary' => "{begin} - {end} {count} {totalCount} {page} {pageCount}", 'summary' => " <br/> Affichage de {begin} à {end} des {totalCount} lignes <br/> <br/>", 'formatter' => ['class' => 'yii\i18n\Formatter','nullDisplay' => ' - '], 'pager' => [ 'nextPageLabel' => '→', 'prevPageLabel' => '←', 'firstPageLabel' => true, 'maxButtonCount' => 5, 'lastPageLabel' => true ], 'columns' => [ // ['class' => 'yii\grid\SerialColumn'], //'id', ... ['class' => 'yii\grid\ActionColumn', 'contentOptions' => ['style' => 'width:10%;'], 'header'=>'Actions', 'template' => '{all}', 'buttons' => [ 'all' => function ($url, $model, $key) { return ButtonDropdown::widget([ 'encodeLabel' => false, 'label' => 'Choisir', 'dropdown' => [ 'encodeLabels' => false, 'items' => [ [ 'label' => \Yii::t('yii', '<i class="icon-search4"></i> Details'), 'url' => ['view', 'id' => $key], ], [ 'label' => \Yii::t('yii', '<i class="icon-pencil5"></i> Modifier'), 'url' => ['update', 'id' => $key], 'visible' => true, ], [ 'label' => \Yii::t('yii', '<i class="icon-list"></i> Annonces'), 'url' => ['annonces', 'agence_id' => $key], 'visible' => true, ], [ 'label' => \Yii::t('yii', '<i class="icon-list2"></i> Agents'), 'url' => ['professionnels', 'agence_id' =>$key], 'visible' => true, ], [ 'label' => \Yii::t('yii', '<i class="icon-bin"></i> Supprimer'), 'linkOptions' => [ 'data' => [ 'method' => 'post', 'confirm' => \Yii::t('yii', 'Are you sure you want to delete this item?'), ], ], 'url' => ['delete', 'id' => $key], 'visible' => true, // same as above ], ], 'options' => [ 'class' => 'dropdown-menu-right', // right dropdown ], ], 'options' => [ 'class' => 'btn-default', 'style' => 'padding-left: 5px; padding-right: 5px;', // btn-success, btn-info, et cetera ], 'split' => true, ]); Im wondering if there is a way to create a gridview "style" so I can call and apply this style to every gridview in the project !