The nanotubes stay put and function even when the fabric is stretched
Ordinary cotton and polyester fabrics have been turned into batteries that retain their flexibility.
The demonstration is a boost to the nascent field of "wearable electronics" in which devices are integrated into clothing and textiles.
The approach is based on dipping fabrics in an "ink" of tiny tubes of carbon, and was first demonstrated last year on plain copier paper.
The new application to fabrics is reported in the journal Nano Letters.
"Wearable electronics represent a developing new class of materials... which allow for many applications and designs previously impossible with traditional electronics technologies," the authors wrote.
A number of research efforts in recent years have shown the possibility of electronics that can be built on flexible and even transparent surfaces - leading to the often-touted "roll-up display".
However, the integration of electronics into textiles has presented different challenges, in particular developing approaches that work with ordinary fabrics.
Now, Yi Cui and his team at Stanford University in the US has shown that their "ink" made of carbon nanotubes - cylinders of carbon just billionths of a metre across - can serve as a dye that can simply and cheaply turn a t-shirt into an "e-shirt".
The idea is the same as that outlined in their work with plain paper; the interwoven fibres of fabrics, like those of paper, are particularly suited to absorbing the nanotube ink, maintaining an electrical connection across the whole area of a garment.
Cloth is simply dipped into a batch of nanotube dye, and is then pressed, to thin and even out the coating.
The fabric maintains its properties even as it is stretched or folded. Even rinsing the samples in water and wringing them out does not change their electronic properties.
"Our approach is easy and low-cost while producing great performance," Professor Cui told BBC News.
"Fabrics and paper represent two technologies with a thousand-year-old history. We combined 'high-tech' - nanotechnology - with traditional 'low-tech' to produce new applications."
The next step is to integrate the approach with materials that store more energy, in order to create more useful batteries. By combining the approach with other electronic materials in the ink, the team believes even wearable solar cells are possible.