Is an api widget or a custom widget ?
There is one in Experience Builder.
https://developers.arcgis.com/experience-builder/guide/filter-widget/
It is based on this:
https://developers.arcgis.com/javascript/latest/query-filter/