Element: <oj-switch>

Oracle® JavaScript Extension Toolkit (JET)
15.1.0

F83700-01

DOM Interface: SwitchElement

Version:
  • 15.1.0
Since:
  • 0.7.0
.oj-focus-highlight
Under normal circumstances this class is applied automatically. It is documented here for the rare cases that an app developer needs per-instance control.

The oj-focus-highlight class applies focus styling that may not be desirable when the focus results from pointer interaction (touch or mouse), but which is needed for accessibility when the focus occurs by a non-pointer mechanism, for example keyboard or initial page load.

The application-level behavior for this component is controlled in the theme by the $focusHighlightPolicy SASS variable; however, note that this same variable controls the focus highlight policy of many components and patterns. The values for the variable are:

nonPointer: oj-focus-highlight is applied only when focus is not the result of pointer interaction. Most themes default to this value.
all: oj-focus-highlight is applied regardless of the focus mechanism.
none: oj-focus-highlight is never applied. This behavior is not accessible, and is intended for use when the application wishes to use its own event listener to precisely control when the class is applied (see below). The application must ensure the accessibility of the result.

To change the behavior on a per-instance basis, the application can set the SASS variable as desired and then use event listeners to toggle this class as needed.
Example
<oj-switch class="oj-focus-highlight">
  <!-- Content -->
</oj-switch>
.oj-switch
Top level switch class.

CSS Variables

See JET CSS Variables for additional details.
Name Type Description
--oj-switch-track-height <length> Switch track height
--oj-switch-track-width <length> Switch track width
--oj-switch-track-border-radius <length> | <percentage> Switch track border radius
--oj-switch-thumb-to-track-horizontal-margin <length> Switch thumb to track horizontal margin
--oj-switch-thumb-height <length> Switch thumb height
--oj-switch-thumb-width <length> Switch thumb width
--oj-switch-thumb-border-radius <length> | <percentage> Switch thumb border radius
Enabled
CSS variables used by oj-switch when enabled
Name Type Description
--oj-switch-track-bg-color <color> Switch track background color when enabled
--oj-switch-track-border-color <color> Switch track border color when enabled
--oj-switch-thumb-bg-color <color> Switch thumb background color when enabled
--oj-switch-thumb-border-color <color> Switch thumb border color when enabled
--oj-switch-thumb-box-shadow Switch thumb box shadow when enabled
Hovered
CSS variables used by oj-switch when hovered
Name Type Description
--oj-switch-track-bg-color-hover <color> Switch track background color when hovered
--oj-switch-track-border-color-hover <color> Switch track border color when hovered
--oj-switch-track-border-color-hover <color> Switch track border color when hovered
--oj-switch-thumb-bg-color-hover <color> Switch thumb background color when hovered
--oj-switch-thumb-border-color-hover <color> Switch thumb border color when hovered
--oj-switch-thumb-box-shadow-hover Switch thumb box shadow when hovered
Selected hovered
CSS variables used by oj-switch when selected and hovered
Name Type Description
--oj-switch-track-bg-color-selected-hover <color> Switch track background color when selected and hovered
--oj-switch-track-border-color-selected-hover <color> Switch track border color when selected and hovered
--oj-switch-thumb-bg-color-selected-hover <color> Switch thumb background color when selected and hovered
--oj-switch-thumb-border-color-selected-hover <color> Switch thumb border color when selected and hovered
--oj-switch-thumb-box-shadow-selected-hover Switch thumb box shadow when selected and hovered
Active
CSS variables used by oj-switch when active
Name Type Description
--oj-switch-track-bg-color-active <color> Switch track background color when active
--oj-switch-track-border-color-active <color> Switch track border color when active
--oj-switch-thumb-bg-color-active <color> Switch thumb background color when active
--oj-switch-thumb-border-color-active <color> Switch thumb border color when active
--oj-switch-thumb-box-shadow-active Switch thumb box shadow when active
--oj-switch-thumb-width-active <length> Switch thumb width when active
Selected active
CSS variables used by oj-switch when selected and active
Name Type Description
--oj-switch-track-bg-color-selected-active <color> Switch track background color when selected and active
--oj-switch-track-border-color-selected-active <color> Switch track border color when selected and active
--oj-switch-thumb-bg-color-selected-active <color> Switch thumb background color when selected and active
--oj-switch-thumb-border-color-selected-active <color> Switch thumb border color when selected and active
--oj-switch-thumb-box-shadow-selected-active Switch thumb box shadow when selected and active
Disabled
CSS variables used by oj-switch when disabled
Name Type Description
--oj-switch-track-bg-color-disabled <color> Switch track background color when disabled
--oj-switch-track-border-color-disabled <color> Switch track border color when disabled
--oj-switch-thumb-bg-color-disabled <color> Switch thumb background color when disabled
--oj-switch-thumb-border-color-disabled <color> Switch thumb border color when disabled
Selected disabled
CSS variables used by oj-switch when selected and disabled
Name Type Description
--oj-switch-track-bg-color-selected-disabled <color> Switch track background color when selected and disabled
--oj-switch-track-border-color-selected-disabled <color> Switch track border color when selected and disabled
--oj-switch-thumb-bg-color-selected-disabled <color> Switch thumb background color when selected and disabled
--oj-switch-thumb-border-color-selected-disabled <color> Switch thumb border color when selected and disabled