---
title: "Comment by Eduardo on \"Switch Component with React + Tailwind CSS\" | Hashnode"
description: "How do I change the background color on click? Example: I need green bg-color when circle is right and bg-red when circle to left, same with circles"
url: "https://hashnode.com/posts/switch-component-with-react-tailwind-css/6141e5b9b95e345575e9968c/comment/622669b156920671339a0540"
---

[Discussion](https://hashnode.com/posts/switch-component-with-react-tailwind-css/6141e5b9b95e345575e9968c)

Comment [Switch Component with React + Tailwind CSS](https://hashnode.com/posts/switch-component-with-react-tailwind-css/6141e5b9b95e345575e9968c)

[Eduardo](https://hashnode.com/@mepr)

[Mar 7, 2022](https://hashnode.com/posts/switch-component-with-react-tailwind-css/6141e5b9b95e345575e9968c/comment/622669b156920671339a0540)

How do I change the background color on click? Example: I need green bg-color when circle is right and bg-red when circle to left, same with circles
