-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Learn React with TypeScript
By :

In this section, we will start by understanding Tailwind CSS and its benefits. Next, we’ll refactor the alert component we have been using to use Tailwind and observe how it differs from other approaches we have tried.
Tailwind is a set of prebuilt CSS classes that can be used to style an app. It is referred to as a utility-first CSS framework because the prebuilt classes can be thought of as flexible utilities.
An example CSS class is bg-white
, which styles the background of an element white – bg is short for background. Another example is bg-orange-500
, which sets the background color to a 500 shade of orange. Tailwind contains a nice color palette that can be customized.
The utility classes can be used together to style an element. The following example styles a button element in JSX:
<button className=”border-none rounded-md bg-emerald-700 text-white cursor-pointer”> ... ...