Perspective - auto adjust label width

I’m on 8.0.16

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

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

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

Bind Label.position.width with an expression binding:

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

Adjust the 5 value to suit your needs.

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

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).

Or wrap it in a flex container
Actually that wouldn’t work…

Basis will adjust width if it’s a row flex