Class

CardComponent

.card~CardComponent(type, title, body, subtitle, color, separator, borders, inlineContent, inlineContentPosition) → {void}

Constructor

# new CardComponent(type, title, body, subtitle, color, separator, borders, inlineContent, inlineContentPosition) → {void}

CardComponent is a standalone Angular component built on Ionic's IonCard primitives. It exposes several @Input() properties to control appearance and content: type, title, body, subtitle, color, separator, borders, inlineContent, and inlineContentPosition. The component integrates with the application's media service to react to dark-mode changes and toggles the dark-palette CSS class on the host element accordingly.

Reusable, presentational card UI component for use across the application.

sequenceDiagram participant App as Consumer participant Card as CardComponent participant Media as MediaService App->>Card: instantiate Card->>Media: isDarkMode() Media-->>Card: Observable (isDark) Card->>Card: toggleClass(..., isDark)
Parameters:
Name Type Description
type 'clear' | 'shadow'

Visual rendering style for the card; 'clear' (default) or 'shadow'.

title string

Primary title text displayed in the card header.

body 'small' | 'default' | 'blank'

Body size preset controlling padding/typography; defaults to 'default'.

subtitle string

Optional subtitle rendered under the title.

color Color

Ionic color token applied to the card header/title.

separator boolean

When true, renders a divider between header and body.

borders boolean

Controls whether borders are rendered; defaults to true.

inlineContent string | SafeHtml

Inline HTML/SafeHtml to render inside the body.

inlineContentPosition 'top' | 'bottom'

Where to render inlineContent relative to the body; defaults to 'bottom'.

View Source lib/components/card/card.component.ts, line 22

void
Example
<ngx-decaf-card
  [type]="'shadow'"
  [title]="'Account overview'"
  [subtitle]="'Summary for the current user'"
  [color]="'primary'"
  [separator]="true"
  [borders]="true"
  [inlineContent]="safeHtmlValue"
  inlineContentPosition="top"
>
  <!-- card content here -->
</ngx-decaf-card>

Members

'small' | 'default' | 'blank'

# body

Adjusts padding and typographic scale inside the card body. 'small' reduces spacing, 'blank' hides the body area.

Body size preset for the card.

Default Value:
  • 'default'

View Source lib/components/card/card.component.ts, line 87

'small' | 'default' | 'blank'

# body

Adjusts padding and typographic scale inside the card body. 'small' reduces spacing, 'blank' hides the body area.

Body size preset for the card.

Default Value:
  • 'default'

View Source lib/components/card/card.component.ts, line 224

boolean

# borders

Set to false to remove borders for inline or transparent card designs. Marked override to explicitly shadow the base directive's value.

Controls whether the card renders borders.

Default Value:
  • true

View Source lib/components/card/card.component.ts, line 115

boolean

# borders

Set to false to remove borders for inline or transparent card designs. Marked override to explicitly shadow the base directive's value.

Controls whether the card renders borders.

Default Value:
  • true

View Source lib/components/card/card.component.ts, line 256

Color

# color

When provided, the color token (for example 'primary' or 'tertiary') is applied to title/header elements where supported.

Ionic color token applied to the card.

Default Value:
  • ''

View Source lib/components/card/card.component.ts, line 101

Color

# color

When provided, the color token (for example 'primary' or 'tertiary') is applied to title/header elements where supported.

Ionic color token applied to the card.

Default Value:
  • ''

View Source lib/components/card/card.component.ts, line 240

string

# componentName

Read-only-ish string identifying the concrete component class for instrumentation, styling helpers and debug logs.

Internal component identifier used by the base NgxComponentDirective.

View Source lib/components/card/card.component.ts, line 133

string

# protected componentName

Read-only-ish string identifying the concrete component class for instrumentation, styling helpers and debug logs.

Internal component identifier used by the base NgxComponentDirective.

View Source lib/components/card/card.component.ts, line 278

string | SafeHtml

# inlineContent

Useful for short snippets of rich content provided by the consumer. When passing raw HTML prefer SafeHtml to avoid sanitization issues.

Inline HTML or SafeHtml content to render inside the card body.

View Source lib/components/card/card.component.ts, line 121

string | SafeHtml

# inlineContent

Useful for short snippets of rich content provided by the consumer. When passing raw HTML prefer SafeHtml to avoid sanitization issues.

Inline HTML or SafeHtml content to render inside the card body.

View Source lib/components/card/card.component.ts, line 263

'top' | 'bottom'

# inlineContentPosition

Pass 'top' to render inline content above the body or 'bottom' to render it below. Defaults to 'bottom'.

Position where inlineContent is rendered within the body.

View Source lib/components/card/card.component.ts, line 127

'top' | 'bottom'

# inlineContentPosition

Pass 'top' to render inline content above the body or 'bottom' to render it below. Defaults to 'bottom'.

Position where inlineContent is rendered within the body.

View Source lib/components/card/card.component.ts, line 270

boolean

# separator

When true, a divider line (or equivalent styling) is rendered to separate the header from the body.

Toggle to render a visual separator between header and content.

Default Value:
  • false

View Source lib/components/card/card.component.ts, line 108

boolean

# separator

When true, a divider line (or equivalent styling) is rendered to separate the header from the body.

Toggle to render a visual separator between header and content.

Default Value:
  • false

View Source lib/components/card/card.component.ts, line 248

string

# subtitle

Use for short secondary text such as an explanation or contextual note.

Optional subtitle shown below the title in the header area.

Default Value:
  • ''

View Source lib/components/card/card.component.ts, line 94

string

# subtitle

Use for short secondary text such as an explanation or contextual note.

Optional subtitle shown below the title in the header area.

Default Value:
  • ''

View Source lib/components/card/card.component.ts, line 232

string

# title

Rendered prominently at the top of the card; consumers should pass a short, human-friendly string.

Primary title text for the card header.

Default Value:
  • ''

View Source lib/components/card/card.component.ts, line 80

string

# title

Rendered prominently at the top of the card; consumers should pass a short, human-friendly string.

Primary title text for the card header.

Default Value:
  • ''

View Source lib/components/card/card.component.ts, line 216

'clear' | 'shadow'

# type

Controls the card's surface treatment. Use 'clear' for a flat look or 'shadow' to add elevation.

Visual rendering style for the card.

Default Value:
  • 'clear'

View Source lib/components/card/card.component.ts, line 73

'clear' | 'shadow'

# type

Controls the card's surface treatment. Use 'clear' for a flat look or 'shadow' to add elevation.

Visual rendering style for the card.

Default Value:
  • 'clear'

View Source lib/components/card/card.component.ts, line 208

Methods

# ngOnInit() → {void}

ngOnInit sets the component as initialized and subscribes to the application's media service dark-mode observable. On each emission it updates the local isDarkMode flag and calls the media service helper to toggle the dark-palette CSS class on the component host element. The subscription uses the provided mediaService observable and performs side effects only.

Angular lifecycle hook: component initialization.

View Source lib/components/card/card.component.ts, line 290

void