Element: <oj-action-card>

Oracle® JavaScript Extension Toolkit (JET)
16.1.0

F92237-01

Since:
  • 9.1.0
Module:
  • ojactioncard

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:

  • Deprecated APIs are not available in Core Pack, and are not documented in this migration section.
  • Before trying to migrate to Core Pack run the JET audits and fix any issues before proceeding.
  • The refresh() method is no longer supported in Core Pack. See the Core Pack Migration Guide for more information.

To migrate from oj-action-card to oj-c-action-card, you need to revise the import statement.
Background Color
CSS background-color is not yet supported in oj-c-action-card.


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

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 a value for a property or a single subproperty for complex properties.
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 [property]Changed 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