266
Views
11
Comments
Solved
How to make button group vertical
Question
Application Type
Reactive
Service Studio Version
11.8.13 (Build 32892)

I am trying to make my button group have a vertical layout for it's button items, but I can't change the layout from horizontal. Below is an example of what I'm trying to do. 


2020-11-10 23-58-16
Raphael Ranieri
 
MVP
Solution

Hey Lynn,

I was also able to make it using only CSS, I used a different CSS than Eduardo, but I believe both of them will work.

The CSS I used is:


/*set display flex and column so all itens will break*/

.button-group > div

{

     display: flex;

    -webkit-box-orient: vertical;

    -webkit-box-direction: normal;

    -ms-flex-direction: column;

    flex-direction: column; 

} /*Remove radius from first item*/

.button-group-item:first-child {

    border-radius: unset;

}
/*Remove radius from last item*/

.button-group-item:last-child {

    border-radius: unset;
}

/*Add border left for all itens, you need to override it or it will not have border left, also add remove border top so it don't seems like duplicated*/

.button-group-item:not(:first-child) {

    border-left: var(--border-size-s) solid var(--color-primary);

    border-top: var(--border-size-none);

}


I also made a Sample if you need it.

My result was this:


If you want first and last items to have a top and bottom radius, you can use the class that Eduardo provided.


Hope it helps,

Cheers and Regards,

RR :)

VerticalButtonGroup.oml
UserImage.jpg
Zachary Hardy

hmmm, I tried your and Eduardo and it still looks like this 

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Hi Lynn,

Are you using the group button from OutSystems UI?
Using the sample I uploaded were you able to see if there is anything different?

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Another reason that may be not working is if you are using it inside a web block.

Take a look at the Hierarchy of CSS in OutSystems:


Since this Original Style is coming from OutSystems UI or Your Base theme, if you place it in your web block Style it will not override it.

Try to place it on your screen or on your Theme.

UserImage.jpg
Zachary Hardy

Sorry, I applied the code to the style of the button group and not the screen, not knowing it would make a difference. It works now, just gotta make the text fit!


2020-04-15 19-07-26
Eduardo Rodrigues

Hi Lynn, 

Try this in CSS:

[data-button-group] > div {

display: grid;

}

.button-group-item:first-child {

border-radius: var(--border-radius-soft) var(--border-radius-soft) var(--border-radius-none) var(--border-radius-none);

}

.button-group-item:last-child {

border-radius: var(--border-radius-none) var(--border-radius-none) var(--border-radius-soft) var(--border-radius-soft);

}

Best regards,

Eduardo

UserImage.jpg
Zachary Hardy

Hi Eduardo,

I tried putting your code on my ButtonGroup Style and it didn't change anything. It still looks like this 

2020-11-10 23-58-16
Raphael Ranieri
 
MVP
Solution

Hey Lynn,

I was also able to make it using only CSS, I used a different CSS than Eduardo, but I believe both of them will work.

The CSS I used is:


/*set display flex and column so all itens will break*/

.button-group > div

{

     display: flex;

    -webkit-box-orient: vertical;

    -webkit-box-direction: normal;

    -ms-flex-direction: column;

    flex-direction: column; 

} /*Remove radius from first item*/

.button-group-item:first-child {

    border-radius: unset;

}
/*Remove radius from last item*/

.button-group-item:last-child {

    border-radius: unset;
}

/*Add border left for all itens, you need to override it or it will not have border left, also add remove border top so it don't seems like duplicated*/

.button-group-item:not(:first-child) {

    border-left: var(--border-size-s) solid var(--color-primary);

    border-top: var(--border-size-none);

}


I also made a Sample if you need it.

My result was this:


If you want first and last items to have a top and bottom radius, you can use the class that Eduardo provided.


Hope it helps,

Cheers and Regards,

RR :)

VerticalButtonGroup.oml
UserImage.jpg
Zachary Hardy

hmmm, I tried your and Eduardo and it still looks like this 

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Hi Lynn,

Are you using the group button from OutSystems UI?
Using the sample I uploaded were you able to see if there is anything different?

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Another reason that may be not working is if you are using it inside a web block.

Take a look at the Hierarchy of CSS in OutSystems:


Since this Original Style is coming from OutSystems UI or Your Base theme, if you place it in your web block Style it will not override it.

Try to place it on your screen or on your Theme.

UserImage.jpg
Zachary Hardy

Sorry, I applied the code to the style of the button group and not the screen, not knowing it would make a difference. It works now, just gotta make the text fit!


2020-04-15 19-07-26
Eduardo Rodrigues

I also tested what Raphael did and it worked. What I did suggested looked like this:


Where did you change the CSS, on screen or in a Block?

UserImage.jpg
Zachary Hardy

Sorry, I applied the code to the style of the button group and not the screen, not knowing it would make a difference. It works now, just gotta make the text fit!

2020-04-15 19-07-26
Eduardo Rodrigues

Cool! 

Now just choose one as a solution!

We are here to help!

Regards, 

Eduardo

UserImage.jpg
Zachary Hardy

Thanks! I went with Raphael's and here's how it's looking after playing with the height and width a little bit. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.