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.
Adding free text in draw.io – not connected to a shape
Adding free text is even easier, simply double click on the drawing area and start typing. You can then change the size, position, format and color of the text by dragging it or using the different tabs in the format panel. This text is not attached to any shape.