Skip to content

Card Module

The Card module provides a flexible container with sections, overlays, and decorators. It supports colors, gaps, sizes, and state modifiers such as loading and overlay.

Header
Default Card
lorem...
lorem...

This is an overlay

Signature:

scss
@mixin use-card($colors: (), $gaps: ());

Example:

scss
@include termeh.use-card(("primary", "danger"), ("macro", "small"));

Module:

This module is registered as card in the presented modules.

Dependencies

Card module uses the following Termeh global var():

ComponentTypeUsageDefault
basecolorColorFallback background and overlaywhite
baseforegroundColorFallback foreground and overlay spinner colorblack
basesectionColorSecondary section backgroundnull
baseseparatorColorSeparator backgroundnull
boxbackgroundColorCard background and overlay fallback backgroundFALLBACK
boxforegroundColorCard foreground and overlay fallback spinner colorFALLBACK
boxshadowListDefault box shadownull
boxsizesListDefault box sizes()
gapmacroNumberDefault card padding and bottom margin1.6em
radiusnormalNumberDefault border-radiusnull
decoratorsizeNumberLoading spinner thickness2px
decoratorspinnerNumberLoading spinner size2em
overlaybackgroundColorOverlay background colorFALLBACK
overlayfouregroundColorOverlay foregroundFALLBACK
overlayopacityNumberOverlay background opacity0.85
overlayfilterStringOverlay backdrop filternull

Card module uses the following Termeh color() and variant():

Color / VariantUsageDefault
shadeDefault decorator colorerror
primaryDefault scrollbar accent colorerror

Modifiers Classes

  • .is-loading → adds a loading state
  • .is-overlaid → displays an overlay element
  • .is-top-decorated → adds a top border decoration
  • .is-bottom-decorated → adds a bottom border decoration
  • .is-<gap>-gap → applies a predefined spacing value
  • .is-<color> → applies a predefined accent color
  • .is-<size> → applies a predefined box size (default card width)

Child Elements

  • .separator → horizontal divider line
  • .section → content block inside a card
  • .overlay → overlay container, shown when the card has .is-overlaid; must be placed as the last child of the card

Section Modifiers

  • .is-header → header section, fixed to the top with adjusted margin
  • .is-footer → footer section, fixed to the bottom with adjusted margin
  • .is-secondary → applies section background styling
  • .top-sticky → sticks the section to the top of the card
  • .bottom-sticky → sticks the section to the bottom of the card

Separator Modifiers

  • .is-attached → full-width divider with no margin