Input Fields


This post refers to the new-and-improved beta version of Tabletop Playground, and may describe functionality or UX not present in the legacy version. For information about the beta, click here.


Input Fields are places where users can type. This can make them useful for making things like notecards, RPG character sheets, and more.

Most of the options here should be fairly self-explanatory:

  • Max Length defines the field’s character limit.
  • Transparent Background removes the backer behind the text (useful if you’d rather use a Border instead of the default backer).
  • Multi-Line allows users to input more than one line of text
    • If you select “Multi-Line”, the “Auto-Wrap” option will become available. This will only work if you’ve defined the size of the Input Field via a Layout Box or an image Border. (See Borders and Layout Boxes.)
  • Select All on Focus – Causes all text to be selected when the user clicks the field. Not available for multi-line boxes.
  • Input Type – Offers the option to limit the field to displaying only numbers of various types. Not available for multi-line boxes.

You should almost always define the size of your input field using a Layout Box or Border. If you don’t, the field will grow or shrink as users type in it, which is likely to cause usability issues.

Note: In the API, Input Fields are referred to as “TextBox” and “MultilineTextBox.”

Text Widgets


This post refers to the new-and-improved beta version of Tabletop Playground, and may describe functionality or UX not present in the legacy version. For information about the beta, click here.


Text Widgets simply show text. The options shown will likely be familiar to everyone, but we should offer a couple notes:

  • By default only the Standard Font is offered, but you can import any TTF font file you like to use instead. This font will be included in your package. If you ever want to go back to the standard font, choose, “Nothing” from the “Select Resource” window.
  • Bold and Italic will only work with the Standard Font. If you import your own font(s), you’ll need to import separate font files for any styles you wish to use. 
  • The Alignment controls and Wrap Text Automatically option will only work if you’ve first defined the width of the text widget. You can do this either by adding a Border Image with a fixed size, or adding a layout box with a value in the Override Width field. See Borders and Layout Boxes for details.
    • If you wish to center text within a Canvas or Panel, consider using the alignment controls on the Panel or a Layout Box on the Canvas.

In the example above, the Center alignment on the Text keys off the size defined by Override Width on the text’s Layout Box.

Canvases and Panels


This post refers to the new-and-improved beta version of Tabletop Playground, and may describe functionality or UX not present in the legacy version. For information about the beta, click here.


Canvases and Panels are the two primary “container” widgets. You’ll need one of these if you want to include more than one Widget in a single UI template.

Canvases are simple blank slates, onto which you can freely place and position other widgets. Panels meanwhile automatically align widgets for you horizontally or vertically. In general, Canvases offer more freedom, but Panels are easier to build with.

It’s worth noting that you don’t need to include a Canvas or Panel in your UI – If you just want to create a simple, single-widget UI, you can delete the Canvas you start with when you create a new UI and just add the Widget you want to add. You can also delete the starting canvas and add a Panel if you prefer to start with that.

Canvas

We’ll start with Canvas since it’s the first Widget you’ll see on creating a new UI element.

Canvases don’t have any settings of their own. The settings you see initially will be for the attached Border, which will allow you to see your canvas, but otherwise the canvas would not inherently be visible.

Of course, when you first create a UI, your canvas will look invisible. That’s because a Canvas doesn’t have any specific size – it will size itself based on the widgets within. Right now there’s nothing in it, so there’s nothing much to see. If we change our Border color to Blue we’ll see a tiny dot at the center of the screen but that’s it:

But if we hit “Add to Canvas” and add a button, you’ll now see that Blue border surrounding the button:

Now let’s add an Image. In this case I’ve used the little TTP appearance icon. You’ll see it overlaps with the button at first:

If we were to move the Image up in the hierarchy, the button would appear in front of it (which in this case means we can’t see it anymore): 

If we don’t want them to overlap, we can put in new coordinates in the Position boxes. Below, we’ve changed the image’s Y position to 40. This drops it below the button. As you can see, the Canvas’ blue border expands to match.

If we set X to 100, the box would likewise extend horizontally to compensate:

If you want a Canvas of a fixed size to position things within, you can accomplish that by adding a Layout Box to the Canvas, or a Border Image of a fixed size (see Borders and Layout Boxes).

Panels

Panels are like Canvases in a lot of ways, but they position things for you. Here I’ve deleted the starting Canvas and added a panel instead. As with the Canvas, there’s nothing to see yet:

Let’s go ahead and add a border so we can see what we’re doing, then add a button.

So far, it’s just like the Canvas. But now if we add an image…

We’ll see it appears below the Button instead of on top of it.

To change the specifics of how they’re laid out, we can click back on Panel in the hierarchy and look at its controls in the bottom window:

If we change the Type to “Horizontal” our image will appear next to the Button instead of below it:

If we increase the “Children Distance”, they’ll be farther apart:

If we go back to Vertical, you’ll see Children Distance works there too.

The reason our image is stretched out in vertical is because it’s expanding in size to match the button. To fix this, we can change “Horizontal Alignment” from “Fill” to something else, like “Center”

And if we want to switch which order the Button and Image appear in, we can change their order in the hierarchy.

This will also work with horizontal panels, with the topmost child in the hierarchy appearing leftmost in the panel.

Tip: Panels Within Panels

It’s often useful to put Panels within Panels. In this Counter for example, the buttons are in a Vertical Panel, which is within a higher-level Horizontal Panel:

At this point you may be wondering how to get a Canvas or Panel of a specific, fixed size rather than one that shapes itself to its contents. The answer is that you’ll want to use a Border or Layout Box.

Borders and Layout Boxes


This post refers to the new-and-improved beta version of Tabletop Playground, and may describe functionality or UX not present in the legacy version. For information about the beta, click here.


Borders and Layout boxes are special UI widgets that modify how other widgets appear. They appear in your UI hierarchy attached to other widgets, as described in User Interface Basics.

Under the hood, Borders and Layout Boxes are parents to the widgets they’re attached to. (They are not displayed in the hierarchy as such both to keep the list tidy, and so that they can be added to or removed from specific widgets more easily.) This has a variety of implications for how they behave that we’ll touch on below.

Let’s dive a little deeper into how each of these work:

Borders

A Border has two options: Color and Image. 

If you select a Color, that color field will appear behind the widget, growing or shrinking to match the widget’s contents.

If you add an image, you’ll see size controls appear, set to 0,0. If you leave it set to that, the image will behave the same way as color would, expanding to match the contents of the Canvas. Here’s our example canvas from the Canvas article with an image backer at 0,0.

However, if you put a specific number in either size field, the image will display proportionally based on its native dimensions. (You can also fill in both numbers if you want to stretch or compress it to a specific size)

Specifying the size of an Image Border will dictate the size of the Widget it’s attached to. So in this example, the Canvas will no longer grow or shrink to match its contents, but rather will be a fixed size determined by the Border. (This is because the Canvas is a child of the border, and hence can’t exceed its boundaries.) So if you want a fixed canvas on which to position things, this is one way to go about it.

Layout Boxes

Layout Boxes give you a variety of ways to control the size and behavior of your Widgets.

The Override Height and Override Width controls give you another way of specifying the size of the child widget. (Note that this is not necessary if you’re already using a Border image of a fixed size – so in the example image below, we’ve shifted our canvas back to a simple blue color border.)

Once you’ve fixed your widget’s size (usually with the overrides or with an Image Border) you can use the Alignment controls to position content.

Above we set both Alignments to “Center,” and we see the contents of our Canvas move accordingly. (Note that they retain the same position relative to one another as they had without the layout box – the Layout Box is controlling the position of the canvas, and the Canvas is defining the position of the elements within it.)

The Padding controls define margins that keep content a specified distance from the specified edges.

Note that one downside of defining your canvas or panel size rigidly is that if content exceeds its boundaries, it may be cut off. For Panels, scroll bars will appear when this happens, but for Canvases, the content will simply not be displayed.

User Interface Basics


This post refers to the new-and-improved beta version of Tabletop Playground, and may describe functionality or UX not present in the legacy version. For information about the beta, click here.


This page will walk you through the basics of adding UI to your game packages. From health bars to score trackers to reference notes, UI offers a lot of powerful options for your game.

As with 3D objects, UI objects are built from templates in your Object Library. We’ve included a few examples with pre-built functionality in the Tools package, along with 3D Object Templates that make use of them.

Adding UI to Objects

You can add UI to an object at both the object level and the template level.

To attach it at the object-level, right-click on an object on the table, and choose Customize -> Properties. Then click the UI tab, followed by “Attach UI.” This will bring up a window showing the UI Templates available.

Once you’ve attached the UI, you’ll see some new controls appear.

The Position, Rotation, and Scale controls allow you to change the UI’s position and rotation relative to the object. (You can also change these using the UI Cursor, as described below.) You can remove the UI by hitting the “-” button at the top, duplicate it with the duplicate button, or add additional UI with the “+.” If you have multiple pieces of UI attached to the object, you can use the arrows to cycle between them.

Some UI will also have special options you can configure in this panel. For example, the Flexible Counter in the Tools library offers controls for the increments associated with each button.

If you want the same UI to show up on every object of the same type, you can instead attach it at the Template level. To do this, open the Customize dialogue, choose the bottom tab on the left, and then click on “UI” along the top.

From there, the controls are exactly the same as those found in Properties.

Advanced Options

At the bottom of the UI tab, you’ll see a “Show Advanced Options” button. This reveals the following:

  • Presentation Style: Offers the following options:
    • Regular: The UI is shown in 3D space, as defined by its position, rotation, and scale.
    • View Aligned: The UI is always shown facing the camera. (Rotation is not used.)
    • Screen: The UI is shown in 2D at its position. This looks similar to View Aligned, but it also ignores scale values and transparency settings (Screen UI can always be partially transparent).
  • Visibility: Allows you to limit who can see the UI. This can be useful if you want to give players personalized UI, either to record secret info, or simply so that they can manipulate it without bothering other players.
  • Zoom Visibility: Determines if the UI will be seen when the user zooms in on the object it is attached to. The default “Regular” setting makes the UI only visible on the table (and not on Zoom).

Adding Global UI

If you want to add UI to the screen or the table rather than to an individual object, open Session Options by right-clicking on an empty bit of table and choosing “Session.”

You should see a “Global UI” button in the list on the left:

This will bring up a modal where you can choose 3D or Screen.

3D uses the same UI as attaching the UI to an object, and works the same way; you can think of it a little like the UI is attached to the table.

Screen lets you put the UI on the UI Layer, meaning it will remain in place on the screen as the user navigates the 3D space, similar to elements like the toolbar.

Note that by default the position definitions here are relative to screen size (which is to say the size of the TTP window), with 0,0 meaning the top left corner, and 1,1 meaning the bottom right corner. This means you will usually want to use values between 0 and 1 on each axis. Anchor position meanwhile determines where on the UI this relative position refers to, again using 0,0 as the top-left corner of the UI. Some combinations of numbers may cause the UI to be off-screen – for example, if position is set to 1,1 and anchor is set to 0,0, the UI will not be visible, because it is anchoring the top left corner of the UI to the bottom right corner of the screen. If you change the Anchor position to 1,1, you will see the UI appear hugging the corner, as now its bottom right corner is being aligned to the bottom right of the screen.

The UI Cursor

You can resize and move UI with the UI Cursor. You can access the cursor from the toolbar by mousing over the “Zone” icon and selecting it, or with its keyboard shortcut (Ctrl+U on PC).

The cursor allows you to: 

  • Click and drag a UI to reposition it
  • Resize a UI by clicking and dragging the grey box that you will see appear in the lower-right corner of each UI
  • Rotate a UI by clicking-and-holding and turning the mouse wheel.
  • Right-click on a UI to bring up its context menu.

Note that right now this has a few limitations:

  • It does not work for UI attached to objects at the template level (but will work for UI attached to objects via Properties).
  • It does not work for 3D or Object UI set to the “Screen” presentation style (but will work for Global Screen UI).

Creating UI Templates

To create a UI template, go to the Object Library and select “New Template” in your package, just as you would if you were making a 3D object. Then in the Select Object Type dialogue, scroll to the bottom and choose UI.

This will bring you to the UI Template Creation screen. 

On the left you’ll see a Hierarchy in which you’ll place various Widgets to create your UI. When you create a new UI object, you’ll just see a Canvas. This is a container widget, in which other widgets can be placed. Hit “Add to Canvas” to add a Widget to it, and it’ll pop up a dialog in which you can select the type of widget you’d like to add. Let’s add a Button:

You’ll now see that below the hierarchy is a dialogue giving you all of the options for your chosen Widget. And now that you have a visible Widget, you can see it on the right.

Moving, Deleting, and Copying Widgets

If you mouse over a Widget, you’ll see some controls on the right-hand side:

The up-and down icons move the item up and down in the hierarchy. This has a few uses:

  • If two items overlap, the one lower in the hierarchy will be shown on top of the one higher up in it.
  • Within a Panel, hierarchy determines the order things appear in.

The copy icon can copy a widget and its children. (You can also accomplish this with Ctrl+C). To paste a widget after copying it, click “Add to Canvas,” and choose “Paste from Clipboard” at the bottom of the Widget Type list. This works across templates, allowing you to move pieces of one template into another.

The trash button deletes the chosen Widget and all of its children.

Borders and Layout Boxes

Beside the name of each item in your hierarchy, you’ll see boxes allowing you to add or remove a Border or Layout Box. A Border provides both a background and border color around the UI widget. A Layout Box meanwhile provides controls that let you more precisely define things like the size of the widget. 

If you click on the Border button, it will add the Border, and show you the options for it below. You’ll also see an Eraser button appear to the right of the Layout Box icon, which can be used to remove the Border. 

If you click back on the hash icon on the left, you’ll switch back to the default controls for positioning the widget on the canvas, but you’ll see that the Border button is now white, indicating that a Border is present; clicking on it now will switch you back to editing the Border options. 

The Layout Box button works the same way.

Next Steps

Learn About the Widgets

Click the links below to learn more about each of the Widgets at your disposal. We recommend starting with Canvases and Panels, followed by Borders and Layout Boxes, and from there visiting whatever widgets you think you might want to use.

Add Scripting

When you’re ready to add functionality to your UI, read Adding Scripts to UI.