=== Label Positioning

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
:page-partial:


The xref:refguide:applib:index/annotation/ParameterLayout.adoc#labelPosition[labelPosition()] element determines the positioning of labels for parameters.

The positioning of labels is typically `LEFT`, but can be positioned to the `TOP`.
The one exception is xref:refguide:applib:index/annotation/ParameterLayout.adoc#multiLine[multiLine()] string parameters, where the label defaults to `TOP` automatically (to provide as much real-estate for the multiline text field as possible).

For boolean parameters a positioning of `RIGHT` is also allowed; this is ignored for all other types.

It is also possible to suppress the label altogether, using `NONE`.

For example:

[source,java]
----
public class Order {

    public Order changeStatus(
            OrderStatus newStatus,
            @Nullable
            @ParameterLayout(
                labelPosition=LabelPosition.TOP
            )
            String reason) {
        // ...
    }

    // ...
}
----

==== Default settings

If you want a consistent look-n-feel throughout the app, eg all parameter labels to the top, then it'd be rather frustrating to have to annotate every parameter.

Instead, a default can be specified using the xref:refguide:config:sections/causeway.applib.adoc#causeway.applib.annotation.parameter-layout.label-position[causeway.applib.annotation.parameter-layout.label-position] configuration property:

[source,ini]
.application.properties
----
causeway.applib.annotation.parameter-layout.label-position=TOP
----

or

[source,ini]
.application.properties
----
causeway.applib.annotation.parameter-layout.label-position=LEFT
----

If these are not present then the framework will render according to internal defaults.
At the time of writing, this means labels are to the left for all datatypes except multiline strings.
