Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to resize button width based on dataset text length?

Community Beginner ,
Dec 07, 2021 Dec 07, 2021

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?

 

TOPICS
Actions and scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 07, 2021 Dec 07, 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.

image.pngexpand image

 

 

 

 

 

Translate
Adobe
Community Expert ,
Dec 07, 2021 Dec 07, 2021

Please elaborate and post screenshots. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 07, 2021 Dec 07, 2021

Call-to-Action?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 07, 2021 Dec 07, 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 07, 2021 Dec 07, 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.

Screen Shot 2021-12-07 at 9.10.43 AM.pngexpand imageScreen Shot 2021-12-07 at 9.10.55 AM.pngexpand image

 

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 07, 2021 Dec 07, 2021

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 07, 2021 Dec 07, 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!

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 07, 2021 Dec 07, 2021

There really isn't a way to specify bounds based on a text box.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2021 Dec 08, 2021
LATEST

I find the »explanations« unclear so far. 

I cannot tell whether the text is Point Text or Paragraph Text and what the »button«/color field actually is (Shape Layer, pixel Layer, …) as of yet. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2021 Dec 07, 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.

image.pngexpand image

 

 

 

 

 

JJMack
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2021 Dec 07, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines