How can I consume my whole bitcoin balance in a single transction? Is it possible to use multiples UTXOs in a single transaction? I want to make use of a single bitcoin address for payment. I'm using bitcoinjs library's transction builder for creating my own transaction. Can anyone help with a proper code to use multiple UTXO's in a single transaction? Is there any function which can automatically select the no. of UTXO's to be consumed depending on the output transaction value to be sent?
Thank you.
Of course, you can add as many UTXO's as will fit in a block. In fact, you usually have to because you don't always have a UTXO for the exact amount you are trying to spend. Note that more UTXO will result in a higher transaction fee because the fee is based on the current market fee rate (satoshi/kB) and more UTXO increases the kB.

For example, check out this transaction, it uses 7 UTXO as inputs.

See Bitcoin Wiki - Transactions