> For the complete documentation index, see [llms.txt](https://sparkar-community.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sparkar-community.gitbook.io/docs/nativeuimodule.md).

# NativeUIModule

The `NativeUI` module exposes editable text.

## Example

```
//==============================================================================
// The following example demonstrates how to get and set the value of editable
// text through scripting and keyboard input.
//
// Project setup:
// - Insert text
// - Set the text to 'Editable' in the inspector
// - Add the 'Editable text' capability under 'Native UI Control'
// - Add the 'Tap Gesture' capability under 'Touch Gestures'
//==============================================================================

// Load in the required modules
const Diagnostics = require('Diagnostics');
const NativeUI = require('NativeUI');
const TouchGestures = require('TouchGestures');

// Set the initial text value
NativeUI.setText('text0','Default Text');

// Subscribe to tap gestures
TouchGestures.onTap().subscribe(function () {

  // Enter text editing mode
  NativeUI.enterTextEditMode('text0');

});

// Subscribe to changes in the text
NativeUI.getText('text0').monitor().subscribe(function(textUpdate){

  // Log the new text value to the console
  Diagnostics.log('You entered ' + textUpdate.newValue);

});
```

## Properties

| Property | Description                                                               |
| -------- | ------------------------------------------------------------------------- |
| `picker` | `(get) picker: Picker (set) picker: Picker` Represents the picker object. |
| `slider` | `(get) slider: Slider (set) slider: Slider` Represents the slider object. |

## Methods

| Method              | Description                                                                                                         |
| ------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `enterTextEditMode` | `enterTextEditMode(nodeName: String): void` Requests user input for given node.                                     |
| `getText`           | `getText(nodeName: String): StringSignal` Gets the user edited text of the given node.                              |
| `setText`           | `setText(nodeName: String, text: String): void` Sets the text to the provided value for the node with a given name. |

## Classes

| Class                                                                                           | Description                                                                |
| ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [`Picker`](https://sparkar.facebook.com/docs/ar-studio/reference/classes/nativeuimodule.picker) | The `Picker` class describes an object controlling native picker behavior. |
| [`Slider`](https://sparkar.facebook.com/docs/ar-studio/reference/classes/nativeuimodule.slider) | The `Slider` class describes an object controlling native slider behavior. |


---

# 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, and the optional `goal` query parameter:

```
GET https://sparkar-community.gitbook.io/docs/nativeuimodule.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
