Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Building UI Components | Section
Tailwind CSS for React Development

Building UI Components

Swipe um das Menü anzuzeigen

Tailwind allows you to quickly build common UI components using utility classes.

Button

<button className="px-4 py-2 bg-blue-500 text-white rounded-lg">
  Click me
</button>
  • px-4 py-2: adds padding;
  • bg-blue-500: sets background color;
  • text-white: sets text color;
  • rounded-lg: adds rounded corners.

Card

<div className="p-4 bg-white shadow-lg rounded-lg">
  <h3 className="text-lg font-bold">Title</h3>
  <p className="text-gray-600">Description</p>
</div>
  • p-4: adds padding;
  • shadow-lg: adds shadow;
  • rounded-lg: rounds corners.

Form Input

<input
  className="border border-gray-300 p-2 rounded-md"
  placeholder="Enter text"
/>
  • border: adds border;
  • p-2: adds padding;
  • rounded-md: rounds corners.

Combine utility classes to build reusable UI components like buttons, cards, and form elements.

question mark

Which Tailwind CSS utility class would you use to add padding to a form input component?

Wählen Sie die richtige Antwort aus

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 6

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Building UI Components

Tailwind allows you to quickly build common UI components using utility classes.

Button

<button className="px-4 py-2 bg-blue-500 text-white rounded-lg">
  Click me
</button>
  • px-4 py-2: adds padding;
  • bg-blue-500: sets background color;
  • text-white: sets text color;
  • rounded-lg: adds rounded corners.

Card

<div className="p-4 bg-white shadow-lg rounded-lg">
  <h3 className="text-lg font-bold">Title</h3>
  <p className="text-gray-600">Description</p>
</div>
  • p-4: adds padding;
  • shadow-lg: adds shadow;
  • rounded-lg: rounds corners.

Form Input

<input
  className="border border-gray-300 p-2 rounded-md"
  placeholder="Enter text"
/>
  • border: adds border;
  • p-2: adds padding;
  • rounded-md: rounds corners.

Combine utility classes to build reusable UI components like buttons, cards, and form elements.

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 6
some-alt