How to add non clickable/selectable text in dropdownlist

I am trying to display user’s list in dropdownlist. Here, I want to display user’s role as label, so that listing looks like users grouping based on user’s role. It becomes easy for selection to end user.

<?= $form->field($model, 'user_id')->dropDownList(\yii\helpers\ArrayHelper::map(\common\models\Users::getUsersList(),



        ), ['prompt'=>'Select ']) ?>

public static function getUsersList(){

        $data =[];

        $roles = UserRoles::find()->where(['status'=>1])->all();

        foreach($roles as $role){

            $data[] = ['id'=>'','name'=>'<label>'.$role->role_name.'</label>'];

            $users  = Users::find()->where(['status'=>1,'role_id'=>$role->role_id])->all();

            foreach($users as $user){

                $data [] = ['id'=>$user->id,'name'=>$user->user_name];



        return $data;


Suggest How Can I add label.

Maybe are you looking for group attribute of activeDropDownList?