Portal

Portal allows content to escape width restrictions of a Block or HeroBlock.

Portal will render content at the end of the root div. This lets you to build something like a sidebar menu.

CAVEATS:

  1. You should only use this component in the HeroBlock, and only once.

  2. It only allows a single child inside it:

    // THIS WILL BREAK
    <Portal>
      <div>
        <!-- content -->
      </div>
      <div>
        <!-- content -->
      </div>
    </Portal>
    
    // Correct
    <Portal>
      <div>
        <!-- content -->
      </div>
    </Portal>
    
  3. Because of the restrictions of Vue 2, the content will be sent to another block and will not inherit the styles from the element with same kind in the Block.

  4. This component uses portal-vue internally so it will have same caveats. However, in normal use, you should only need to take special care of the ref problem

Props Type Mandatory? Description
open boolean Use to control it open or close
slotsDescription
Default The content

Example:

<template>
  <HeroBlock :block="block">
    <Portal>
      <!-- content will be render at the end of root div element -->
    </Portal>
  </HeroBlock>
</template>
Edit this page on GitHub Updated at Sun, Nov 20, 2022