A simple navigation button not included in the standard widgets

I may be looking at the wrong place. But it seems to me, there is no such a thing (widget) as a simple navigation button used for jumping (action) to another page?

In the standard Label widget, there is an action to define which page to navigate to on the click of the button. But there are also items to define in this label widget.

I assume it should be rather easy to create a widget without anything else as than action (and perhaps to possibility to add an icon). But I have no idea how to create such a widget.

Anyone?

I use those Label card widgets for simple page navigation. You donā€™t need to set the Item, but rather provide label as ā€œbuttonā€ text and define action for navigation.

e.g. like this for navigation to network overview page:

component: oh-label-card
config:
  action: navigate
  actionPage: page:pageAdminNetworkOverview
  label: Network

Any of the widget components that include the oh action system can use the navigation action.

The oh-button is, of course, one that gives you the most ā€œbutton-likeā€ options

But, some other very common examples would be the oh-link, or even just the oh-icon.

1 Like

Thats what i use as well. It just seem a bit overwhelming just for navigating to a page.
I also feel the label widget is quite big in size.

Looking at the documents, there is a component called oh-button, which is suppose to do the job. So I kind wondered how come there is no such a widget as a button.

Exactly. But it doesnt seem like there is a widget for that.

I guess I donā€™t quite understand what distinction you are making here. You can put an oh-button anywhere you can put a oh-label-card. You might feel it looks out of place if you do so without any additional styling, but it will work. Once you add enough styling to a button to make it look like the other default widgets you just get a label card or an oh-cell or, if you are on 4.3 a generic oh-card.

Thatā€™s because having a ā€œbutton widget in a cardā€ widget makes little sense. oh-button is there to include in widgets (including cards).

Another code-less option is to add a List with a List Item, then in the list itemā€™s configuration youā€™ll find a setting to make it a List Button (List Button Vue Component | Framework7 Vue Documentation).

My issue is, how come there isnt such a widget for buttons only.
(I may be doing this all wrong, but I just cant seem to figure out, how to get a simple button used for navigation to another page witth the standard widgets).

As mentioned, I use the Label Widget. But this is not perfect, at it shows a ā€˜-ā€™ where it looks like it wait for a value of an item, which in my case makes no sense, when the widget is suppose to be an navigation to a page.

Button01
I inserted the icon (solarpanel). But the sign just right of the solarpanel looks like its waiting for an value/itemā€¦ I cant seem to get rid of this when using a Label Widget.

As a navigation button, I believe it makes a whole lot of senseā€¦

Look at the example in my previous post.
Using a Label widget doesnt seem right, if one just want to have a navigation button only.

Because in the context of the oh actions, your question doesnā€™t even make sense.

At a fundamental level, the oh-button component exists to add to some other widget an area that the user can click on to trigger one of the oh specific actions. A card or cell can already be configured as an entire area where the user can click to trigger one of the oh specific actions so there is no sense in adding a smaller area to that entire area where the user can clickā€¦

Yes, the general cards and cells have also been expanded to include specific other components with specialized functions (e.g., sliders) or better user experience (e.g., toggles), but since the clicking on a button does not offer either a specialized function or a different UX there is exactly nothing to be gained with an oh-button-cell.

To use a physical example if thereā€™s a smart switch that toggles the lights in a room, you are asking to stick a smart button on that switchplate thatā€¦toggles the light in the room.

I donā€™t know exactly what code you are using for this but

- component: oh-label-card
  config:
    title: Test side
    icon: solarplant

produces a card without any -
image

and adding a navigation action doesnā€™t change the appearance:

- component: oh-label-card
  config:
    title: Test side
    icon: solarplant
    action: navigate
    actionPage: page:page_8f3d590c17

Remove the ā€œTest sideā€ from the Title property and put it into Label property below the Item.

Then it looks like regular button:

image

Like navigating to another page, right?

My question is not really about the size of the area (though I would prefere it would be smaller, but thats just my personal feeling).

I used a Label card/widget on a canvas layout page.
This is all standard in OH page editor (MainUI).

All I did in configuring the specific Widget (Name, Label card) was:

  1. Set the action to navigate to a page.
  2. Set the page is should navigate to.
  3. Added a standard OH icon (the solarpanel).
    Thats it. Nothing else is configured.

So I did nothing to get the ā€˜-ā€™ sign right next to the icon. And I see no reason why its there to navigate to a page. Thats why I asked how come there isnt a simpl button to use.

The yaml looks like this:

component: oh-canvas-item
config:
  h: 120
  w: 120
  x: 440
  y: 440
  noCanvasShadow: true
slots:
  default:
    - component: oh-label-card
      config:
        action: navigate
        actionPage: page:page_3deb4853ef
        icon: oh:solarplant
        outline: true
        title: SolcelleanlƦg
        vertical: false

Even though I have less experiences with widgets and yaml codes, I must assume it only shows what has been configured, right? Cause there are plenty of other configurations inside the widgets. I just didnt touch any of those configration options.

Ahh,.Thanks. That helped.
I guess I got confused of the Title and the Label, as I assumed the label from an items perspective.

Are you on an older version of OH? Itā€™s possible that the - is still there from before the recent UI card refactoring. The example I showed you up above was also configured using the UI, but Iā€™m on a 4.3 version with the new and improved cards.

Sure, you can do this too. Again, anything with access to the actions system can do these navigation links. In this case you can take advantage of the fact that a basic oh-list-item also has oh actions. So, youā€™ll just want to use an oh-list-card and add a List item to the cardā€™s list. When you configure that item you can give it any text you want, assign a navigation action and select the option that styles it like a button. Because itā€™s a list you can even do this as many times as you want for different pages. This card below was also configured entirely with the UI:
image
Clicking on the ā€œNavigation linksā€ header produces no results, but clicking either of the buttons below that navigates to different pages.

Im on 4.2

I was just trying to make a small navigation button to open a new page.

I have tried the List card, but it doesnt seem to work. I cant configure anything in it. When I click configure, nothing hapens.

That probably explains the - in the card. That was before all the cards were rebuilt, I believe. If you upgrade to 4.3, your label card will not show the - when configure it the way I did.

I donā€™t know how much the list card configuration has changed since 4.2, however, I have never seen a situation where you canā€™t configure a card at all through the UI. List cards have existed from the beginning and I donā€™t recall any other reports of problems. So, without more detail I donā€™t know whatā€™s going on.

But, if you are trying to configure multiple actions then you want to add list items to the card (the black + button) and configure the action for each list item not the card itself.

IĀ“ll wait a while before updating to 4.3. Then we will see if it helps.