Skip to content

useCustomLogic

You can build your own custom hook to perform unique logic. There are many widgets that can live inside a floating element (like a datepicker), so being able to extend the library is important.

If you want to pass it into useInteractions(), you can return an object with the following shape:

const useCustomLogic = (
  context: FloatingContext
): ElementProps => {
  // Note: all 3 of these properties are optional.
  return {
    reference: {
      // React.HTMLProps
    },
    floating: {
      // React.HTMLProps
    },
    item: {
      // React.HTMLPRops
    },
  };
};

If you have ideas for new hooks or functionality, don't hesitate to open a new issue or discussion on the GitHub repo ❤️!