Card Pattern

Navigation: uCss > Source > Modules > Patterns > Card

Modules: Config | Base | Layout | Theming | Typography | Patterns | Utilities

The Universal Container. A layout-agnostic, composable card component that adapts to its container's grid and supports subgrid alignment.


πŸ“‘ Contents


🌟 Overview

The Card (.crd) is the primary "Holder" of content in uCss. Unlike traditional frameworks that give you a rigid card structure, uCss cards are shells that handle:

  1. Background & Surface: Inherits or sets surface colors.
  2. Padding: Manages internal spacing consistently.
  3. Layout Context: Integration with Grid/Flex.

🀯 Features

1. Subgrid Aware (.crd.sg)

Cards can be transparent to the grid. By adding .sg, to the card's .crd >.crd__content > * internals (Header, Body, Footer) can align directly to the parent grid's tracks, creating "Holy Grail" layouts where headers of adjacent cards are always the same height.

2. Media Handling

The .crd__media element allows for full-bleed images that ignore the card's padding, perfect for cover images.

3. Interactive Transforms

Cards come with predefined transform variables. Adjust --crd-tf on hover to create lift effects.


πŸš€ Usage

<!-- Basic Card -->
<article class="crd">
  <div class="crd__content">
    <h3 class="crd__header">Card Title</h3>
    <p class="crd__body">Some interesting content here.</p>
    <footer class="crd__footer">Read More</footer>
  </div>
</article>

<!-- Card with Cover Image -->
<article class="crd">
  <figure class="crd__media med ar-16-9">
    <img src="cover.jpg" alt="Cover">
  </figure>
  <div class="crd__content">
    <h3>Title</h3>
  </div>
</article>

πŸ“¦ Files Reference

The src/lib/patterns/card directory contains:

File Description
base.css The shell (.crd). Backgrounds, radius, shadows.
content.css Inner wrapper (.crd__content). Handles padding.
media.css Full-bleed media (.crd__media).
subgrid.css Subgrid logic (.crd.sg).

πŸ“ Content Map

Class Description
.crd Main wrapper.
.crd__content Padded inner content area.
.crd__media Media container (removes padding).
.crd__header Slot for header.
.crd__body Slot for body.
.crd__footer Slot for footer.
.crd.sg Enable subgrid rows.

Navigation: uCss > Source > Modules > Patterns > Card

Back to top

License: MPL-2.0 Copyright: © 2025 Shukhrat (Alive 🜁) ※ UNQA

πŸ—ΊοΈ Visual Map

src/lib/
β”œβ”€β”€ config/                  # 1. CONFIGURATION (The Brain)
β”‚   β”œβ”€β”€ root/                #    - Semantic Modules
β”‚   β”‚   β”œβ”€β”€ colors.css       #    - Palettes & Themes
β”‚   β”‚   β”œβ”€β”€ typography.css   #    - Fonts & Scales
β”‚   β”‚   β”œβ”€β”€ layout.css       #    - Radius & Spacing
β”‚   β”‚   └── patterns.css     #    - Component Vars
β”‚   β”œβ”€β”€ adapters/            #    - CMS Adapters
β”‚   β”‚   β”œβ”€β”€ blocksy.css      #    - Blocksy Theme
β”‚   β”‚   └── gutenberg.css    #    - WordPress Block Editor
β”‚   └── root.css             #    - Entry Point
β”‚
β”œβ”€β”€ base/                    # 2. BASE (The Foundation)
β”‚   β”œβ”€β”€ html/                #    - HTML Engine
β”‚   β”‚   β”œβ”€β”€ reset.css        #    - Normalization
β”‚   β”‚   β”œβ”€β”€ typography.css   #    - Text Defaults
β”‚   β”‚   β”œβ”€β”€ flow.css         #    - Smart Flow Engine
β”‚   β”‚   β”œβ”€β”€ lists.css        #    - List Styles
β”‚   β”‚   β”œβ”€β”€ forms.css        #    - Input Styling
β”‚   β”‚   └── helpers.css      #    - HTML Utilities
β”‚   └── html.css             #    - Entry Point
β”‚
β”œβ”€β”€ patterns/                # 3. PATTERNS (The Components)
β”‚   β”œβ”€β”€ button/              #    - Atomic Component
β”‚   β”‚   β”œβ”€β”€ base.css
β”‚   β”‚   └── group.css
β”‚   β”œβ”€β”€ card/                #    - Card Component <== YOU ARE HERE
β”‚   β”‚   β”œβ”€β”€ base.css
β”‚   β”‚   β”œβ”€β”€ content.css      #    - Slots & Padding
β”‚   β”‚   β”œβ”€β”€ media.css        #    - Full-bleed Media
β”‚   β”‚   └── subgrid.css      #    - Subgrid Support
β”‚   β”œβ”€β”€ button.css           #    - Aggregator
β”‚   β”œβ”€β”€ card.css             #    - Aggregator
β”‚   β”œβ”€β”€ media.css            #    - Media Wrapper
β”‚   β”œβ”€β”€ link.css             #    - Link Wrapper
β”‚   └── patterns.css         #    - Entry Point
β”‚
β”œβ”€β”€ layout/                  # 4. LAYOUT (The Skeleton)
β”‚   β”œβ”€β”€ grid/                #    - Grid Engine
β”‚   β”‚   β”œβ”€β”€ base.css         #    - Core Logic
β”‚   β”‚   β”œβ”€β”€ columns.css      #    - Presets
β”‚   β”‚   β”œβ”€β”€ subgrid.css      #    - Smart Grid
β”‚   β”‚   β”œβ”€β”€ recipes.css      #    - Smart Logic (.masonry .g-row)
β”‚   β”‚   └── item.css         #    - Child Logic
β”‚   β”œβ”€β”€ flex/                #    - Flex Engine
β”‚   β”‚   β”œβ”€β”€ base.css         #    - Core Logic
β”‚   β”‚   β”œβ”€β”€ alignment.css    #    - Alignment Tools
β”‚   β”‚   β”œβ”€β”€ gaps.css         #    - Smart Gaps
β”‚   β”‚   └── item.css         #    - Child Logic
β”‚   β”œβ”€β”€ container.css        #    - Container Queries (.c)
β”‚   β”œβ”€β”€ flex.css             #    - Entry Point
β”‚   β”œβ”€β”€ grid.css             #    - Entry Point
β”‚   └── section.css          #    - Structural Layout
β”‚
β”œβ”€β”€ theming/                 # 5. THEMING (The Skin)
β”‚   β”œβ”€β”€ set.css
β”‚   └── overlay.css
β”‚
β”œβ”€β”€ typography/              # 6. TYPOGRAPHY (The Voice)
β”‚   β”œβ”€β”€ title.css
β”‚   β”œβ”€β”€ text.css
β”‚   └── text-align.css
β”‚
└── utilities/               # 7. UTILITIES (The Tools)
    β”œβ”€β”€ display.css
    β”œβ”€β”€ position.css
    β”œβ”€β”€ overflow.css
    β”œβ”€β”€ margin.css
    β”œβ”€β”€ padding.css
    β”œβ”€β”€ radius.css
    β”œβ”€β”€ size.css             #    - Size Utilities
    β”œβ”€β”€ blur.css
    └── utilities.css