Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Round css in IONIC 4

I have a button with shape round as follows:

<ion-button expand="full" class="shadow-red" shape="round">Signup with</ion-button>

The class shadow-red is:

.shadow-red{
    box-shadow: 0px 14px 25px rgba(182, 30, 30, 0.59);
    border-radius: 5px;
}

And the result is:

enter image description here

So I tried many different ways to change the round shape but since it isn't a css class doing the following didn't work.

.round{
  border-radius:5px!important;
}

I tried adding border-radius:5px!important; to ion-button class, button, .btn, and many other combinations but none of them worked.

I have also tried to add to variables.css the following lines and none of them worked:

--ion-button-round-border-radius: 5px;
--ion-button-border-radius: 5px;
--ion-border-radius: 5px;
--border-radius: 5px;
....
like image 441
Programmer Man Avatar asked Dec 08 '18 13:12

Programmer Man


Video Answer


1 Answers

Don't use the shape attribute, now you can change the look of the button to your wishes. One thing to change is the expand attribute. If you set it to full, you remove the left and right borders (see in docs). And so you can't set or change the border-radius. Set it to block and you will still have a full-width button.

<ion-button expand="block" class="shadow-red">Signup with</ion-button>

Use the following CSS custom properties as described in the Ionic 4 docs.

.shadow-red{
    --border-radius: 5px;
    --box-shadow: 0px 14px 25px rgba(182, 30, 30, 0.59);
}

Result:

enter image description here

like image 139
Tomas Vancoillie Avatar answered Sep 18 '22 00:09

Tomas Vancoillie