Buttons

Use Bootstrap’s custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.

Examples

Bootstrap includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control.


<button type="button" class="px-4 py-2 mb-4 mr-4 text-white transition-all duration-500 ease-in-out bg-blue-500 border border-blue-500 rounded shadow-md hover:shadow-xl hover:bg-blue-600 focus:bg-blue-600">Primary</button>
<button type="button" class="px-4 py-2 mb-4 mr-4 text-white transition-all duration-500 ease-in-out bg-gray-600 border border-gray-600 rounded shadow-md hover:shadow-xl hover:bg-gray-700 focus:bg-gray-700">Secondary</button>
<button type="button" class="px-4 py-2 mb-4 mr-4 text-white transition-all duration-500 ease-in-out bg-green-500 border border-green-500 rounded shadow-md hover:shadow-xl hover:bg-green-600 focus:bg-green-600">Success</button>
<button type="button" class="px-4 py-2 mb-4 mr-4 text-white transition-all duration-500 ease-in-out bg-red-500 border border-red-500 rounded shadow-md hover:shadow-xl hover:bg-red-600 focus:bg-red-600">Danger</button>
<button type="button" class="px-4 py-2 mb-4 mr-4 text-white transition-all duration-500 ease-in-out bg-orange-500 border border-orange-500 rounded shadow-md hover:shadow-xl hover:bg-orange-600 focus:bg-orange-600">Warning</button>
<button type="button" class="px-4 py-2 mb-4 mr-4 text-white transition-all duration-500 ease-in-out border rounded shadow-md bg-cyan-500 border-cyan-500 hover:drop-shadow-lg hover:bg-cyan-600 focus:bg-cyan-600">Info</button>
<button type="button" class="px-4 py-2 mb-4 mr-4 text-black transition-all duration-500 ease-in-out bg-gray-300 border border-gray-300 rounded shadow-md hover:drop-shadow-lg hover:bg-gray-400 focus:bg-gray-400">Light</button>
<button type="button" class="px-4 py-2 mb-4 mr-4 text-white transition-all duration-500 ease-in-out bg-gray-900 border border-gray-900 rounded shadow-md hover:drop-shadow-lg hover:bg-gray-900 focus:bg-gray-900">Dark</button>
<button type="button" class="px-4 py-2 mb-4 mr-4 text-blue-500 transition-all duration-500 ease-in-out bg-transparent hover:text-blue-600 focus:shadow-lg rounded">Link</button>
   
        

Disable text wrapping

If you don’t want the button text to wrap, you can add the .text-nowrap class to the button. In Sass, you can set $btn-white-space: nowrap to disable text wrapping for each button.

Button tags

The .btn classes are designed to be used with the <button> element. However, you can also use these classes on <a> or <input> elements (though some browsers may apply a slightly different rendering).

When using button classes on <a> elements that are used to trigger in-page functionality (like collapsing content), rather than linking to new pages or sections within the current page, these links should be given a role="button" to appropriately convey their purpose to assistive technologies such as screen readers.

Link

    <div class="flex flex-wrap items-center">
    <button class="px-6 py-2 mb-4 mr-4 text-white transition-all duration-500 ease-in-out bg-blue-500 border border-blue-500 rounded shadow-md hover:shadow-xl hover:bg-blue-600 focus:bg-blue-600 ">Default</button>
    <button class="px-6 py-2 mb-4 mr-4 text-white transition-all duration-500 ease-in-out bg-blue-500 border border-blue-500 rounded-full shadow-md hover:shadow-xl hover:bg-blue-600 focus:bg-blue-600 ">Rounded</button>
    <button class="inline-flex justify-center px-6 py-2 mb-4 mr-4 text-white transition-all duration-500 ease-in-out bg-blue-500 border border-blue-500 rounded-full shadow-md hover:shadow-xl hover:bg-blue-600 focus:bg-blue-600 ">
      <span class="mr-2">
      <svg width="24" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
      <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path>
      </svg>
      </span>With Icon
        </button>
        <button class="px-2 py-1 mb-4 mr-4 text-white transition-all duration-500 ease-in-out bg-blue-500 border border-blue-500 rounded shadow-md hover:shadow-xl hover:bg-blue-600 focus:bg-blue-600 ">
                <span>
                <svg width="24" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path>
            </svg>
            </span>
        </button>
        </div>
                        

Outline buttons

In need of a button, but not the hefty background colors they bring? Replace the default modifier classes with the .btn-outline-* ones to remove all background images and colors on any button.


<button type="button" class="px-6 py-2 mb-4 mr-4 text-blue-500 transition-all duration-500 ease-in-out border border-blue-500 rounded hover:shadow-md hover:bg-blue-500 hover:text-white">Primary</button>
<button type="button" class="px-6 py-2 mb-4 mr-4 text-gray-600 transition-all duration-500 ease-in-out border border-gray-600 rounded hover:shadow-md hover:bg-gray-600 hover:text-white">Secondary</button>
<button type="button" class="px-6 py-2 mb-4 mr-4 text-green-500 transition-all duration-500 ease-in-out border border-green-500 rounded hover:shadow-md hover:bg-green-500 hover:text-white">Success</button>
<button type="button" class="px-6 py-2 mb-4 mr-4 text-red-500 transition-all duration-500 ease-in-out border border-red-500 rounded hover:shadow-md hover:bg-red-500 hover:text-white">Danger</button>
<button type="button" class="px-6 py-2 mb-4 mr-4 text-orange-500 transition-all duration-500 ease-in-out border border-orange-500 rounded hover:shadow-md hover:bg-orange-500 hover:text-white">Warning</button>
<button type="button" class="px-6 py-2 mb-4 mr-4 transition-all duration-500 ease-in-out border rounded text-cyan-500 border-cyan-500 hover:shadow-md hover:bg-cyan-500 hover:text-white">Info</button>
<button type="button" class="px-6 py-2 mb-4 mr-4 text-gray-300 transition-all duration-500 ease-in-out border border-gray-300 rounded hover:shadow-md hover:bg-gray-300 hover:text-black">Light</button>
<button type="button" class="px-6 py-2 mb-4 mr-4 text-gray-900 transition-all duration-500 ease-in-out border border-gray-900 rounded hover:shadow-md hover:bg-gray-900 hover:text-white">Dark</button>
                    

Sizes

Fancy larger or smaller buttons? Add .btn-lg or .btn-sm for additional sizes.


<button type="button" class="px-6 py-2 mb-4 mr-4 text-white transition-all duration-500 ease-in-out bg-blue-500 border border-blue-500 rounded shadow-md hover:shadow-xl hover:bg-blue-600 focus:bg-blue-600 ">Defaultbutton</button>
<button type="button" class="px-6 py-2 mb-4 mr-4 text-xl text-white transition-all duration-500 ease-in-out bg-blue-500 border border-blue-500 rounded shadow-md hover:shadow-xl hover:bg-blue-600 focus:bg-blue-600 ">Largebutton</button>
                                            

<button type="button" class="px-2 py-0.5 mb-4 mr-4 text-sm text-white transition-all duration-500 ease-in-out border border-blue-500 bg-blue-500 rounded shadow-md hover:shadow-xl focus:bg-blue-600  hover:bg-blue-600 ">Exsmall</button>
<button type="button" class="px-4 py-1 mb-4 mr-4 text-sm text-white transition-all duration-500 ease-in-out bg-blue-500 border border-blue-500 rounded shadow-md hover:shadow-xl focus:bg-blue-600 hover:bg-blue-600 ">Smallbutton</button>