ComPDFKit Web SDK
    Preparing search index...

    Class PresetButton

    A built-in button such as undo, redo, download or print, selected by buttonType (a value of UI.PRESET_BUTTON_TYPES).

    const printButton = new instance.UI.Components.PresetButton({
    dataElement: 'headerPrintButton',
    buttonType: instance.UI.PRESET_BUTTON_TYPES.PRINT,
    });
    const header = instance.UI.getModularHeader('default-top-header');
    header.setItems([...header.getItems(), printButton]);

    Hierarchy (View Summary)

    Index
    • Creates a built-in button.

      Parameters

      • props: { [x: string]: unknown }

        buttonType (required), dataElement (defaults to buttonType), img, label, title.

      Returns PresetButton

    • Replaces the inline CSS styles of the item and updates it on screen when it is already in the UI.

      Parameters

      • style: Record<string, unknown>

        CSS property names (camelCase) mapped to their values.

      Returns void

    buttonType: string

    The built-in button to create (a value of UI.PRESET_BUTTON_TYPES). It is also used as the dataElement when none is given.

    className?: string

    Extra CSS class names added to the item's element.

    dataElement: string

    Unique name of the item; used to find, show, hide or update it later.

    disabled?: boolean

    Whether the item is disabled (rendered but not clickable).

    hidden?: boolean | string[]

    Hides the item: true always hides it; an array of screen sizes ('desktop', 'tablet', 'mobile', 'small-mobile') hides it only on those screen sizes.

    icon?: string

    Icon name of the built-in button.

    img?: string

    Icon that replaces the built-in icon.

    label?: string

    Text shown on the button, or a translation key.

    style?: Record<string, unknown>

    Inline CSS styles applied to the item's element.

    title?: string

    Tooltip text, or a translation key that is resolved in the current language.

    type?: string

    Item type (for example 'customButton', 'toolButton', 'divider'); set by each subclass.