Custom Sensor with state icons

I made a custom sensor which outputs different text states: can I have it displayed as a badge with different icons based on its state, instead of displaying the state string?