kinghat / tabbed-card

a custom card for home assistant that utilizes tabs to segregate individual cards.
MIT License
87 stars 10 forks source link

Max width on iOS companion app does not match web version.... #64

Closed MajorAutomation closed 1 year ago

MajorAutomation commented 1 year ago

Thanks for your hard work on this project, it is awesome.

I am having an issue on the companion app that is not scaling the tab headers down as per the web interface.

Here is my code:

styles: '--mdc-theme-primary': orange '--mdc-tab-text-label-color-default': white '--mdc-typography-button-font-size': 11px '--mdc-tab-height': 24px '--mdc-tab-horizontal-padding': 0px attributes: isMinWidthIndicator: true minWidth: true isFadingIndicator: true options: {}

This is what the web interface looks like (perfect)

Screenshot 2023-01-08 at 11 49 11 am

But the mobile companion app does not scale the names across the top correctly? Is there a fix for this as all headers should fit nicely, but I am missing the 5th entity tab name and you have to scroll? I have tried taking the font size down to 6px and there is more than ample room to fit the last entity?

image

Thanks

kinghat commented 1 year ago

i dont have an ios device to test the apps webview on but it looks to be functioning properly. you have enough tabs that it is going to shrink them as small as possible to fit as many as possible. you can see this if you comment out 3 of the tabs and watch them fill the tab bar. like this:

image

its because of the smaller screen size. your tabs that are not showing are just out of view and you should be able to scroll over to see them. its not very intuitive, and to fix that i will be adding scroll arrows for when the tabs overflow. does this make sense?

MajorAutomation commented 1 year ago

There are huge gaps between the tabs though (Dining ->Living ->Bedroom), I have set padding to 0px, if it can't be done, I guess I have to scroll. Thanks for the quick response

kinghat commented 1 year ago

There are huge gaps between the tabs though (Dining ->Living ->Bedroom), I have set padding to 0px, if it can't be done, I guess I have to scroll. Thanks for the quick response

oh, um you shouldnt need quotes on your keys. is everything indented properly? this works for me:

styles:
  --mdc-tab-horizontal-padding: 0px

image

MajorAutomation commented 1 year ago

HA seems to be adding these quotes, I remove them and they come back, the colour options appear to be working ok with quotes as does the font size and tab height. They don't seem to get any closer for me.

Here is all my code....

type: custom:tabbed-card styles: '--mdc-theme-primary': orange '--mdc-tab-text-label-color-default': white '--mdc-typography-button-font-size': 9px '--mdc-tab-height': 24px '--mdc-tab-horizontal-padding': 0px attributes: isMinWidthIndicator: true minWidth: true isFadingIndicator: true options: {} tabs:

kinghat commented 1 year ago

where are you entering and copying this config from?

kinghat commented 1 year ago

where are you entering and copying this config from?

regardless, your yaml config needs proper indentation to be accurate. this is correct formatting and works:

type: custom:tabbed-card
attributes:
  minWidth: true
  isMinWidthIndicator: true
styles:
  '--mdc-tab-horizontal-padding': 0px
tabs:
  - card:
      ...
    attributes:
      ...
MajorAutomation commented 1 year ago

This is the layout of the code, looks ok and passed YAML checker...

https://pastebin.com/B5nBmtvK

kinghat commented 1 year ago

This is the layout of the code, looks ok and passed YAML checker...

https://pastebin.com/B5nBmtvK

weird. i dont have a ios device to check that. can you add this config and see if it has the same issue?

type: custom:tabbed-card
attributes:
  minWidth: true
  isMinWidthIndicator: true
styles:
  '--mdc-tab-horizontal-padding': 0px
tabs:
  - card:
      type: entity
      entity: sun.sun
    attributes:
      icon: mdi:pause
      label: Pause
  - card:
      type: entity
      entity: sun.sun
    attributes:
      label: Play
      icon: mdi:play
  - card:
      type: entity
      entity: sun.sun
    attributes:
      icon: mdi:stop
      label: Stop
  - card:
      type: entity
      entity: sun.sun
    attributes:
      icon: mdi:pause
      label: Pause
MajorAutomation commented 1 year ago

This only has 4 tabs, it is when you add the 5th tab this problem appears, I have the same issues when I add one more tab to yours.

`type: custom:tabbed-card attributes: minWidth: true isMinWidthIndicator: true styles: '--mdc-tab-horizontal-padding': 0px tabs:

I think it is just a limitation I have to deal with.

kinghat commented 1 year ago

ill try and find an ios device to test on and report back. thanks for your time troubleshooting.