For my HSA, any amount over $1000 cash balance can be invested. I have it on auto-invest. If you have medical expenses you need to pay which are less than $1000 then it will come out of the cash balance. Then, you have to wait for your contributions to bring the cash balance back above $1000 at which point the excess will be invested.
If you have medical expenses in excess of $1000 then you sell enough of your investments to raise the cash balance to the level you need to pay the medical expense. Since it is an HSA there are no taxes/deductions on the gains/losses and no taxes on the withdrawal as long as it is used to pay for qualified medical expenses.
My HSA has a list of mutual funds that I can invest in. They have recently added more funds, some of which are Vanguard, so I have a reasonable mix of funds to choose from. There are stock/bond/money market type funds so you can adjust your AA as needed.
HSA's have triple tax advantage - tax free in and out along with growth. You should try to max out your HSA contributions if possible. My HSA allows contributions in addition to payroll deduction; yours may also. That allows you to wait till later in the year to make a lump sump contribution if you need to. HSA contribution limits for 2015 are $3,350 for an individual and $6,650 for a family (HSA holders 55 and older get to save an extra $1,000 which means $4,350 for an individual and $7,650 for a family).
EDIT: I am also doing what NumberCruncher suggests; pay using funds outside of HSA whenever possible and just keep medical expense receipts. Then, if you want to withdraw from HSA you can use the receipts to withdraw money. The bill can already have been paid, the payment doesn't have to come directly from HSA. Also, you don't have to make the HSA withdrawal in the year the expense was incurred, it can be several years old as long as you were in the HSA at the time the expense was incurred. This way, you can keep as much money as possible in the HSA and use it as a retirement account. The receipts just enable you to withdraw money penalty free before you turn 65.