Bonsai’s Text class can be used to display Text in the stage:

new Text('Look at me').addTo(stage).attr({
  fontFamily: 'Arial, sans-serif',
  fontSize: '20',
  textFillColor: 'red',
  textStrokeColor: 'yellow',
  textStrokeWidth: 3



Text instances will, by default, be anchored to the top-left. This means that whatever you set x and y to is where the top-left of the text will display.

Mutating content

To change the content of a Text instance, you can use the text attribute:

var myText = new Text('foo');
myText.attr('text'); // => 'foo'

// Change content:
myText.attr('text', 12345);