<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PP7S83N" height="0" width="0" style="display:none;visibility:hidden">
Guide

Setting up file previews

Weavy has built-in file preview handling. This guide shows how to set up a preview modal in Retool and how to trigger it when needed.

1. Prepare your Retool app

Make sure you have a Retool app ready.

To be able to easily follow the steps here you can make a simple app.

  • Go to your Apps (Home) in Retool.
  • Click Create and choose App.

2. Configuring Weavy

For this tutorial, we need the Retool app to be configured with a getWeavyToken query and the Weavy components library to be installed.

Make sure you have followed tutorial on What to do first in Retool.

3. Add a modal component

We'll add a modal component that is always available on top of other content when needed. The modal is where we will place the preview component later.

  • Add a Modal Frame component to the global scope of your app and name it modalPreview.
  • Remove the Header and Footer Add-ons from the Content section in the Component inspector.
  • Set the Size to Full screen under Appearance in the Component inspector.
  • Check the Expand content to fit under Appearance in the Component inspector.
  • Add a Style for Background and set the color to a custom color with opacity 0% (fully transparent). You can set the opacity by dragging the bottom slider in the Custom color picker all the way to the left.
  • You can safely remove the modalTitle1 and modalCloseButton1 components from the modal.
retool-modal-preview

4. Add the preview component

We'll add a Weavy Preview component to the modal. The configure the preview to handle the closing of the modal.

  • Add a Weavy Preview component to the body of the modal.
  • Add an Event handler for the Close preview event.Open the Component inspector for the weavyPreview1 component.
    • Set it to Control component.
    • Select the modalPreview component.
    • Set the Method to Hide.
retool-preview-close-handler

5. Add a files component

To preview files we need some source files from a Weavy component. Let's add a Weavy Files component that can handle uploaded files and cloud files, such as files from Google Drive.

The Weavy Messenger, Weavy Chat, Weavy Comments, Weavy Files and Weavy Posts all have the capability of using file previews.

  • Drag the Weavy Files component onto your page canvas.
  • Add an event handler for the Open Preview event on weavyFiles1.
    • Set the event action to Control component.
    • Set the Component to modalPreview and set the Method to Show.
retool-preview-open-handler

6. Done!

We now have full browser overlay previews available for all our Weavy components.

  • Works for any added file in the Weavy Files component and any other Weavy component you have configured.
  • Just click the file to open the preview!

Try the preview in full action for any file, complete with versions and comments!

retool-preview-bacon-comments
Support

To access live chat with our developer success team you need a Weavy account.

Sign in or create a Weavy account