You can add text to any shape from the symbol library in draw.io once it has been dropped onto the drawing area. Simply click on the the shape and start typing.
The shape and its text are always connected to each other and do not have to be moved individually.
You can change the position of the text relative to the shape at any time.
Select the shape and in the Text tab of the format panel, select the desired position from the drop down list.
The edited shape can also be stored in the Scratchpad, making it easy to duplicate.