Home > Software design >  Is possible to change size of button from component
Is possible to change size of button from component

Time:02-05

I have component where in .html file is only "<" button "></" button ">"

I would like to use it in other component but I have to resize it without change of basic button. Is possible to change width and height of that button?

CodePudding user response:

The easiest way would be to just use a custom css class on the page where you are using and need the larger button.

If you want to do it the angular way (I don't really recommend) then you could have the component take a height and width prop and then bind that to the height/width of the button via the style binding

For example:

<button [style.height]="height" [st><button/>

CodePudding user response:

I dont know how come someone has button like "<" button "></" button ">" as the button inside angular bracket is in double quotes, the button should be but if I get the crux of your question you want to change the height width as per component. There are multiple ways to solve the issue.

  1. If its separate component what you are telling then pass height and width as input param to it and set some default value so that the original one remain same.

  2. Add class to the button and make those classes true or false as per your need, you can do that using below syntax

    <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...enter code here this is as per angular documentation.

  • Related