Buttonhole row pattern for cardigan

Will cast off 2 sts be large enough for a button?

It depends on the weight of yarn that you’re using, the size needles and the size of the button called for in the pattern materials. Best thing is probably to knit a swatch with the given buttonhole and try your buttons in it.
Because knitting is so flexible, 2sts may well be enough to accommodate the button.

Thank you. It was enough to accommodate a small button for this 6 month cardigan