Docs

Main site

Installation Browser support Extend config MCP server
Validation Page speed testing Responsive design
Accordion Aspect Ratio Avatar Badge Banner Bento Grid Blockquote Breadcrumbs Button Callout Card Drawer Dropdown Link Modal Navbar Navblock Pagination Popover Progress Separator Tabs Timeline Toast Tooltip
Checkbox Datepicker File upload Form field Input Label OTP Radio Range Select Textarea Toggle
Header Footer
Accordion Auth Checkbox & Radio Content Drawers Features Modals Statistics & Metrics Teams Dropdowns
Address Contact number Currency symbol Date Emirates ID Name
Close
Home Documentation Components Card

Card

A Card is a flexible bordered surface for grouping related content — service tiles, summary panels, dashboard sections, profile snippets, and list items. It supports three border treatments across four colour variants, three sizes, optional hover effects, and any Tailwind background utility. Content is fully slotted, so any combination of headings, body copy, badges, or actions can be composed inside.

Layout Media
Status
Active
Introduced
4.0.x
View source code

Anatomy

The aegov-card component renders a single bordered surface with a padded content area and a default slot. Border, background, and radius all live on the outer surface; padding lives on the inner content wrapper so it can be turned off independently for edge-to-edge media.

Image showing anatomy of a card

Item Name Description
1 Border / surface The outer edge — colour and thickness driven by appearance, variant, and border-width
2 Content area The inner, padded wrapper that holds the slotted content (is-padding toggles its padding)
3 Slotted content Any markup or AEGOV components placed inside — headings, text, badges, buttons

Appearance

The appearance property controls how the border is drawn. Colour resolves from variant (default primary).

Solid

Full-strength border. The default surface.

Light

Quieter outline for grouped or supporting content.

Creative

Gradient outline for featured or promotional cards.

<aegov-card appearance="solid">
  <h3 class="font-bold text-lg m-0">Solid</h3>
  <p class="text-base mt-2">Full-strength border. The default surface.</p>
</aegov-card>
<aegov-card appearance="light">
  <h3 class="font-bold text-lg m-0">Light</h3>
  <p class="text-base mt-2">Quieter outline for grouped or supporting content.</p>
</aegov-card>
<aegov-card appearance="creative">
  <h3 class="font-bold text-lg m-0">Creative</h3>
  <p class="text-base mt-2">Gradient outline for featured or promotional cards.</p>
</aegov-card>

Variant

The variant property selects the colour family for the border, hover shift, and glow shadow. It composes with appearance to resolve the actual token.

Variant Solid Light Creative gradient
primary primary-600 primary-200 primary-400 → primary-800
secondary secondary-600 secondary-200 secondary-400 → secondary-800
neutral-max aeblack-800 aeblack-400 aeblack-400 → aeblack-800
neutral-min aeblack-100 aeblack-50 aeblack-50 → aeblack-300

Primary

Secondary

Neutral-max

Neutral-min

<aegov-card variant="primary"><p class="text-sm">Primary</p></aegov-card>
<aegov-card variant="secondary"><p class="text-sm">Secondary</p></aegov-card>
<aegov-card variant="neutral-max"><p class="text-sm">Neutral-max</p></aegov-card>
<aegov-card variant="neutral-min"><p class="text-sm">Neutral-min</p></aegov-card>

Border width

border-width accepts 1, 2, or 3 and controls the outline thickness in pixels for solid/light appearances. The default of 2 suits most contexts — use 1 when a card sits among many close siblings, and 3 for hero or featured cards.

1px border — quiet emphasis.

2px border — the default.

3px border — strong emphasis.

<aegov-card border-width="1"><p class="text-base">1px border — quiet emphasis.</p></aegov-card>
<aegov-card border-width="2"><p class="text-base">2px border — the default.</p></aegov-card>
<aegov-card border-width="3"><p class="text-base">3px border — strong emphasis.</p></aegov-card>

Background

Cards default to a white surface (dark-mode aware). Override with any Tailwind background utility on the host — a design-system token, an arbitrary value, or your own class. For creative appearance, the inner content area still inherits the host's background, so a coloured surface shows through the centre while the gradient renders as the ring.

Default white surface.

Class override: bg-aeblack-50.

Creative ring on a bg-aegreen-50 surface.

<aegov-card>
  <p class="text-base">Default white surface.</p>
</aegov-card>
<aegov-card class="bg-aeblack-50" appearance="light">
  <p class="text-base">Class override: bg-aeblack-50.</p>
</aegov-card>
<aegov-card class="bg-aegreen-50" appearance="creative" variant="primary">
  <p class="text-base">Creative ring on a bg-aegreen-50 surface.</p>
</aegov-card>

Hover effect

The hover property adds feedback when the pointer is over the card. Use standard for clickable tiles and glow for prominent links to a deeper page. Hover here is visual only — it never substitutes for the focus indicator on whatever's actually interactive inside. Hover over each card below to see the effect.

No hover — static surface.

Hover for a border colour shift.

Hover for a soft drop-shadow glow.

<aegov-card hover="off"><p class="text-base">No hover — static surface.</p></aegov-card>
<aegov-card hover="standard"><p class="text-base">Hover for a border colour shift.</p></aegov-card>
<aegov-card hover="glow"><p class="text-base">Hover for a soft drop-shadow glow.</p></aegov-card>

Size

size controls the inner padding and outer corner radius. Three tokens are available — sm, base (default), and lg. Unlike Badge, Banner, and Callout's size, this is a fixed token: it does not accept a responsive breakpoint string, and it does not scale on its own at smaller viewports.

Token Padding Radius
sm 1rem (16px) 0.5rem
base 1.25rem (20px) 0.75rem
lg 1.5rem (24px) 1rem

Compact padding and tighter radius.

The default size — suitable for most cards.

Generous padding for hero or featured cards.

<aegov-card size="sm"><p class="text-base">Compact padding and tighter radius.</p></aegov-card>
<aegov-card size="base"><p class="text-base">The default size — suitable for most cards.</p></aegov-card>
<aegov-card size="lg"><p class="text-base">Generous padding for hero or featured cards.</p></aegov-card>

Padding

By default the content area has padding scaled to size (see above). Set is-padding="false" for edge-to-edge content — a media image, a data table, or anything that should bleed to the border. Supply your own inner padding for any body content beneath.

Padded (default)

Standard content area padding.

Edge-to-edge

Own inner padding, bleeds to the border.

<aegov-card>
  <h3 class="font-bold text-lg m-0">Padded (default)</h3>
  <p class="text-base mt-2">Standard content area padding.</p>
</aegov-card>
<aegov-card is-padding="false">
  <div style="padding:1.25rem;">
    <h3 class="font-bold text-lg m-0">Edge-to-edge</h3>
    <p class="text-base mt-2">Own inner padding, bleeds to the border.</p>
  </div>
</aegov-card>

Grid spanning

data-col-span and data-row-span control how many columns or rows a card spans inside an aegov-bento-grid (or any CSS grid container reading these attributes). Both accept a plain integer or a responsive syntax using Tailwind-style breakpoint prefixes — the exact same mechanism aegov-bento-grid's own props use, documented on its own page.

Featured — spans 2 columns

A wider card draws the eye to the most important tile.

Quick stat

<aegov-bento-grid cols="1 md:3" gap="md">
  <aegov-card data-col-span="2" appearance="light" hover="standard">
    <h3 class="font-bold text-lg m-0">Featured — spans 2 columns</h3>
    <p class="text-base mt-2">A wider card draws the eye to the most important tile.</p>
  </aegov-card>
  <aegov-card appearance="light">
    <p class="text-sm">Quick stat</p>
  </aegov-card>
</aegov-bento-grid>

Composing with components

Cards compose well with other AEGOV components — titles, text, and links — to build service tiles, summary panels, and dashboard sections.

Examination of Medical Fitness for Residency Visa

This service enables citizens to obtain a medical fitness certificate required for residency visa applications, renewals, or medical clearance purposes.

Apply now
<aegov-card>
  <h3 class="font-bold text-lg m-0">Examination of Medical Fitness for Residency Visa</h3>
  <p class="text-base line-clamp-2 mt-2">This service enables citizens to obtain a medical fitness certificate required for residency visa applications, renewals, or medical clearance purposes.</p>
  <aegov-link href="#" extra-class="inline-flex items-center gap-1 mt-4">
    Apply now
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" class="size-4" aria-hidden="true"><path d="M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" fill="currentColor"/></svg>
  </aegov-link>
</aegov-card>

RTL support

The card itself is direction-agnostic — a simple bordered surface. Slotted content follows the document dir automatically, so headings, text, and inline icons mirror without extra configuration.

فحص اللياقة الطبية لتأشيرة الإقامة

تتيح هذه الخدمة للمواطنين الحصول على شهادة اللياقة الطبية المطلوبة لطلبات تأشيرة الإقامة أو تجديدها أو لأغراض التخليص الطبي.

قدّم الآن
<div dir="rtl">
  <aegov-card>
    <h3 class="font-bold text-lg m-0">فحص اللياقة الطبية لتأشيرة الإقامة</h3>
    <p class="text-base line-clamp-2 mt-2">تتيح هذه الخدمة للمواطنين الحصول على شهادة اللياقة الطبية المطلوبة لطلبات تأشيرة الإقامة أو تجديدها أو لأغراض التخليص الطبي.</p>
    <aegov-link href="#" extra-class="inline-flex items-center gap-1 mt-4">
      قدّم الآن
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" class="size-4" aria-hidden="true"><path d="M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z" fill="currentColor"/></svg>
    </aegov-link>
  </aegov-card>
</div>

Usage

Here is the recommended usage of a card on any website or application. These are recommended usage guides, however the developer must use the best practices of web and application development to accurately use this component.

Match variant to semantic intent, not just colour preference
Reserve primary for main brand actions, secondary for supporting content, and neutral-max/neutral-min for quiet or de-emphasised panels — a consistent mapping helps the same variant mean the same thing across a page.

Keep border-width consistent across sibling cards
Mixing 1, 2, and 3 within the same grid or list reads as visual noise rather than intentional hierarchy — pick one value per collection and use hover/variant to differentiate instead.

Do not attach a click handler to the card host with no focusable element inside
The card has no built-in role or keyboard behaviour. A hover="glow" card with a bare onclick on the host is invisible to keyboard and screen-reader users — wrap the content in a real <a> or <button>.

Do not expect size to scale down at smaller viewports
Unlike Badge, Banner, and Callout, size is a fixed token, not a responsive string — a size="lg" card stays size="lg" on every screen width. Set the size explicitly per breakpoint yourself if you need it to change.

Do not use hover="glow" on a purely static, non-interactive card
A glow effect signals "this responds to you" — applying it to a card with no link, button, or click target sets up an expectation the card doesn't deliver on.

API reference

The following are the properties and references of a card

aegov-card default properties

AttributeDescriptionTypeDefault

field-id

DOM id reflected on the inner content <div>. Auto-generated if omitted.

string

auto-generated

appearance

solid full-strength border, light subtle low-contrast border, or creative gradient ring. Colour resolves from variant.

solid | light | creative

solid

variant

Colour family for the border, hover shift, and glow shadow.

primary | secondary | neutral-max | neutral-min

primary

border-width

Border thickness in pixels (solid/light only — see Appearance). For creative this instead sets the gradient ring's thickness.

1 | 2 | 3

2

hover

off no effect, standard border colour shift, glow border shift plus a soft drop-shadow.

off | standard | glow

off

size

Controls inner padding and corner radius. A fixed token — unlike Badge, Banner, and Callout's size, this one does not accept a responsive breakpoint string.

sm | base | lg

base

is-padding

Whether the inner content area has padding at all. Turn off for edge-to-edge media.

boolean

true

data-col-span

Columns to span inside an aegov-bento-grid (or any CSS grid reading this attribute). Responsive syntax supported, e.g. "1 md:2 lg:3".

string

(none)

data-row-span

Rows to span inside an aegov-bento-grid. Responsive syntax supported, e.g. "1 md:2".

string

(none)

Slots

SlotDescription

(default)

Card content. Any markup or other AEGOV components are allowed here.

Events

EventDescription

(none)

The component emits no custom events — it is a pure structural surface.

Pass-through attributes

AttributeNotesForwards to

aria-*

Forwarded to the inner content <div>. Use aria-label/aria-labelledby when the card represents a landmark region.

inner <div>

data-*

Forwarded to the inner content <div> (separate from data-col-span/data-row-span, which a parent grid reads from the host itself).

inner <div>

id

Not forwarded. Use field-id to control the inner <div>'s actual id.

n/a

class, style

Applied to the host element — this is how you set a custom background colour (see Background).

host

There is no built-in click handling or role. If a whole card should be interactive, wrap its content in a real focusable element (<a> or <button>) yourself — see Notes below.

Notes

The following notes are applicable of this component.

Built-in accessibility

  • The card renders a single <div> with no implicit role, so it never interferes with assistive-technology announcements of its slotted content.
  • Hover styles (standard/glow) are visual only — they never substitute for a real focus indicator on whatever's actually interactive inside.

Developer responsibility

The following is required for a developer to add additionally or pay attention to regarding this component.

  • If the whole card should be clickable, wrap its contents in a single focusable <a> or <button> yourself. Do not attach a click handler to the card host with no focusable element inside — keyboard and screen-reader users would have nothing to activate.
  • When a card represents a labelled region, set role="region" and aria-labelledby (pointing at the heading inside) via host attributes — the card supplies neither on its own.
  • Check colour contrast for slotted content against whatever background utility, appearance, and variant you chose — the component does not validate this for you.
  • For media cards using is-padding="false", supply real alt text on every image and add your own inner padding so headings and body copy don't touch the border.
  • The heading level used inside a card (h3 in some examples on this page, h4 in others) is illustrative, not a rule — pick whatever level is next in your actual page's outline. A grid of cards sitting directly under an h2 section heading should use h3; the same card nested one level deeper (for example inside a tabbed panel whose own heading is already an h3) should use h4 instead. Never skip a level just to match an example on this page.

Additional notes

  • size is a fixed token (sm/base/lg) — it does not accept a responsive breakpoint string the way Badge, Banner, and Callout's size props do. Set a different size per breakpoint yourself (e.g. conditionally, or via your own wrapper classes) if you need one.
  • border-width only visibly affects solid/light appearances. For creative, the same prop instead sets the gradient ring's thickness via padding — border-width itself is forced to 0.