---
title: "Discussion on \"Switch Component with React + Tailwind CSS\" | Hashnode"
description: "Discussion on \"Switch Component with React + Tailwind CSS\". Tailwind CSS is one of the best CSS frameworks out there. Today we will learn how to create a switch component in Reactjs with tailwind CSS from scratch."
url: "https://hashnode.com/posts/switch-component-with-react-tailwind-css/6141e5b9b95e345575e9968c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Switch Component with React + Tailwind CSS](https://blog.theashishmaurya.me/switch-component-with-react-tailwind-css?utm_source=hashnode&utm_medium=feed)

Tailwind CSS is one of the best CSS frameworks out there. Today we will learn how to create a switch component in Reactjs with tailwind CSS from scratch.

Sep 15, 2021 · 4 min read · blog.theashishmaurya.me  
Updated Sep 18, 2021  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#tailwind-css](https://hashnode.com/tag/tailwind-css)
-   [#css](https://hashnode.com/tag/css)
-   [#css-animation](https://hashnode.com/tag/css-animation)
-   [#components](https://hashnode.com/tag/components)

## Written by

[Ashish maurya](https://hashnode.com/@theashishmaurya)

@theashishmaurya · India

  
[View profile](https://hashnode.com/@theashishmaurya)

Hey there!! wanna learn something new?

I am a developer from India with a good eye for frontend logic and design. I am also well acquainted with the backend and business logic so that's add to my ability to create a good frontend while making it easily integratable with backend.

## Responses 2

Markdown supported · ⌘↵ to post

[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

[Heaust](https://hashnode.com/@heaust)

[Sep 15, 2021](https://hashnode.com/posts/switch-component-with-react-tailwind-css/6141e5b9b95e345575e9968c/comment/6141e7ceb95e345575e99706)

Absolutely stunning, switching over to tailwind-css right now!!!

[Ashish maurya](https://hashnode.com/@theashishmaurya)

[Sep 15, 2021](https://hashnode.com/posts/switch-component-with-react-tailwind-css/6141e5b9b95e345575e9968c/comment/6141e7ceb95e345575e99706#reply-6141e7f882e95e55a87387bd)

Sure it has a lot of perks [heaust](https://hashnode.com/@heaust)
