With accessibility in mind, every input must contain a label, so an input component should contain the input and label tags
imports...
@Component({
selector: 'app-input',
templateUrl:
`<label [for]="id">
<div class="label">{{label}}</div>
<input [id]="id"
[type]="type"
[attr.maxlength]="maxlength"
[autocomplete]="autocomplete"
[placeholder]="placeholder"
(input)="onInput($event)"
(focus)="onFocus()"
required
>
</label>`,
styleUrls: ['./input.component.scss'],
})
export class InputComponent{
@Input() label: string;
@Input() id: string;
@Input() type: string;
@Input() maxlength: string;
@Input() autocomplete = "on";
@Input() disabled = null;
onInput(event: any){
....
}
onFocus(){
....
}
}