Application toolkit - Card

Cards provide a flexible and extensible content container with multiple variants and options.

Basic

A basic card containing a title, content and an extra corner content.

Cards assume no specific width to start, so they'll be 100% wide unless otherwise stated.

Open this basic card example in new window
Copy basic card code
<div class="flex flex-col bg-white border shadow-sm rounded-xl dark:bg-gray-800 dark:border-gray-700 dark:shadow-slate-700/[.7]">
  <img class="w-full h-auto rounded-t-xl" src="/assets/images/design-system/working-group.jpg" alt="Accessibility Working Group">
  <div class="p-4 md:p-5">
    <h3 class="text-lg font-bold text-gray-800 dark:text-white">
      Accessibility Working Group
    </h3>
    <p class="mt-1 text-gray-800 dark:text-gray-400">
      We have a vibrant accessibility working group where we discuss everything we're doing to push Accessibility and inclusivity at HS2
    </p>
    <a class="mt-3 py-3 px-4 inline-flex justify-center items-center gap-2 rounded-md border border-transparent font-semibold bg-hs2-secondary text-white hover:bg-hs2-secondary-hover focus:outline-none focus:ring-2 focus:ring-hs2-secondary focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800" href="#">
      Find out how to get involved in our working group
    </a>
  </div>
</div>
Close basic card code

Content types

Cards support a wide variety of content, including images, text, list groups, links, and more. Below are examples of what's supported.

Body

Simple body example with text.

Open this body card example in new window
Copy body card code
<div class="flex flex-col bg-white border shadow-sm rounded-xl p-4 md:p-5 dark:bg-gray-800 dark:border-gray-700 dark:shadow-slate-700/[.7] dark:text-gray-400">
  Some quick example text to build on the card title and make up the bulk of the card's content.
</div>
Close body card code

Simple card

A simple card only containing a content area.

Open this simple card example in new window
Copy simple card code
<div class="flex flex-col bg-white border shadow-sm rounded-xl p-4 md:p-5 dark:bg-gray-800 dark:border-gray-700 dark:shadow-slate-700/[.7]">
  <h3 class="text-lg font-bold text-gray-800 dark:text-white">
    Card title
  </h3>
  <p class="mt-1 text-xs font-medium uppercase text-gray-500 dark:text-gray-500">
    Card subtitle
  </p>
  <p class="mt-2 text-gray-800 dark:text-gray-400">
    Some quick example text to build on the card title and make up the bulk of the card's content.
  </p>
  <a class="mt-3 inline-flex items-center gap-2 mt-5 text-sm font-medium text-blue-500 hover:text-blue-700" href="#">
    Card link
    <svg class="w-2.5 h-auto" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
    </svg>
  </a>
</div>
Close simple card code

Header and footer

Add an optional header and/or footer within a card.

Open this header and footer card example in new window

Simple footer within a card.

Open this simple footer card example in new window

Sizes

Small card size.

Open this small card example in new window
Copy small card code
<div class="flex flex-col bg-white border shadow-sm rounded-xl dark:bg-gray-800 dark:border-gray-700 dark:shadow-slate-700/[.7]">
  <div class="p-4 md:p-5">
    <h3 class="text-lg font-bold text-gray-800 dark:text-white">
      Card title
    </h3>
    <p class="mt-2 text-gray-800 dark:text-gray-400">
      With supporting text below as a natural lead-in to additional content.
    </p>
    <a class="mt-3 inline-flex items-center gap-2 mt-5 text-sm font-medium text-blue-500 hover:text-blue-700" href="#">
      Card link
      <svg class="w-2.5 h-auto" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
        <path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
      </svg>
    </a>
  </div>
</div>
Close small card code

Default card size.

Open this default size card example in new window
Copy default size card code
<div class="flex flex-col bg-white border shadow-sm rounded-xl dark:bg-gray-800 dark:border-gray-700 dark:shadow-slate-700/[.7]">
  <div class="p-4 md:p-7">
    <h3 class="text-lg font-bold text-gray-800 dark:text-white">
      Card title
    </h3>
    <p class="mt-2 text-gray-800 dark:text-gray-400">
      With supporting text below as a natural lead-in to additional content.
    </p>
    <a class="mt-3 inline-flex items-center gap-2 mt-5 text-sm font-medium text-blue-500 hover:text-blue-700" href="#">
      Card link
      <svg class="w-2.5 h-auto" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
        <path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
      </svg>
    </a>
  </div>
</div>
Close default size card code

Large card size

Open this large card example in new window
Copy large card code
<div class="flex flex-col bg-white border shadow-sm rounded-xl dark:bg-gray-800 dark:border-gray-700 dark:shadow-slate-700/[.7]">
  <div class="p-4 md:p-10">
    <h3 class="text-lg font-bold text-gray-800 dark:text-white">
      Card title
    </h3>
    <p class="mt-2 text-gray-800 dark:text-gray-400">
      With supporting text below as a natural lead-in to additional content.
    </p>
    <a class="mt-3 inline-flex items-center gap-2 mt-5 text-sm font-medium text-blue-500 hover:text-blue-700" href="#">
      Card link
      <svg class="w-2.5 h-auto" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
        <path d="M5 1L10.6869 7.16086C10.8637 7.35239 10.8637 7.64761 10.6869 7.83914L5 14" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
      </svg>
    </a>
  </div>
</div>
Close large card code

Navigation

Add some navigation to a card's header (or block).

Open this navigation header card example in new window
Open this navigation block card example in new window