Card

Group related information and actions in one area.

Live preview
Interact with the component to see results here.
View code
HTML
<sy-card
  title="Project status"
  collapsible
  active
  show-footer
  id="sample"
>
  <p>Review this week's completed work and upcoming schedule.</p><span
    slot="footer"
  >Last updated · Today</span>
</sy-card>

Usage guide

#

Contain one independent collection of information, such as a project or product. Use Layout or Flex for simple page arrangement.

Title and tools
Put the title in cardTitle or the header slot, and secondary actions in header-actions.
Body and footer
Place content in the default slot and follow-up actions in footer.
Cover image
The cover slot is displayed only when showCover is also enabled.

Feature examples

#

Choose a feature from 4 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.

Usage examples · Overview

Try the selected example. Topics with multiple configurations let you switch between detailed examples.

View code
HTML
Loading the example.

Property · Backdrop

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Collapsible

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Usage examples · Initially collapsed card

Start with the card collapsed and open its content from the header.

View code
HTML
<sy-card
  title="Project status"
  collapsible
  active="false"
  show-footer
  id="sample"
>
  <p>Review this week's completed work and upcoming schedule.</p><span
    slot="footer"
  >Last updated · Today</span>
</sy-card>

<script type="module">
  const component1 = document.querySelector("#sample");
  Object.assign(component1, {
    "collapsible": true,
    "active": false
  });
</script>

API reference

#

Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.

<sy-card>

Properties

Attribute / PropertyTypeDefaultDescription
booleanfalseAllow the card content to be collapsed and expanded.
booleantrueWhether the body is expanded.
booleanfalseShow the cover slot.
booleantrueShow the footer slot.
booleanfalseUse the card backdrop effect.
booleanfalseAllow scrollbars in the content area.
booleanfalseShow the status icon.
string''Set icon visibility or icon content. Check the format supported by each component.
string'Card Title'Card title.
booleanfalseLegacy alias for `show-backdrop`.
number0Expansion delay in milliseconds.
number0Collapse delay in milliseconds.

Events

EventDetailDescription
CustomEvent<{ active: boolean }>Read the result from the event's detail.

Methods

MethodReturnsDescription
Promise<void>Toggle the current expansion state.
Promise<void>Expand the body.
Promise<void>Collapse the body.

Slots

SlotDescription
Content displayed in the cover area.
Content displayed in the header area.
Content displayed in the header-actions area.
Component body or child items.
Content displayed in the footer area.