The legislation by Supervisor David Campos would require property owners who evict renters under the state Ellis Act to pay the difference between the tenant’s current rent and what they would have to pay for a similar apartment for two years.

The board – which has seen a slew of housing-related legislation in recent weeks as city leaders cope with soaring housing prices and tenant displacement – also voted unanimously Tuesday to support a pilot program that would allow property owners in the Castro district to build in-law units. It came one week after supervisors approved groundbreaking legislation by Supervisor David Chiu to allow property owners to voluntarily legalize their in-law units. There are an estimated 30,000 to 50,000 such units in the city already.

Campos’ legislation was approved 9-2 and will face one more vote at the board before being sent to Mayor Ed Lee, who has not said whether he will sign it.