Element: <oj-c-toggle-button>

CORE PACK

Oracle® JavaScript Extension Toolkit (JET)
17.0.0

F92240-01

Since:
  • 17.0.0
Module:
  • toggle-button

Note: This component supersedes the following component: <oj-buttonset-many>. Migration info available at preceding link.

QuickNav

Attributes


JET ToggleButton

Description: Themeable, WAI-ARIA-compliant toggle button, with appropriate styles for hover, active, and disabled.

<oj-c-toggle-button id="myToggleButton" value="{{value}}" label="My ToggleButton">
</oj-c-toggle-button>
<oj-c-toggle-button label="start icon">
  <span slot='startIcon' class='myIconClass'></span>
</oj-c-toggle-button>
 <oj-c-toggle-button label="end icon">
  <span slot='endIcon' class='myIconClass'></span>
</oj-c-toggle-button>

Toggle Buttons

Toggle Buttons allow users to switch between states when clicked or tapped. Toggle buttons are created from oj-c-toggle-button elements.

Touch End User Information

Target Gesture Action
Push ToggleButton Tap Push the button.

Keyboard End User Information

Target Key Action
Push Toggle Button Enter or Space Push the button.

Accessibility

For accessibility, it is not required to set an aria label on a JET button as it uses the label text to generate an aria label. Therefore the label should be specified even if the button is icon-only (display=icons). However, you can override the default behavior by setting aria-label. The label can be hidden using the display attribute.

Disabled content: JET supports an accessible luminosity contrast ratio, as specified in WCAG 2.0 - Section 1.4.3 "Contrast", in the themes that are accessible. (See the "Theming" chapter of the JET Developer Guide for more information on which themes are accessible.) Note that Section 1.4.3 says that text or images of text that are part of an inactive user interface component have no contrast requirement. Because disabled content may not meet the minimum contrast ratio required of enabled content, it cannot be used to convey meaningful information.


Usage

Signature:

interface CToggleButtonElement

Typescript Import Format
//To typecheck the element APIs, import as below.
import { CToggleButtonElement } from "oj-c/toggle-button";

//For the transpiled javascript to load the element's module, import as below
import "oj-c/toggle-button";

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.


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.

endIcon

The endIcon slot is the button's end icon. The oj-c-toggle-button element accepts DOM nodes as children with the endIcon slot.

startIcon

The startIcon slot is the button's start icon. The oj-c-toggle-button element accepts DOM nodes as children with the startIcon slot.

Attributes

chroming :"borderless"|"outlined"

Indicates in what states the button has variants in background and border.
Supported Values:
Value Description
borderless Borderless buttons are a less prominent variation.
outlined Outlined buttons are a more prominent variation.
Default Value:
  • "outlined"
Names
Item Name
Property chroming
Property change event chromingChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-chroming-changed

disabled :boolean

Specifies that the button element should be disabled.
Default Value:
  • false
Names
Item Name
Property disabled
Property change event disabledChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-disabled-changed

display :"all"|"icons"|"label"

Display just the label, the icons, or all. Label is used as tooltip and should be set in all cases.
Supported Values:
Value Description
all Display both the label and icons.
icons Display only the icons.
label Display only the text label.
Default Value:
  • "all"
Names
Item Name
Property display
Property change event displayChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-display-changed

label* :string

Text to show in the button.
Names
Item Name
Property label
Property change event labelChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-label*-changed

size :"sm"|"md"|"lg"

Size of button
Supported Values:
Value Description
lg Display a large button.
md Display a default size button.
sm Display a small button.
Default Value:
  • "md"
Names
Item Name
Property size
Property change event sizeChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-size-changed

tooltip :string

Text to show in the tooltip. This overrides the default tooltip that renders the label when in icon mode.
Default Value:
  • ""
Names
Item Name
Property tooltip
Property change event tooltipChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-tooltip-changed

value :boolean

Specifies if the toggle button is selected
Default Value:
  • false
Supports writeback:
  • true
Names
Item Name
Property value
Property change event valueChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-value-changed

width :(number|string)

Specifies that the button style width
Names
Item Name
Property width
Property change event widthChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-width-changed

Methods

getProperty(property) : {any}

Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description
property 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 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 The property name to set. Supports dot notation for subproperty access.
value The new value to set the property to.
Returns:
Type
void