1.21 gigawatts
1.21 gigawatts

Reputation: 17850

Label is not aligned correctly in FormItem on mobile

The FormItem is not aligning correctly on mobile. Is there a fix for this?

<s:Form width="100%" backgroundColor="#ff0000">
    <s:FormItem label="First Name" width="100%" >
        <s:TextInput id="firstName" width="100%" borderAlpha="0"  />
    </s:FormItem>

    <s:FormItem label="Last Name" width="100%" >
        <s:TextInput id="lastName" width="100%" borderAlpha="0"  />
    </s:FormItem>
</s:Form>

FormItem in mobile

NOTE: When setting the baseline on an HGroup the same things happens.

    <s:HGroup width="100%" verticalAlign="baseline">
        <s:Label text="First Name" />
        <s:TextInput id="a" width="100%" 
                     height="32"
                     minHeight="0"
                     paddingTop="0" paddingBottom="0" 
                     borderVisible="false"
                     contentBackgroundAlpha="0"
                     contentBackgroundColor="#00ff00"
                     focusAlpha="0"/>
    </s:HGroup>

HGroup aligned to baseline

Upvotes: 0

Views: 252

Answers (1)

Jason Sturges
Jason Sturges

Reputation: 15955

Add layout to your form with vertical alignment set to middle:

<s:Form width="100%"
        backgroundColor="#ff0000">

    <s:layout>
        <s:VerticalLayout verticalAlign="middle" />
    </s:layout>

    <s:FormItem label="First Name"
                width="100%">
        <s:TextInput id="firstName"
                     width="100%"
                     borderAlpha="0" />
    </s:FormItem>

    <s:FormItem label="Last Name"
                width="100%">
        <s:TextInput id="lastName"
                     width="100%"
                     borderAlpha="0" />
    </s:FormItem>

</s:Form>

Upvotes: 1

Related Questions