ButtonGroups Components

Tailwind CSS Buttons

# Simple

Code

1<span class="inline-flex -space-x-px overflow-hidden rounded-md border bg-white shadow-sm">
2  <button
3    class="inline-block px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:relative"
4  >
5    Edit
6  </button>
7
8  <button
9    class="inline-block px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:relative"
10  >
11    View
12  </button>
13
14  <button
15    class="inline-block px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:relative"
16  >
17    Delete
18  </button>
19</span>

# Simple Icons Only

Code

1<span class="inline-flex overflow-hidden rounded-md border bg-white shadow-sm">
2  <button
3    class="inline-block border-e p-3 text-gray-700 hover:bg-gray-50 focus:relative"
4    title="Edit Product"
5  >
6    <svg
7      xmlns="http://www.w3.org/2000/svg"
8      fill="none"
9      viewBox="0 0 24 24"
10      stroke-width="1.5"
11      stroke="currentColor"
12      class="h-4 w-4"
13    >
14      <path
15        stroke-linecap="round"
16        stroke-linejoin="round"
17        d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"
18      />
19    </svg>
20  </button>
21
22  <button
23    class="inline-block p-3 text-gray-700 hover:bg-gray-50 focus:relative"
24    title="Delete Product"
25  >
26    <svg
27      xmlns="http://www.w3.org/2000/svg"
28      fill="none"
29      viewBox="0 0 24 24"
30      stroke-width="1.5"
31      stroke="currentColor"
32      class="h-4 w-4"
33    >
34      <path
35        stroke-linecap="round"
36        stroke-linejoin="round"
37        d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"
38      />
39    </svg>
40  </button>
41</span>

# Simple with Secondary

Code

1<span class="inline-flex overflow-hidden rounded-md border bg-white shadow-sm">
2  <button
3    class="inline-block border-e px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:relative"
4  >
5    Create Order
6  </button>
7
8  <button
9    class="inline-block px-4 py-2 text-gray-700 hover:bg-gray-50 focus:relative"
10    title="View Orders"
11  >
12    <svg
13      xmlns="http://www.w3.org/2000/svg"
14      fill="none"
15      viewBox="0 0 24 24"
16      stroke-width="1.5"
17      stroke="currentColor"
18      class="h-4 w-4"
19    >
20      <path
21        stroke-linecap="round"
22        stroke-linejoin="round"
23        d="M2.25 18.75a60.07 60.07 0 0115.797 2.101c.727.198 1.453-.342 1.453-1.096V18.75M3.75 4.5v.75A.75.75 0 013 6h-.75m0 0v-.375c0-.621.504-1.125 1.125-1.125H20.25M2.25 6v9m18-10.5v.75c0 .414.336.75.75.75h.75m-1.5-1.5h.375c.621 0 1.125.504 1.125 1.125v9.75c0 .621-.504 1.125-1.125 1.125h-.375m1.5-1.5H21a.75.75 0 00-.75.75v.75m0 0H3.75m0 0h-.375a1.125 1.125 0 01-1.125-1.125V15m1.5 1.5v-.75A.75.75 0 003 15h-.75M15 10.5a3 3 0 11-6 0 3 3 0 016 0zm3 0h.008v.008H18V10.5zm-12 0h.008v.008H6V10.5z"
24      />
25    </svg>
26  </button>
27</span>

# Contained

Code

1<div class="inline-flex rounded-lg border border-gray-100 bg-gray-100 p-1">
2  <button
3    class="inline-block rounded-md px-4 py-2 text-sm text-gray-500 hover:text-gray-700 focus:relative"
4  >
5    Edit
6  </button>
7
8  <button
9    class="inline-block rounded-md px-4 py-2 text-sm text-gray-500 hover:text-gray-700 focus:relative"
10  >
11    View
12  </button>
13
14  <button
15    class="inline-block rounded-md bg-white px-4 py-2 text-sm text-blue-500 shadow-sm focus:relative"
16  >
17    Delete
18  </button>
19</div>

# Contained with Icons

Code

1<div class="inline-flex rounded-lg border border-gray-100 bg-gray-100 p-1">
2  <button
3    class="inline-flex items-center gap-2 rounded-md px-4 py-2 text-sm text-gray-500 hover:text-gray-700 focus:relative"
4  >
5    <svg
6      xmlns="http://www.w3.org/2000/svg"
7      fill="none"
8      viewBox="0 0 24 24"
9      stroke-width="1.5"
10      stroke="currentColor"
11      class="h-4 w-4"
12    >
13      <path
14        stroke-linecap="round"
15        stroke-linejoin="round"
16        d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"
17      />
18    </svg>
19
20    Edit
21  </button>
22
23  <button
24    class="inline-flex items-center gap-2 rounded-md px-4 py-2 text-sm text-gray-500 hover:text-gray-700 focus:relative"
25  >
26    <svg
27      xmlns="http://www.w3.org/2000/svg"
28      fill="none"
29      viewBox="0 0 24 24"
30      stroke-width="1.5"
31      stroke="currentColor"
32      class="h-4 w-4"
33    >
34      <path
35        stroke-linecap="round"
36        stroke-linejoin="round"
37        d="M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"
38      />
39      <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
40    </svg>
41
42    View
43  </button>
44
45  <button
46    class="inline-flex items-center gap-2 rounded-md bg-white px-4 py-2 text-sm text-blue-500 shadow-sm focus:relative"
47  >
48    <svg
49      xmlns="http://www.w3.org/2000/svg"
50      fill="none"
51      viewBox="0 0 24 24"
52      stroke-width="1.5"
53      stroke="currentColor"
54      class="h-4 w-4"
55    >
56      <path
57        stroke-linecap="round"
58        stroke-linejoin="round"
59        d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"
60      />
61    </svg>
62
63    Delete
64  </button>
65</div>

# Outline

Code

1<div class="inline-flex rounded-md shadow-sm" role="group">
2<button type="button" class="px-4 py-2 text-sm font-medium text-gray-900 bg-transparent border border-gray-900 rounded-s-lg hover:bg-gray-900 hover:text-white focus:z-10 focus:ring-2 focus:ring-gray-500 focus:bg-gray-900 focus:text-white ">
3  Profile
4</button>
5<button type="button" class="px-4 py-2 text-sm font-medium text-gray-900 bg-transparent border-t border-b border-gray-900 hover:bg-gray-900 hover:text-white focus:z-10 focus:ring-2 focus:ring-gray-500 focus:bg-gray-900 focus:text-white ">
6  Settings
7</button>
8<button type="button" class="px-4 py-2 text-sm font-medium text-gray-900 bg-transparent border border-gray-900 rounded-e-lg hover:bg-gray-900 hover:text-white focus:z-10 focus:ring-2 focus:ring-gray-500 focus:bg-gray-900 focus:text-white dark:focus:bg-gray-700">
9  Downloads
10</button>
11</div>

# Outlined with icon

Code

1<div class="inline-flex rounded-md shadow-sm" role="group">
2        <button type="button" class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-900 bg-transparent border border-gray-900 rounded-s-lg hover:bg-gray-900 hover:text-white focus:z-10 focus:ring-2 focus:ring-gray-500 focus:bg-gray-900 focus:text-white  ">
3            <svg class="w-3 h-3 me-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
4                <path d="M10 0a10 10 0 1 0 10 10A10.011 10.011 0 0 0 10 0Zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6Zm0 13a8.949 8.949 0 0 1-4.951-1.488A3.987 3.987 0 0 1 9 13h2a3.987 3.987 0 0 1 3.951 3.512A8.949 8.949 0 0 1 10 18Z" />
5            </svg>
6            Profile
7        </button>
8        <button type="button" class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-900 bg-transparent border-t border-b border-gray-900 hover:bg-gray-900 hover:text-white focus:z-10 focus:ring-2 focus:ring-gray-500 focus:bg-gray-900 focus:text-white ">
9            <svg class="w-3 h-3 me-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
10                <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12.25V1m0 11.25a2.25 2.25 0 0 0 0 4.5m0-4.5a2.25 2.25 0 0 1 0 4.5M4 19v-2.25m6-13.5V1m0 2.25a2.25 2.25 0 0 0 0 4.5m0-4.5a2.25 2.25 0 0 1 0 4.5M10 19V7.75m6 4.5V1m0 11.25a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5ZM16 19v-2" />
11            </svg>
12            Settings
13        </button>
14        <button type="button" class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-900 bg-transparent border border-gray-900 rounded-e-lg hover:bg-gray-900 hover:text-white focus:z-10 focus:ring-2 focus:ring-gray-500 focus:bg-gray-900 focus:text-white ">
15            <svg class="w-3 h-3 me-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
16                <path d="M14.707 7.793a1 1 0 0 0-1.414 0L11 10.086V1.5a1 1 0 0 0-2 0v8.586L6.707 7.793a1 1 0 1 0-1.414 1.414l4 4a1 1 0 0 0 1.416 0l4-4a1 1 0 0 0-.002-1.414Z" />
17                <path d="M18 12h-2.55l-2.975 2.975a3.5 3.5 0 0 1-4.95 0L4.55 12H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2Zm-3 5a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z" />
18            </svg>
19            Downloads
20        </button>
21    </div>