How to make custom input html with error message?

Hi, can somebody tell me how can I customize form html with error messages. Cause I have custom html for input type file and need to render error message. But if I simple add div with .invalid-feedback class it is hidden. I can add style=“display: block” but hope there is a Yii way to do it correctly. This is the code:

<div class="form-group">
	<label for="thumbnail"><?= $model->getAttributeLabel('thumbnail') ?></label>
	<div class="input-group mb-3">
		<div class="custom-file">
			<input type="file" class="custom-file-input" name="thumbnail" id="thumbnail1" aria-describedby="inputGroupFileAddon01">
			<label class="custom-file-label" for="inputGroupFile01">Choose file</label>
	<div class="invalid-feedback"><?php echo $model->getFirstError('thumbnail') ?></div>

How to render the error correctly to be visible?

Hi camohub, have you tried with $form->errorSummary ?

You just need to add this line of code inside your .form-group div:

<?= $form->errorSummary( $model->getErrorModels(), ['header' => '', 'showAllErrors' => true] ); ?>