Element: <oj-action-card>

Oracle® JavaScript Extension Toolkit (JET)
21.0.0

G39657-01

Since:
  • 9.1.0
Module:
  • ojactioncard

Note: This component is in maintenance mode. Suggested alternative: <oj-c-action-card>. For help updating an existing application, see the migration section.

QuickNav


JET Action

Description: Themeable, WAI-ARIA-compliant element that represents a card.

A JET Action Card provides a styled rectangular area with hover/focus/active state rendering, along with an ojAction event. It is used to enclosed a layout card component or or generic html. The action card is intended for consumption by waterfall containers.


<oj-action-card on-oj-action="[[actionHandler]]">
  Sample Text
</oj-action-card>

As oj-action-card does not style the enclosed content, the application is responsible for ensuring that text colors used will satisfy the 3.1 contrast ratio between background color and text to comply with accessibility requirements.

Touch End User Information

Target Gesture Action
Action Card Tap Invoke the card's action.

Keyboard End User Information

Target Key Action
Action Card Enter or Space Invoke the card's action

Accessibility

For accessibility, a JET Action Card that doesn't have any text in its default slot (making it an icon-only button) should include an aria-label attribute that indicate its purpose.

A clarification in accessibility rules states that any element with role=button should not have interactive elements inside:

https://www.w3.org/TR/html-aria/#allowed-descendants-of-aria-roles

Migration

Read about current Core Pack limitations to decide when to migrate.
Please make note of the following:

To migrate from oj-action-card to oj-c-action-card, you need to revise the import statement.

Change the import from ojs/ojactioncard to oj-c/action-card.

Background Color
The oj-c-action-card component supports per-card background colors with the bg-color attribute. To migrate a supported oj-bg-* background helper class on the action card, remove the oj-bg- prefix and set the value on bg-color. For example, class="oj-bg-warning-30" becomes bg-color="warning-30". See the oj-c-action-card bg-color API for the supported values. High neutral values apply a contrasting color scheme to card content, so remove oj-color-invert from the migrated action card when it was only used for background contrast.


Usage

Signature:

interface ActionCardElement

Typescript Import Format
//To typecheck the element APIs, import as below.
import { ActionCardElement } from "ojs/ojactioncard";

//For the transpiled javascript to load the element's module, import as below
import "ojs/ojactioncard";

For additional information visit:

Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.


Styling

CSS Variables

See JET CSS Variables for additional details.
Action Card CSS
CSS variable that specify action card hover scale
Name Description
--oj-action-card-scale-hover Action card hover scale. This variable is deprecated and is not supported by oj-c-action-card.

Slots

JET components that allow child content support slots. Please see the slots section of the JET component overview doc for more information on allowed slot content and slot types.

Default

The Default slot is the actions's body. It should not be explicitly named.

Example

Displays the content in the central area of the action

<oj-action-card>
Default Card
</oj-action-card>

Events

ojAction

Triggered when an action card is clicked. This will be triggered by keyboard events as well as mouse/touch events.

When double-clicking or multi-clicking (as determined by the browser), only the first click will trigger the ojAction event.

To ensure keyboard accessibility, the only correct, supported way to react to the click of a card is to listen for this event. Click listeners should not be used.

Since:
  • 9.1.0

Methods

getProperty(property) : {any}

Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description
property string The property name to get. Supports dot notation for subproperty access.
Returns:
Type
any

setProperties(properties) : {void}

Performs a batch set of properties.
Parameters:
Name Type Description
properties object An object containing the property and value pairs to set.
Returns:
Type
void

setProperty(property, value) : {void}

Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a corresponding event.
Parameters:
Name Type Description
property string The property name to set. Supports dot notation for subproperty access.
value any The new value to set the property to.
Returns:
Type
void