# API Reference

{% hint style="info" %}
This documentation is a work in progress. UI scripting is a new feature, and additional content is still being added.
{% endhint %}

UI Scripting allows you to use the Nighty scripting engine to write Python scripts that dynamically update Nighty's user interface.

To get started, navigate to the [**Tab** ](/ui-scripting/api-reference/tab.md)section.

***

**Note**: The content below is dynamic, meaning you'll be directed here from other sections of the documentation when specific attributes or parameters are referenced.

## **Shared Attributes & Parameters**

A collection of commonly used properties that apply to multiple UI components, ensuring consistent styling and behavior across your layouts.

### Gap

Sets the spacing between child elements. Accepts a value from `0` to `10`, where `0` removes the gap and `10` applies the maximum spacing.

Examples:\
`gap=0`\
`gap=1`\
`gap=6`\
`gap=10`

***

### Margin

The `margin` option adds extra spacing around or inside a UI element. It accepts [Tailwind CSS margin classes](https://tailwindcss.com/docs/margin) ranging from `0` to `10`. \
\
Examples:

* `margin="m-4"`: Adds a margin of 4 units to all sides.
* `margin="m-0"`: Removes all margins.
* `margin="mr-6"`: Adds a margin of 6 units to the right side.
* `margin="mx-3"`: Adds a margin of 3 units to both the left and right sides.

Note: Not all prefixes are available!

All available prefixes: `m- mt- mr- mb- ml- mx- my-`&#x20;

***

### Visible

Controls the visibility of the UI element. When set to `True`, the element is displayed; when set to `False`, the element is hidden from the UI.

Examples:&#x20;

* `visible=True`
* `visible=False`


---

# Agent Instructions: 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.nighty.one/ui-scripting/api-reference.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.
