# Float properties don't accept percentages via JavaScript.

**URL:** <https://forums.fusetools.com/t/float-properties-dont-accept-percentages-via-javascript/3811>\
**Category:** Bug Reports\
**Created:** [February 25, 2016, 8:43pm UTC](https://forums.fusetools.com/t/float-properties-dont-accept-percentages-via-javascript/3811 "2016-02-25T20:43:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcelo\_Alves](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/marcelo_alves/32/86_2.png) [@Marcelo\_Alves](https://forums.fusetools.com/u/Marcelo_Alves)\
**Post date:** [February 25, 2016, 8:43pm UTC](https://forums.fusetools.com/t/float-properties-dont-accept-percentages-via-javascript/3811/1 "2016-02-25T20:43:27Z")

</div>

```auto
<App Theme="Basic">
    <JavaScript>
        var Observable = require("FuseJS/Observable");
    module.exports = {
        half: Observable(&quot;50%&quot;)
    }
&lt;/JavaScript&gt;

&lt;Rectangle Width=&quot;{half}&quot; Fill=&quot;#F00&quot; Height=&quot;10&quot;/&gt;

```

The preview stops with with `unknown char`, however using `<Rectangle Width="50%" />` works as expected.

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [February 25, 2016, 9:56pm UTC](https://forums.fusetools.com/t/float-properties-dont-accept-percentages-via-javascript/3811/2 "2016-02-25T21:56:50Z")

</div>

Hi!

This is unfortunately a limitation of how Fuse works (as of 0.9.11)

You can get around it like this:

```auto
<App Theme="Basic">
    <JavaScript>
        var Observable = require("FuseJS/Observable");

        module.exports = {
            half: Observable(50)
        }
    </JavaScript>

    <Rectangle ux:Name="rect1" Width="0%" Fill="#F00" Height="10"/>
    <DataBinding Target="rect1.Width" Key="half" />
</App>

```

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [February 26, 2016, 7:20pm UTC](https://forums.fusetools.com/t/float-properties-dont-accept-percentages-via-javascript/3811/3 "2016-02-26T19:20:49Z")

</div>

Hi,

I just implemented support for this. It will likely roll out in Fuse 0.11 🙂

```auto
<App>
    <JavaScript>
        exports.width1 = "50";
        exports.width2 = "50px";
        exports.width3 = "50%";
    </JavaScript>
    <StackPanel>
        <Panel Color="Red" Width="{width1}" Height="100" />
        <Panel Color="Green" Width="{width2}" Height="100" />
        <Panel Color="Blue" Width="{width3}" Height="100" />
    </StackPanel>
</App>

```

(Also works with Observables)
