# Perspective - auto adjust label width

**URL:** <https://forum.inductiveautomation.com/t/perspective-auto-adjust-label-width/40729>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [November 17, 2020, 1:28pm UTC](https://forum.inductiveautomation.com/t/perspective-auto-adjust-label-width/40729 "2020-11-17T13:28:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [November 17, 2020, 1:28pm UTC](https://forum.inductiveautomation.com/t/perspective-auto-adjust-label-width/40729/1 "2020-11-17T13:28:39Z")

</div>

I’m on 8.0.16

Is there a way that a label can auto adjust is width with the text lenght ?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 17, 2020, 2:21pm UTC](https://forum.inductiveautomation.com/t/perspective-auto-adjust-label-width/40729/2 "2020-11-17T14:21:49Z")

</div>

If it’s in a flex container you can set its `position.basis` property to `auto`

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [November 17, 2020, 2:34pm UTC](https://forum.inductiveautomation.com/t/perspective-auto-adjust-label-width/40729/3 "2020-11-17T14:34:04Z")

</div>

Not in flex container and I want to auto adjust width, not height

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 17, 2020, 4:27pm UTC](https://forum.inductiveautomation.com/t/perspective-auto-adjust-label-width/40729/4 "2020-11-17T16:27:14Z")

</div>

Bind `Label.position.width` with an expression binding:

```auto
toStr(len({this.props.text}) * 5, "50") + "px"

```

Adjust the `5` value to suit your needs.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [November 17, 2020, 4:33pm UTC](https://forum.inductiveautomation.com/t/perspective-auto-adjust-label-width/40729/5 "2020-11-17T16:33:02Z")

</div>

> [@cmallonee](#):
>
> len({this.props.text}) \* 5

I use percent and not fixed view, so I want to get a fitted label, there's no built-in function to do that ?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 17, 2020, 4:35pm UTC](https://forum.inductiveautomation.com/t/perspective-auto-adjust-label-width/40729/6 "2020-11-17T16:35:22Z")

</div>

You could wrap the Label in a coordinate container which uses the “fixed” layout mode. This would result in the coordinate container growing with the Viewport, but the internal Label would remain the same size no matter what (unless you applied the binding I suggested).

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 17, 2020, 6:05pm UTC](https://forum.inductiveautomation.com/t/perspective-auto-adjust-label-width/40729/7 "2020-11-17T18:05:00Z")

</div>

~~Or wrap it in a flex container~~  
Actually that wouldn't work..

> [@luc.martin](#):
>
> I want to auto adjust width, not height

Basis will adjust width if it's a row flex
