Help reducing Widget Pop-up height (CSS height: auto not respecting content)

Hello everyone,
I am working on a custom Light Control widget (Cell_Light_Card_Swiper_Bold) and I’m struggling to reduce the total height of the pop-up. Even when I try to adjust the components, the pop-up container seems to stay at a fixed height rather than hugging the content.
How can I force the pop-up to use an “auto” height based on the elements inside?
Here is the YAML I am currently using, including my attempts to tighten the margins and set the height:

uid: Cell_Light_Card_Swiper_Bold
tags:
  - "2026"
props:
  parameters:
    - description: Name der Lampe
      label: Header
      name: header
      required: false
      type: TEXT
    - description: Großes Haupt-Icon rechts
      label: Big Bulb Icon
      name: big_icon
      required: false
      type: TEXT
    - context: item
      label: Schalter Item (Gruppe)
      name: item_schalter
      required: false
      type: TEXT
    - context: item
      label: Helligkeit Item
      name: item_brightness
      required: false
      type: TEXT
    - context: item
      label: Farbtemperatur Item
      name: item_colortemp
      required: false
      type: TEXT
    - context: item
      label: Farbwahl Item (RGB)
      name: item_color
      required: false
      type: TEXT
timestamp: Feb 6, 2026, 3:00:00 PM
component: oh-context
config:
  constants:
    widgetID: =Number.parseInt(Math.random()*8912).toString(16).padStart(4, '0')
slots:
  default:
    - component: oh-swiper-card
      config:
        paginationDynamic: true
        params:
          nested: true
          noSwiping: true
          noSwipingSelector: .range-slider, .range-knob, .oh-slider
          touchStartPreventDefault: false
        showNavigation: false
        showPagination: true
        style:
          background-color: white
          border-radius: var(--f7-card-expandable-border-radius)
          box-shadow: 0 0.25rem 0.9375rem rgba(0,0,0,0.12)
          height: 9.375rem
          margin: 0.3125rem
      slots:
        default:
          # --- SEITE 1: HAUPTSTEUERUNG ---
          - component: f7-block
            config:
              style:
                display: flex
                flex-direction: row
                justify-content: space-between
                margin: 0
                padding: 0
            slots:
              default:
                - component: f7-block
                  config:
                    style:
                      display: flex
                      flex: 1
                      flex-direction: column
                      gap: 0.8em
                      margin: 0
                      padding: 0
                  slots:
                    default:
                      - component: f7-block
                        config:
                          style:
                            align-items: center
                            display: flex
                            justify-content: space-between
                            margin-top: 0.5em
                            padding: 1em
                        slots:
                          default:
                            - component: Label
                              config:
                                style:
                                  font-size: 1.3em
                                  font-weight: 700
                                  max-width: 75%
                                  overflow: hidden
                                  text-overflow: ellipsis
                                  white-space: nowrap
                                text: "=props.header ? props.header : 'Licht'"
                            - component: oh-toggle
                              config:
                                item: =props.item_schalter
                                style:
                                  transform: scale(0.8)
                      - component: oh-slider
                        config:
                          item: =props.item_brightness
                          style:
                            --f7-range-bar-size: 0.4em
                            --f7-range-knob-size: 1.2em
                            width: 90%
                - component: f7-block
                  config:
                    style:
                      align-items: flex-end
                      display: flex
                      flex-direction: column
                      width: 25%
                      padding: 0.5em
                  slots:
                    default:
                      - component: oh-button
                        config:
                          color: gray
                          iconF7: ellipsis_vertical
                          iconSize: 1.2em
                          popupOpen: =`.popup-${const.widgetID}`
                          style:
                            border: none
                      - component: f7-icon
                        config:
                          f7: "=props.big_icon ? props.big_icon : 'lightbulb_fill'"
                          size: 3.5em
                          style:
                            color: "=(items[props.item_schalter].state === 'ON') ? '#FFD700' : '#E0E0E0'"
                            filter: "=(items[props.item_schalter].state === 'ON') ? 'drop-shadow(0px 0px 0.4em #FFD700)' : 'none'"

          # --- SEITE 2: SCHNELL-PRESETS ---
          - component: f7-block
            config:
              style:
                display: flex
                flex-direction: column
                padding: 1.5em
            slots:
              default:
                - component: Label
                  config:
                    text: Schnellwahl Helligkeit
                    style:
                      font-weight: 600
                      margin-bottom: 0.5em
                - component: f7-row
                  slots:
                    default:
                      - component: oh-button
                        config:
                          text: 30%
                          action: command
                          actionItem: =props.item_brightness
                          actionCommand: 30
                          outline: true
                      - component: oh-button
                        config:
                          text: 70%
                          action: command
                          actionItem: =props.item_brightness
                          actionCommand: 70
                          outline: true
                      - component: oh-button
                        config:
                          text: MAX
                          action: command
                          actionItem: =props.item_brightness
                          actionCommand: 100
                          fill: true

    # --- POPUP SETTINGS ---
    - component: f7-popup
      config:
        backdrop: true
        class: =`popup-${const.widgetID}`
        closeByBackdropClick: true
        swipeToClose: true
        style:
          --f7-popup-width: 320px
          --f7-popup-tablet-width: 320px
      slots:
        default:
          - component: f7-page
            config:
              style:
                background: "#f2f2f7"
            slots:
              default:
                - component: f7-block
                  config:
                    style:
                      display: flex
                      flex-direction: column
                      gap: 12px
                      padding: 16px
                  slots:
                    default:
                      - component: Label
                        config:
                          text: EINSTELLUNGEN
                          style:
                            font-size: 0.75rem
                            font-weight: 800
                            opacity: 0.5
                            letter-spacing: 0.1em

                      # Brightness Card
                      - component: f7-block
                        config:
                          style:
                            background: white
                            border-radius: 1rem
                            padding: 1rem
                            margin: 0
                        slots:
                          default:
                            - component: Label
                              config:
                                text: Helligkeit
                                style:
                                  font-weight: 700
                                  margin-bottom: 8px
                            - component: oh-slider
                              config:
                                item: =props.item_brightness

                      # Warmth & Color Card
                      - component: f7-row
                        slots:
                          default:
                            - component: f7-col
                              slots:
                                default:
                                  - component: f7-block
                                    config:
                                      style:
                                        background: white
                                        border-radius: 1rem
                                        padding: 1rem
                                        height: 100%
                                    slots:
                                      default:
                                        - component: Label
                                          config:
                                            text: Warmweiß
                                            style:
                                              font-weight: 700
                                        - component: oh-slider
                                          config:
                                            item: =props.item_colortemp
                            - component: f7-col
                              slots:
                                default:
                                  - component: f7-block
                                    config:
                                      style:
                                        background: white
                                        border-radius: 1rem
                                        padding: 1rem
                                        display: flex
                                        flex-direction: column
                                        align-items: center
                                    slots:
                                      default:
                                        - component: oh-colorpicker
                                          config:
                                            item: =props.item_color
                                            modules:
                                              - wheel
                                            openIn: popover
                                        - component: Label
                                          config:
                                            text: Farbe
                                            style:
                                              font-weight: 700
                                              margin-top: 4px

                      # Accordion für Einzellampen
                      - component: f7-list
                        config:
                          accordionList: true
                          noHairlines: true
                          style:
                            margin: 0
                        slots:
                          default:
                            - component: f7-list-item
                              config:
                                accordionItem: true
                                title: Einzelne Lampen
                                style:
                                  background: white
                                  border-radius: 1rem
                                  font-weight: 600
                              slots:
                                accordion:
                                  - component: f7-accordion-content
                                    slots:
                                      default:
                                        - component: f7-list
                                          slots:
                                            default:
                                              - component: oh-toggle-item
                                                config:
                                                  title: Lampe Links
                                                  item: Lampe_Links_Toggle
                                              - component: oh-toggle-item
                                                config:
                                                  title: Lampe Rechts
                                                  item: Lampe_Rechts_Toggle

                      - component: f7-button
                        config:
                          text: SCHLIESSEN
                          popupClose: true
                          fill: true
                          style:
                            border-radius: 0.75rem
                            height: 3rem
                            margin-top: 1rem

Does anyone have a tip on which CSS variable specifically controls the container height for oh-popover or oh-dialog to prevent that extra white space at the bottom?
Thanks in advance!

There is a --f7-popup-tablet-height just like the width. The full list is here:

You can set that for a fixed height that matches your content, but setting it to height: auto will interfere with the function of the popup (it’s animation and position are calculated by the F7 library from a fixed height value).

If you find that it is important to adjust the height of a popup because you don’t have enough content to fill it then maybe you would find one of the other overlays a better fit for your needs. In this case, you might find a sheet to be preferable.

when I want to test this code

uid: sheet_with_three_dots
component: f7-card
config:
  title: Mein Gerät
  style:
    height: 120px
    position: relative # Wichtig für die Positionierung des Buttons
slot:
  default:
    # DIE DREI PUNKTE (OBEN RECHTS)
    - component: oh-button
      config:
        iconF7: ellipsis_vertical # Die drei Punkte
        iconSize: 24
        color: gray
        # Positionierung
        style:
          position: absolute
          top: 10px
          right: 10px
          z-index: 999
        # Aktion zum Öffnen
        action: variable
        actionVariable: sheetOpen
        actionVariableValue: true

    # DAS SHEET
    - component: f7-sheet
      config:
        opened: =vars.sheetOpen
        swipeToClose: true
        backdrop: true
        style:
          --f7-sheet-height: 200px
          border-radius: 20px 20px 0 0
      on:
        sheetClosed:
          - action: variable
            actionVariable: sheetOpen
            actionVariableValue: false
      slot:
        default:
          - component: f7-page-content
            slot:
              default:
                - component: f7-block-title
                  config:
                    innerText: Optionen
                - component: f7-list
                  slot:
                    default:
                      - component: oh-toggle-item
                        config:
                          title: Gerät einschalten
                          item: EINSTELLEN_ITEM_NAME
                      - component: oh-button
                        config:
                          text: Schließen
                          action: variable
                          actionVariable: sheetOpen
                          actionVariableValue: false
                          style:
                            margin-top: 20px

and then i press save the code gets deleted and i see

uid: sheet_with_three_dots
tags: []
props:
  parameters: []
  parameterGroups: []
timestamp: Feb 7, 2026, 12:14:33 PM
component: f7-card
config:
  title: Mein Gerät
  style:
    height: 120px
    position: relative

what is wrong?

slot is not a recognized property of a widget. It must always be slots.

Thanks…

Here is my code…

uid: sheet_with_three_dots
component: f7-card
config:
  title: Mein Gerät
  style:
    height: 120px
    position: relative # Wichtig für die Positionierung des Buttons
slots:
  default:
    # DIE DREI PUNKTE (OBEN RECHTS)
    - component: oh-button
      config:
        iconF7: ellipsis_vertical # Die drei Punkte
        iconSize: 24
        color: gray
        # Positionierung
        style:
          position: absolute
          top: 10px
          right: 10px
          z-index: 999
        # Aktion zum Öffnen
        action: variable
        actionVariable: sheetOpen
        actionVariableValue: true

    # DAS SHEET (Jetzt in der Mitte)
    - component: f7-sheet
      config:
        opened: =(vars.sheetOpen || false)
        swipeToClose: true
        backdrop: true
        style: |
          --f7-sheet-height: auto;
          --f7-sheet-width: auto;
          --f7-sheet-max-width: 90vw;
          --f7-sheet-border-radius: 20px;
          position: fixed;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          min-width: 250px;
          max-width: 400px;
      on:
        sheetClosed:
          - action: variable
            actionVariable: sheetOpen
            actionVariableValue: false
      slots:
        default:
          - component: f7-page-content
            config:
              style:
                padding: 20px
            slots:
              default:
                - component: f7-block-title
                  config:
                    innerText: Optionen
                    style:
                      text-align: center
                - component: f7-list
                  config:
                    style:
                      margin: 20px 0
                  slots:
                    default:
                      - component: oh-toggle-item
                        config:
                          title: Gerät einschalten
                          item: EINSTELLEN_ITEM_NAME
                - component: oh-button
                  config:
                    text: Schließen
                    fill: true
                    color: blue
                    action: variable
                    actionVariable: sheetOpen
                    actionVariableValue: false
                    style:
                      display: block
                      margin: 20px auto 0 auto
                      width: 120px

but i can’t close it…mhhm…

I don’t know where this came from, but it is not valid widget yaml. There is no on object, and the action configurations just go right in the regular config object. If this came from an AI, I would be cautious about trusting widget code from that AI in the future.

This is the correct way to configure the action but there is one thing that is likely related to your problem:

This is not setting the variable to the boolean value false, this is setting it to the string value "false". The problem here is that any valid string non-empty string is a true value when included in a boolean comparison. So,

opened: =(vars.sheetOpen || false)

will always be true once the variable is set because ("true" || false) and ("false" || false) are both true.

Because of this (and a few other issues with false values in widget expressions), I always avoid trying to use boolean values for variables like this and use obvious strings instead. So, here I would have:

actionVariableValue: OPEN

and

actionVariableValue: CLOSED

Then the test would be:

opened: =!!vars.sheetOpen && vars.sheetOpen == "OPEN"

With that expression, the sheet is only open when sheetOpen is not null and is set to "OPEN".

I changed it to this

uid: sheet_with_three_dots
component: f7-card
config:
  title: Mein Gerät
  style:
    height: 120px
    position: relative # Wichtig für die Positionierung des Buttons
slots:
  default:
    # DIE DREI PUNKTE (OBEN RECHTS)
    - component: oh-button
      config:
        iconF7: ellipsis_vertical # Die drei Punkte
        iconSize: 24
        color: gray
        # Positionierung
        style:
          position: absolute
          top: 10px
          right: 10px
          z-index: 999
        # Aktion zum Öffnen
        action: variable
        actionVariable: sheetOpen
        actionVariableValue: "OPEN"

    # DAS SHEET (Jetzt in der Mitte)
    - component: f7-sheet
      config:
        opened: =!!vars.sheetOpen && vars.sheetOpen == "OPEN"
        swipeToClose: true
        backdrop: true
        style: |
          position: fixed;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          width: auto;
          height: auto;
          min-width: 250px;
          max-width: 90vw;
          border-radius: 20px;
          padding: 0;
      slots:
        default:
          - component: f7-page-content
            config:
              style:
                height: auto;
                min-height: auto;
                padding: 20px;
                display: flex;
                flex-direction: column;
            slots:
              default:
                - component: f7-block-title
                  config:
                    innerText: Optionen
                    style:
                      text-align: center
                      margin-top: 0
                - component: f7-list
                  config:
                    style:
                      margin: 15px 0;
                      flex-grow: 1;
                  slots:
                    default:
                      - component: oh-toggle-item
                        config:
                          title: Gerät einschalten
                          item: EINSTELLEN_ITEM_NAME
                - component: oh-button
                  config:
                    text: Schließen
                    fill: true
                    color: blue
                    action: variable
                    actionVariable: sheetOpen
                    actionVariableValue: "CLOSED"
                    style:
                      display: block;
                      margin: 10px auto 0 auto;
                      width: 120px;

But still can only close it via swipe not with the button

A sheet is a fundamentally different kind of overlay than a popup and you cannot force it to look like a popup. All of those styles you have added to make sheet appear in the middle of the screen are interfering with the sheet’s basic function. A sheet will always just cover the minimum amount of the lower portion of the screen it needs to display the components you have placed on it. It serves the same purpose as a popup but with a different visual base. Your code will work exactly as expected if you remove the entire style definition from the sheet configuration.

is there sth. what is like a popup but in the middle of the screen?

Your options are:

  • Popup: This needs to be a fixed height and width to work properly but will appear in the middle of the screen. If you know the exact height that you need instead of trying to set it to auto, this can still work, but it will take a lot of trial and error.
  • Popover: This is smaller and shrinks to fit content (does not need to be a fixed size). It does not appear in the middle of the screen. By default it is located near its parent component or some other element you designate.
  • Sheet: This is always the width of the screen and height will adjust to your content. It will appear at the bottom of the screen by default but can be set to the top of the screen as well.

Right now it sounds like you are trying to force the F7 components to do something beyond their design prarameters. That’s not impossible, but it is often a lot of effort and, in my experience, it is usually not worth that effort if you can be a little flexible with your design requirements.