> For the complete documentation index, see [llms.txt](https://docs.servoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.servoy.com/reference/servoycore/dev-api/solutionmodel/alignment.md).

# ALIGNMENT

## Constants Summarized

| Type                                                     | Name                | Summary                                                                     |
| -------------------------------------------------------- | ------------------- | --------------------------------------------------------------------------- |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [BOTTOM](#bottom)   | Constant used for setting vertical alignment for components.                |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [CENTER](#center)   | Constant used for setting horizontal and vertical alignment for components. |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [DEFAULT](#default) | Constant used for setting horizontal and vertical alignment.                |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [LEFT](#left)       | Constant used for setting horizontal alignment for components.              |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [RIGHT](#right)     | Constant used for setting horizontal alignment for components.              |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [TOP](#top)         | Constant used for setting vertical alignment for components.                |

## Constants Detailed

### BOTTOM

Constant used for setting vertical alignment for components.\
It makes the text inside the component be bottom aligned vertically.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var bottomAlignedLabel = form.newLabel('BOTTOM', 520, 10, 50, 300);
bottomAlignedLabel.verticalAlignment = SM_ALIGNMENT.BOTTOM;
```

### CENTER

Constant used for setting horizontal and vertical alignment\
for components. If used for horizontal alignment,\
then the text of the component will be horizontally centered.\
Similarly, if used for vertical alignment, then the text\
of the component will be vertically centered.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var hCenteredLabel = form.newLabel('CENTER', 10, 40, 300, 20);
hCenteredLabel.horizontalAlignment = SM_ALIGNMENT.CENTER;
var vCenterAlignedLabel = form.newLabel('CENTER', 460, 10, 50, 300);
vCenterAlignedLabel.verticalAlignment = SM_ALIGNMENT.CENTER
```

### DEFAULT

Constant used for setting horizontal and vertical alignment. DEFAULT value makes the alignment behave as if it was not changed before.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var hLabel = myJSForm.getLabel('label_name');
if (hLabel.horizontalAlignment == SM_ALIGNMENT.LEFT) hLabel.horizontalAlignment = SM_ALIGNMENT.DEFAULT;
```

### LEFT

Constant used for setting horizontal alignment for components.\
It makes the text inside the component be left aligned horizontally.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var leftAlignedLabel = form.newLabel('LEFT', 10, 10, 300, 20);
leftAlignedLabel.horizontalAlignment = SM_ALIGNMENT.LEFT;
```

### RIGHT

Constant used for setting horizontal alignment for components.\
It makes the text inside the component be right aligned vertically.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var rightAlignedLabel = form.newLabel('RIGHT', 10, 70, 300, 20);
rightAlignedLabel.horizontalAlignment = SM_ALIGNMENT.RIGHT;
```

### TOP

Constant used for setting vertical alignment for components.\
It makes the text inside the component be top aligned vertically.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var topAlignedLabel = form.newLabel('TOP', 400, 10, 50, 300);
topAlignedLabel.verticalAlignment = SM_ALIGNMENT.TOP;
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoycore/dev-api/solutionmodel/alignment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
