If the majority of the companies (eg. 90%) in an ETF are sharia compliant, is it okay to invest in that ETF?

Would it still be okay or not?

There’s no public fatwa on this, as far as I’m aware, so it really boils down to your own comfort level. In my personal opinion, it would be better to apply the same ~5% rule as individual stocks in the effort to limit your exposure to non-compliant holdings.

Even better, use a service like M1 Finance to recreate the ETF using only its compliant holdings.