Skip to main content
New Participant
December 7, 2021
Answered

How to resize button width based on dataset text length?

  • December 7, 2021
  • 6 replies
  • 1322 views

Is there a way to change the width of a CTA button to grow/contract with the amount of copy inside it when the copy is pulled from a data-set?

 

This topic has been closed for replies.
Correct answer JJMack

For Data driven graphics you would need to replace the text and the button or have text and button as an image the correct size. For Pixel replacement image there is some alignment options. It would nice if you could center justify text in a text paragraph layer that was button size so the text would be centered in a fixed size button.

 

It look lile you be able to at least center all your text in your button by keeping all  text strings all the same length with spaces.

 

 

 

 

 

6 replies

Bojan Živković11378569
Brainiac
December 8, 2021

There isn't built in function for such thing. The only built in way I can imagine is using layer style applied to Type layer but... I can not imagine/figure out how to create such layer style.

JJMack
JJMackCorrect answer
Adobe Expert
December 7, 2021

For Data driven graphics you would need to replace the text and the button or have text and button as an image the correct size. For Pixel replacement image there is some alignment options. It would nice if you could center justify text in a text paragraph layer that was button size so the text would be centered in a fixed size button.

 

It look lile you be able to at least center all your text in your button by keeping all  text strings all the same length with spaces.

 

 

 

 

 

JJMack
New Participant
December 7, 2021

Apologies I just assumed a "Call to Action" button was a common expression. But it's just a simple button with text inside it. I am trying to find a solve for having the button resize it's width to accommodate the amount of copy inside it. I am importing data sets from an CSV file. Here's an example of a Rectangle shape, a dynamic text field (populated from the data merge), and a static Vector arrow shape.

 

Would anymore know of a script automate changing the Rectangle width based on the text length inside it so all iterations of the button would keep the same spacing as in the 1st image above?

Thanks!

Brainiac
December 7, 2021

This still doesn't help. Are you writing an application and creating buttons?

New Participant
December 7, 2021

I am creating layouts with different sized buttons using Photoshop's "Data Driven Graphics" to export files with auto sized buttons. I am trying to get the button shape to resize dynamically.

It looks like this is possible in Illustrator by applying a "Fill Effect" in the Appearance window. I'm looking for a similar method in Photoshop.

Thanks!

 

Brainiac
December 7, 2021

We need a whole lot more information here about what you are doing. What is a CTA button and how are you getting text into it?

Kukurykus
Brainiac
December 7, 2021

Call-to-Action?

c.pfaffenbichler
Adobe Expert
December 7, 2021

Please elaborate and post screenshots.