Widget UI vertical calendar with multiple columns not aligned

Dear all,

I am trying to create sort of a family calendar (4 People in 4 columns with events in a week in vertical, please see attached screenshot) in a widget. I used the IMHO beautiful design of @RGroll and tried to adapt it by showing multiple f7-cols. But I somewhat miss something, as if there is a new day the columns result not to be aligned. I am trying with the YAML code but am a newbie so any help would be greatly appreciated.
Thank you very much!
Here is a screenshot:

And here is the code:

uid: Timeline
tags: []
props:
  parameters:
    - description: A text prop
      label: Prop 1
      name: prop1
      required: false
      type: TEXT
    - context: item
      description: An item to control
      label: Item
      name: item
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Apr 5, 2023, 5:54:26 PM
component: f7-page
config: {}
slots:
  default:
    - component: f7-row
      slots:
        default:
        - component: f7-col
          slots:
            default:
              - component: f7-col
                config:
                  class:
                    - timeline-item
                    - no-margin
                slots:
                  default:

                    - component: f7-col
                      config:
                        class:
                          - timeline-item-date
                        style:
                          width: 20px
                      slots:
                        default:
                          - component: Label
                            config:
                              text: =dayjs().format('DD')
                              style:
                                font-size: 21px
                                line-height: 21px
                                font-weight: 800
                          - component: Label
                            config:
                              text: =dayjs().format('MMM')
                    - component: f7-col
                      config:
                        class:
                          - timeline-item-divider
                    - component: f7-col
                      config:
                        class:
                          - timeline-item-content
                      slots:
                        default:
                          - component: f7-col
                            config:
                              class:
                                - timeline-item-content
                                - timeline-item-inner
                            slots:
                              default:
                                - component: Label
                                  config:
                                    class:
                                      - timeline-item-time
                                    text: "6:00-7:00"
                                - component: Label
                                  config:
                                    class:
                                      - timeline-item-title
                                    text: ="Person1 event 1"
                                - component: Label
                                  config:
                                    class:
                                      - timeline-item-time
                                    text: = "7:00-8:00"
                                - component: Label
                                  config:
                                    visible: 
                                    class:
                                       - timeline-item-title
                                    text: "Person1 event 2"
                                - component: Label
                                  config:
                                    class:
                                       - timeline-item-time
                                    text: ="8:00-9:00"
                                - component: Label
                                  config:
                                    class:
                                       - timeline-item-title
                                    text: "Person1 event 3"
                    - component: f7-col
                      config:
                        class:
                          timeline-item-divider
                    - component: f7-col
                      config:
                        class: 
                          - timeline-item-content
                          - timeline-item-inner
                      slots:
                        default:
                          - component: Label
                            config:
                              class:
                                - timeline-item-time
                              text: "6:00-17:00"
                          - component: Label
                            config:
                              class:
                                - timeline-item-title
                              text: ="Person2 "
                          - component: Label
                            config:
                              class:
                                - timeline-item-time
                              text: "7:00-8:00"
                          - component: Label
                            config:
                              class:
                                - timeline-item-title
                              text: ="Person2"
                    - component: f7-col
                      config:
                        class:
                          timeline-item-divider
                    - component: f7-col
                      config:
                        visible: true
                        class:
                          - timeline-item-content
                          - timeline-item-inner
                      slots:
                        default:
                          - component: Label
                            config:
                              class:
                                - timeline-item-time
                              text: ="6:00-7:00"
                          - component: Label
                            config:
                              class:
                                - timeline-item-title
                              text: ="Person3"
                          - component: Label
                            config:
                              class:
                                - timeline-item-time
                              text: ="7:00-8:00"
                          - component: Label
                            config:
                              class:
                                - timeline-item-title
                              text: ="Person3"
                    - component: f7-col
                      config:
                        class:
                          timeline-item-divider
                    - component: f7-col
                      config:
                        visible: True
                        class:
                          - timeline-item-content
                          - timeline-item-inner
                      slots:
                        default:
                          - component: Label
                            config:
                              class:
                                - timeline-item-time
                              text: ="12:00-13:00"
                          - component: Label
                            config:
                              visible: = 1
                              class:
                                - timeline-item-title
                              text: ="Person4"
              - component: f7-block
                config:
                  class:
                    - timeline-item
                    - no-margin
                slots:
                  default:
                    - component: f7-col
                      config:
                        class:
                          - timeline-item-date
                        style:
                          width: 20px
                      slots:
                        default:
                          - component: Label
                            config:
                              text: =dayjs().add(1,'days').format('DD')
                              style:
                                font-size: 21px
                                line-height: 21px
                                font-weight: 800
                          - component: Label
                            config:
                              text: =dayjs().add(1,'days').format('MMM')
                    - component: f7-col
                      config:
                        class: 
                          - timeline-item-divider
                    - component: f7-col
                      config:
                        class:
                          - timeline-item-content
                          - timeline-item-inner
                      slots:
                        default:
                          - component: f7-col
                            config:
                              class:
                                - timeline-item-content
                            slots:
                              default:
                              - component: Label
                                config:
                                  class:
                                    - timeline-item-time
                                  text: "7:00-8:00"
                              - component: Label
                                config:
                                  class:
                                    - timeline-item-title
                                  text: "Person1 different event length"
                    - component: f7-col
                      config:
                        class:
                          - timeline-item-divider
                    - component: f7-col
                      config:
                        class:
                          - timeline-item-content
                          - timeline-item-inner
                      slots:
                        default:
                          - component: Label
                            config:
                              class:
                                - timeline-item-time
                              text: "7:00-8:00"
                          - component: Label
                            config:
                              class:
                                - timeline-item-title
                              text: "Person2 day 2"
                    - component: f7-col
                      config:
                        class: 
                          - timeline-item-divider
                    - component: f7-col
                      config:
                        class: 
                          - timeline-item-content
                          - timeline-item-inner
                      slots:
                        default:
                          - component: Label
                            config:
                              class:
                                - timeline-item-time
                              text: "7:00-12:00"
                          - component: Label
                            config:
                              class:
                                - timeline-item-title
                              text: "Person 3"
                    - component: f7-col
                      config:
                        class:
                          - timeline-item-divider
                    - component: f7-col
                      config:
                        class:
                          - timeline-item-content
                          - timeline-item-inner
                      slots:
                        default:
                          - component: Label
                            config:
                              class:
                                - timeline-item-time
                              text: "7:00 - 12:00"
                          - component: Label
                            config:
                              class:
                                - timeline-item-title
                              text: "Person 4"
                          
                          
                       
                              

              - component: f7-block
                config:
                  class:
                    - timeline-item
                    - no-padding
                    - no-margin
                slots:
                  default:
                    - component: f7-col
                      config:
                        class:
                          - timeline-item-date
                        style:
                          width: 20px
                      slots:
                        default:
                          - component: Label
                            config:
                              text: =dayjs().add(2,'days').format('DD')
                              style:
                                font-size: 21px
                                line-height: 21px
                                font-weight: 800
                          - component: Label
                            config:
                              text: =dayjs().add(2,'days').format('MMM')
                    - component: f7-col
                      config:
                        class:
                          - timeline-item-divider
                    - component: f7-col
                      slots:
                        default:
                          - component: Label
                            config:
                              class:
                                - timeline-item-content
                              text: Keine Termine


Thanks in advance for any help.

Matthias

None of your f7-cols with the timeline-item-content class have any width directive. Consequently, each one will take whatever width is required to display its contents. What you want is to ensure that every one of those content containers always has the same width. Since you know they all have a class in common, the easiest way to do that is to add a stylesheet directive to the base `f7-page’:

component: f7-page
config:
  stylesheet: >
    .timeline-item-content {
      flex: 1 1 10%;
    }

This will apply that flex setting to ever content container. The flex setting tells the page to start each container at a 10% width (which is much smaller than it should ever have to be, but that’s the point) and then to allow each container to grow (or shrink, but that’s not really relevant) at a 1:1 ratio with the other containers until the whole available space is filled.

You can read up more about using fle box for spacing and alignment here:

Incredible. Thank you very much, now it is awesome!
Thanks again.

@Matthew1988 : That widget is exactly what I was looking for! I was trying to build something like that myself, but no success. Do you plan by any chance to publish this widget thru the marketplace?

Hi Christian,

Thanks for the encouragement. At the moment it is still work in progress, but I made some good leap forward lately. When I’ll be able to produce a deployable and usable version I will be happy to post it!

Greetings,

Matthias

Hi Matthias,
great news! Looking forward to see the result!

Regards,
Christian

Dear Christian, @cra

I just posted the code in github and in the marketplace https://community.openhab.org/t/vertical-family-calendar/146275 It is beta and it will need still some time to be perfect, but for now it already should work.
Hope you enjoy it, and I welcome every hint or help.

Greetings,
Matthias

Hi Matthias,
thanks for your efforts! I will give it a try next week since I’m pretty busy this week. Will let you know of my progress.

Regards,
Christian

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.