Custom Button#

The CustomButton component is a highly customizable button for your player. It can be used in two ways:

  • As a simple button that triggers a custom event.
  • As a button with a menu, where each menu item can trigger its own event.

Configuration Options for #

OptionTypeDescription
enabledbooleanWhether the button is enabled or not. Defaults to true.
classNamestring or array of stringsCustom CSS class(es) for the button. You can pass multiple class names as an array.
controlTextstringText that will appear on the button. Used for accessibility.
eventNamestringThe event that will be triggered when the button is clicked.
menuItemsmenuItem[]Array of menu item objects for the button to display a dropdown.
stylestringInline styles for the button element.
iconNamestringIcon name for the button (e.g., 'play', 'pause', etc.). This can be used to set an icon on the button.

Configuration Options for #

OptionTypeRequiredDescription
labelstringYesThe label to display for the menu item.
eventNamestringNoThe event triggered when the menu item is clicked. If not provided, the menu item won't trigger any event.

Example Configurations#

Option 1: Simple Button#

const player = window.kwikMotion('my-video', {
  ccbutton: {
    enabled: true,
    className: 'some-class test-class',
    controlText: 'Click Me',
    eventName: 'cclick',
  },
})

Option 2: Button with Menu#

const player = window.kwikMotion('my-video', {
  ccbutton: {
    className: 'cass',
    controlText: 'click Me',
    eventName: 'click',
    menuItems: [
      {
        label: 'Option 1',
        eventName: 'menuOption1Click',
      },
      {
        label: 'Option 2',
        eventName: 'menuOption2Click',
      },
    ],
  },
})