StringDisplay¶
Under Construction
This documentation is auto-generated, and is a work in progress. Please see the source code at https://github.com/phetsims/scenery-phet/blob/main/js/StringDisplay.ts for the most up-to-date information.
Overview¶
StringDisplay displays the value of a string or TReadOnlyProperty<string> on a background. The background can be a fixed size, or it can dynamically size itself to fit the displayed string.
StringDisplay is a nice alternative to NumberDisplay, when the thing you're displaying is not a number, or when formatting is more-cleanly implemented using a TReadOnlyProperty<string>.
@author Chris Malley (PixelZoom, Inc.)
Class StringDisplay¶
Constructor¶
new StringDisplay( string : TReadOnlyProperty<string> | string, providedOptions? : StringDisplayOptions )¶
Instance Methods¶
dispose()¶
Type StringDisplayOptions¶
- size?: Dimension2 
 Fixed size of the background. If provided, the text will be scaled to fit the background. If not provided, the background will be dynamically sized to fix the text.
- xMargin?: number 
 Margins inside the background
- yMargin?: number
- alignX?: AlignX 
 How the string is aligned in the background
- alignY?: AlignY
- rectangleOptions?: RectangleOptions 
 Options passed to the background Rectangle
- useRichText?: boolean 
 true = use RichText, false = use Text
- textOptions?: StrictOmit<TextOptions | RichTextOptions, "maxWidth" | "maxHeight"> 
 Options passed to the RichText that displays the string
- & NodeOptions
Source Code¶
See the source for StringDisplay.ts in the scenery-phet repository.