OH3: Popup Window Size

Currently running openHAB 3.4.0.M5.

Was wondering if anyone has found a way to configure the popup window size?

Calling Popup as follows:

component: oh-cell
config:
  header: Test Popup Size
  action: popup
  actionModal: widget:popup_test_size

with widget:

uid: popup_test_size
tags: []
props:
  parameterGroups: []
timestamp: Nov 30, 2022, 11:07:57 AM
component: f7-page
config:
  style:
    --f7-bars-translucent-blur: none
    --f7-bars-translucent-opacity: none
    --f7-card-margin-horizontal: 0px
    --f7-navbar-bg-color: transparent
    --f7-navbar-border-color: transparent
    --f7-navbar-font-size: 15px
    --f7-navbar-height: 35px
    --f7-navbar-link-color: white
    --f7-navbar-shadow-image: none
    --f7-navbar-text-color: white
    --f7-popup-tablet-width: 40px
    background-color: rgb(220,220,220)
    border-radius: 30px
    height: 200px
    left: 0px
    text-overflow: ellipsis
    top: 0px
    width: 200px

This pops up the following:

Is there any way with the newer updates to get the popup size to match the widget size?

Not really if you are using the OH actions to open the popup. As you have seen, defining the f7 variables in the widget doesn’t work. That’s because the way f7 creates the popups at a much higher level than the widgets so the css from the widgets cannot “cascade” down to the popup. It’s possible that if you tried to define things like --f7-popup-tablet-width in the page config, then that might work, but it’ll apply to all the popups that happen on the page, which you probably don’t want.

To have full control over the appearance of the popup you have to build the popup manually using the f7-popup. There’s a quick example of how to do this in the updated docs:

A style object added to the f7-popup config will have full effect on that popup and in the default slot, you can just continue to build a widget as you would at any other point including adding your own already defined widgets using the

- component: widget:widget_name_here

syntax.

As usual, thanks Justin.

That helps a lot. I am however trying to call the popup directly from my Overview Page using an oh-cell (bypassing OH actions as per your example). This however makes it a two step opening and closing process:

Popup Test

Using the code as follows:

component: oh-cell
config:
  title: Popup Card
slots:
  default:
    - component: oh-link
      config:
        text: Open the popup
        popupOpen: .demo-pop
    - component: f7-popup
      config:
        class: demo-pop
        style:
          background-color: rgb(220,220,220)
          border-radius: 30px
          height: 500px
          text-overflow: ellipsis
          width: 500px
      slots:
        default:
          - component: widget:caddx_graphic_portrait_V6
            config:
              text: Close it again
              popupClose: .demo-pop

I can’t seem to get the f7-popup to call directly from the oh-cell.

Do you have any suggestions? The sizing etc of the popup however works great!

Alas, there’s no way to make this work directly. The oh-cell family of components does not have the popupOpen etc. set of properties. In order to make something like this work smoothly for my own setup I just completely rebuilt an oh-cell style component from the base f7 parts which is a bit of a hassle.

You can do a pretty good job of simulating what you want by adding a button to the background of the cell and using the button’s popupOpen property instead.

    - component: oh-cell
      config:
        ...
      slots:
        background:
          - component: oh-button
            config:
              style:
                height: 120px
                width: 100%
              popupOpen: .example-pop
    - component: f7-popup
      config:
        class: example-pop
      slots:
        default:
          ...
1 Like

Works just fine. Now just to sort out one little niggle that I can’t trace.

Seems like one of my cars if being populated and I can’t see where or how? Doesn’t happen when I don’t use this method, but will continue debugging and post a new thread if I don’t come right.

Thanks Justin