Plz help with seach icon

I am working on ionic4-angular mobile app development. i need to implement the search button only with cancel on the click it should expand. any help is appreciated.

Do you mean something like this

yes.when i click on button it should expand and when i click outside it should shrink.

Then there you go, that’s how you get it done, all the codes are inside the codepen