When creating preview images for my products, I often use at least one image to demonstrate how a potential customer’s design would look before and after using my product.
For these before and after shots, I use tags to show which image is which.
When I first started making these images, I’d create the tags by drawing a rounded rectangle and simply placing the text over the top.
The problem with this was that whenever I wanted to edit the text, change the font, or alter the point size, I’d then have to manually resize and realign the rectangle to suit the changes I’d made.
Then I discovered how to make these tags so that whenever I made changes to the text, the shape behind it would automatically adapt.
This has come in handy not only for creating easily editable tags, but also things like buttons.
Making these kinds of elements this way removes the pain of having to make tedious tweaks, and in recent years, it’s saved me a ton of time.
Creating your own tags
Start by selecting the Type Tool (T) and typing out the text you’ll be using for your tag.
Select your text, then go to Appearance panel (Window > Appearance) and double click the Characters item.
This will reveal the Appearance attributes of each of the individual characters in your text. By default, each of the characters will have the same Fill and Stroke attributes. To make editing the colors of your tag a bit easier later on down the line, you’ll want all of the Appearance attributes to be applied to the type as a whole rather than individual characters, so set both the Fill and Stroke colors here to None.
To do this, click the swatch icon next to each item and select the None swatch.
Then go back to the main view by clicking the Type: No Appearance item.
Here is where you can apply attributes to your type as a whole.
Start by adding two Fills.
To do this, find the Add New Fill icon at the bottom of the Appearance panel and click twice.
Change the color of the top Fill item to whatever color you would like the text on your tag to be. I’m going to go with white.
Then select the bottom Fill item, click the Add New Effect icon at the bottom of the Appearance panel and go to Convert to Shape > Rounded Rectangle.
In the Shape Options dialog box, set the Size to Relative then the Extra Width, Extra Height, and Corner Radius to whatever you feel is right for your tag.
You can edit these settings at any time by clicking the Rounded Rectangle attribute in the Appearance panel.
To change the color of the rectangle, simply change the color of the Fill item. Hold Shift and click the swatch icon to bring up the alternate color UI and choose whichever color you’d like.
Now you have a basic dynamic tag.
To see just how well it works, select the Type Tool (T) and edit your text.
As you can see, the shape automatically adapts to whatever you type.
From here, you can completely customize the look of your tag and create more advanced styles by adding additional Fills and Strokes, and using Effects to change their appearance.