Skip to content

Option function for customizing modal dimensions #1831

@wbobeirne

Description

@wbobeirne

Hey there, loving Sheperd.js so far. I've got an element I want to highlight that has an unusual height calculation due to being a list of unknown size. I'd love to be able to have my own custom function for determining modal size. Ideally it'd be called right after openingProperties is assigned and just let me modify the object directly, or return a new object. Something like:

const tour = new Shepherd.Tour({
  useModalOverlay: true,
  defaultStepOptions: {
    modalOverlayPosition: (props) => {
      // Set maximum overlay size to window height minus padding
      props.height = Math.min(props.height, window.innerHeight - 40);
    },
  }
});

Just an example, not my exact use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions