Card
Card component with header, footer and content sections.
Selector
smart-card
Properties
Events
Properties
animation"none" | "simple" | "advanced"
Specifies or retrieves the current animation mode. When this property is set to 'none', all animations are disabled; otherwise, the selected animation mode determines how animations are displayed.
Allowed Values
- "none" - animation is disabled
- "simple" - ripple animation is disabled
- "advanced" - all animations are enabled
Default value
"advanced"Example
Set the animation property.
<smart-card animation='none'></smart-card>
Set the animation property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.animation = 'simple';
Get the animation property.
const card = document.querySelector('smart-card');
let animation = card.animation;
contentHandlerfunction | null
A callback function that allows you to attach event handlers and implement custom behaviors within the card element. Use this function to interact with or modify the card's content after it has been rendered, such as adding click listeners, updating UI components, or integrating additional logic specific to the card's context.
Example
Set the contentHandler property.
<smart-card content-handler='null'></smart-card>
Set the contentHandler property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.contentHandler = function(card) {var toggleBtn = card.querySelector('smart-button'),
};
content = card.querySelector('.card-content');
toggleBtn.addEventListener('click', function () {
content.classList.toggle('hidden');
});
Get the contentHandler property.
const card = document.querySelector('smart-card');
let contentHandler = card.contentHandler;
dataSourceobject
This object serves as the data source for populating a card template. Each key corresponds to a placeholder—enclosed in double curly braces within the item's template. The associated values are used to replace these placeholders during rendering, enabling dynamic content injection into the card layout.
Example
Set the dataSource property.
<smart-card data-source='{ property : "value" }'></smart-card>
Set the dataSource property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.dataSource = { property : 'new value' };
Get the dataSource property.
const card = document.querySelector('smart-card');
let dataSource = card.dataSource;
disabledboolean
Prevents user interactions with the element, such as clicking, typing, or focusing, effectively making the element unresponsive to input events.
Default value
falseExample
Set the disabled property.
<smart-card disabled></smart-card>
Set the disabled property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.disabled = false;
Get the disabled property.
const card = document.querySelector('smart-card');
let disabled = card.disabled;
itemTemplateany
Specifies a custom card template for rendering card content. The template can be provided either as a string representing the ID of an '<template>' element present in the DOM, or as a direct reference to an HTMLTemplateElement. Within the template’s HTML content, you may include one or more property placeholders using the double curly braces syntax. During rendering, each placeholder will be dynamically replaced with the corresponding property value from the associated 'dataSource' object. If you set this property using a template ID, the expected type is a string.
Example
Set the itemTemplate property.
<smart-card item-template='templateId1'></smart-card>
Set the itemTemplate property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.itemTemplate = templateId2;
Get the itemTemplate property.
const card = document.querySelector('smart-card');
let itemTemplate = card.itemTemplate;
unlockKeystring
Retrieves or assigns the unlockKey used to activate and gain access to the product’s features. This property is typically required for enabling full functionality after purchase or authorization.
Default value
""Example
Set the unlockKey property.
<smart-card unlock-key=''></smart-card>
Set the unlockKey property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.unlockKey = '1111-2222-3333-4444-5555';
Get the unlockKey property.
const card = document.querySelector('smart-card');
let unlockKey = card.unlockKey;
localestring
Specifies or retrieves the current language setting. This property determines which set of localized messages, as defined in the messages property, will be used for display. Changing the language updates the interface text to match the corresponding translations in messages.
Default value
"en"Example
Set the locale property.
<smart-card locale='de'></smart-card>
Set the locale property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.locale = 'fr';
Get the locale property.
const card = document.querySelector('smart-card');
let locale = card.locale;
localizeFormatFunctionfunction | null
A callback function that allows you to define a custom format for localization messages returned by the Localization Module. Use this to modify or structure the message output according to specific requirements, such as adding prefixes, suffixes, or additional context for improved display or processing.
Example
Set the localizeFormatFunction property.
<smart-card localize-format-function='function(defaultMessage, message, messageArguments){return '...'}'></smart-card>
Set the localizeFormatFunction property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.localizeFormatFunction = function(defaultMessage, message, messageArguments){return '...'};
Get the localizeFormatFunction property.
const card = document.querySelector('smart-card');
let localizeFormatFunction = card.localizeFormatFunction;
messagesobject
Defines or retrieves an object containing localized string resources used within the widget's user interface. This enables the widget's labels, messages, and other text elements to be translated and displayed according to the selected language or region, as specified by the locale property. Use this property to provide custom translations and enhance the widget's internationalization support.
Default value
"en": {
"propertyUnknownType": "'{{name}}' property is with undefined 'type' member!",
"propertyInvalidValue": "Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!",
"propertyInvalidValueType": "Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!",
"elementNotInDOM": "Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",
"moduleUndefined": "Module is undefined.",
"missingReference": "{{elementType}}: Missing reference to {{files}}.",
"htmlTemplateNotSuported": "{{elementType}}: Browser doesn't support HTMLTemplate elements.",
"invalidTemplate": "{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."
}
Example
Set the messages property.
<smart-card messages='{"de":{"propertyUnknownType":"Die Eigenschaft '{{name}}' hat ein nicht definiertes 'type'-Member!","propertyInvalidValue":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualValue}}, Erwarteter Wert: {{value}}!","propertyInvalidValueType":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualType}}, Erwarteter Wert: {{type}}!","elementNotInDOM":"Element existiert nicht in DOM! Bitte fugen Sie das Element zum DOM hinzu, bevor Sie eine Methode aufrufen.","moduleUndefined":"Modul ist nicht definiert.","missingReference":"{{elementType}}: Fehlender Verweis auf {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser unterstutzt keine HTMLTemplate-Elemente.","invalidTemplate":"{{elementType}}: '{{property}}' Die Eigenschaft akzeptiert eine Zeichenfolge, die mit der ID eines HTMLTemplate-Elements aus dem DOM ubereinstimmen muss."}}'></smart-card>
Set the messages property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.messages = {"en":{"propertyUnknownType":"'{{name}}' property is with undefined 'type' member!","propertyInvalidValue":"Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!","propertyInvalidValueType":"Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!","elementNotInDOM":"Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.","moduleUndefined":"Module is undefined.","missingReference":"{{elementType}}: Missing reference to {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser doesn't support HTMLTemplate elements.","invalidTemplate":"{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."}};
Get the messages property.
const card = document.querySelector('smart-card');
let messages = card.messages;
rightToLeftboolean
Gets or sets a value that determines whether the element’s alignment supports right-to-left (RTL) languages, such as Arabic or Hebrew. When enabled, the element’s content and layout are adjusted to display text and interface components in a right-to-left direction, ensuring proper localization for RTL locales.
Default value
falseExample
Set the rightToLeft property.
<smart-card right-to-left></smart-card>
Set the rightToLeft property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.rightToLeft = true;
Get the rightToLeft property.
const card = document.querySelector('smart-card');
let rightToLeft = card.rightToLeft;
themestring
Specifies the theme applied to the element. The theme controls the overall visual appearance, including colors, fonts, and styles, to ensure a consistent look and feel across the element.
Default value
""Example
Set the theme property.
<smart-card theme='blue'></smart-card>
Set the theme property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.theme = 'red';
Get the theme property.
const card = document.querySelector('smart-card');
let theme = card.theme;
unfocusableboolean
If set to true, the element will be excluded from keyboard navigation and cannot receive focus via user interaction, such as tabbing or clicking.
Default value
falseExample
Set the unfocusable property.
<smart-card unfocusable></smart-card>
Set the unfocusable property by using the HTML Element's instance.
const card = document.querySelector('smart-card');
card.unfocusable = false;
Get the unfocusable property.
const card = document.querySelector('smart-card');
let unfocusable = card.unfocusable;
Events
swipebottomCustomEvent
This event is triggered when the user swipes the card downward, indicating a bottom swipe gesture on the card component.
- Bubbles Yes
- Cancelable No
- Interface CustomEvent
- Event handler property onSwipebottom
Arguments
evCustomEvent
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Example
Set up the event handler of swipebottom event.
const card = document.querySelector('smart-card'); card.addEventListener('swipebottom', function (event) { // event handling code goes here. })
swipeleftCustomEvent
This event is triggered whenever the user performs a left swipe gesture on the card, indicating that the card has been dismissed or rejected by swiping it in a leftward direction.
- Bubbles Yes
- Cancelable No
- Interface CustomEvent
- Event handler property onSwipeleft
Arguments
evCustomEvent
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Example
Set up the event handler of swipeleft event.
const card = document.querySelector('smart-card'); card.addEventListener('swipeleft', function (event) { // event handling code goes here. })
swiperightCustomEvent
This event is triggered whenever a user performs a right-swipe gesture on the card element, typically indicating a positive action such as approval or selection. It allows you to execute custom logic in response to the card being swiped to the right.
- Bubbles Yes
- Cancelable No
- Interface CustomEvent
- Event handler property onSwiperight
Arguments
evCustomEvent
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Example
Set up the event handler of swiperight event.
const card = document.querySelector('smart-card'); card.addEventListener('swiperight', function (event) { // event handling code goes here. })
swipetopCustomEvent
This event is triggered when the user swipes the card upwards (toward the top of the screen), indicating a "swipe up" gesture on the card component.
- Bubbles Yes
- Cancelable No
- Interface CustomEvent
- Event handler property onSwipetop
Arguments
evCustomEvent
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Example
Set up the event handler of swipetop event.
const card = document.querySelector('smart-card'); card.addEventListener('swipetop', function (event) { // event handling code goes here. })