tailwind css simple button examples

In this tutorial we will see create tailwind simple button, rounded button , tailwind hovered button effect, tailwind outline button, tailwind button with Icon, examples with Tailwind CSS.


Tool Use

Tailwind CSS 2.x / 3.x

Heroicons Icons


Setup Project

Using CDN

<link href="https://unpkg.com/[email protected]^2/dist/tailwind.min.css" rel="stylesheet">

or

The Easiest way to install Tailwind CSS with Tailwind CLI

How to Install Tailwind CSS with NPM


Example 1

tailwind simple button

<button class="px-6 py-2 text-white bg-red-600" type="button">
     Button
</button>
<button class="px-6 py-2 text-white bg-indigo-600" type="button">
     Button
</button>
tailwind simple button

tailwind simple button


Example 2

tailwind rounded button.


<button class="px-6 py-2 text-white bg-red-600 rounded-full" type="button">
    Button
</button>
<button class="px-6 py-2 text-white bg-indigo-600 rounded-full" type="button">
    Button
</button>
tailwind rounded button

tailwind rounded button

Example 3

tailwindcss hovered effect button.

<button class="px-6 py-2 text-white bg-red-600 rounded-full hover:bg-red-400 hover:text-red-200"
        type="button">Button
</button>
<button class="px-6 py-2 text-white bg-indigo-600 rounded-full hover:bg-indigo-400 hover:text-indigo-200"
        type="button">Button
</button>
tailwindcss hovered effect button

tailwindcss hovered effect button


Example 4

tailwind outline button with hover

<button class="px-6 py-2 text-indigo-700 border-2 border-indigo-500 rounded-full  hover:bg-indigo-500 hover:text-indigo-100">
  Button
</button>
<button class="px-6 py-2 text-red-700 border-2 border-red-500 rounded-full  hover:bg-red-500 hover:text-red-100">
  Button
</button>
tailwind outline button

tailwind outline button

Example 5

tailwind button with icon

<button class="inline-flex items-center px-6 py-2 text-indigo-100 bg-indigo-700 rounded-full hover:bg-indigo-800">
    <svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 mr-2 text-green-800 bg-white rounded-full" fill="none"
        viewBox="0 0 24 24" stroke="currentColor">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
    </svg>
    <span>Button</span>
</button>
<button class="inline-flex items-center px-6 py-2 text-red-100 bg-red-700 rounded-full hover:bg-red-800">
    <svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 mr-2 text-green-800 bg-white rounded-full" fill="none"
        viewBox="0 0 24 24" stroke="currentColor">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
    </svg>
    <span>Button</span>
</button>
tailwind button with icon

tailwind button with icon

Read Also

Tailwind CSS 3 FAQ Accordion UI Example

Tailwind CSS 3 Alert Message Example

Tailwind CSS 3 Avatars Example

Tailwind CSS 3 Badges Example

Tailwind CSS 3 Breadcrumb Example

Tailwind CSS v3 Button Examples

Tailwind CSS Gradient Button Example

Tailwind CSS 3D Button Example

Tailwind CSS Loading Button Example

Tailwind CSS v3 Cards Examples

Tailwind CSS Checkbox Form Examples

Tailwind CSS Dropdowns (Menu) on Hover Example

Tailwind CSS Multiselect Dropdown Example

How to use dark mode toggle switch in Tailwind CSS 3

How to use @apply directive in Tailwind CSS

Tailwind CSS sticky header & fixed navbar example

Tailwind CSS Navbar UI Example

Tailwind CSS 3 Login Page UI Example

Tailwind CSS Login Modal Example

Tailwind CSS Search Examples

Tailwind CSS 3 Overlay Image Example

Tailwind CSS Thank You Page Example

Tailwind CSS Timeline UI Example

Tailwind CSS Responsive Footer Section Example

Tailwind CSS Background Image Header Example