> For the complete documentation index, see [llms.txt](https://docs.appmixer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appmixer.com/appmixer-ui-sdk/ui-and-widgets/files.md).

# Files

<figure><img src="/files/w6YFtuJPasVd4bhfo6Y0" alt=""><figcaption></figcaption></figure>

## Configuration <a href="#configuration" id="configuration"></a>

Set up a new instance with `config` parameters and `set`/`get` methods:

```javascript
const files = appmixer.ui.Files(config)

files.set(key, value)
files.get(key)
```

#### **`config.el`** **`...`**

{% hint style="info" %}
Learn about `widget` `config` [here](/appmixer-ui-sdk/ui-and-widgets.md#configuration).
{% endhint %}

## Instance <a href="#state" id="state"></a>

{% hint style="info" %}
Learn about `widget` instance [here](/appmixer-ui-sdk/ui-and-widgets.md#instance).
{% endhint %}

### State

```javascript
files.state(name, value)
```

#### **`loader`**

Type: `Boolean` | Default: `null`

Toggle a custom loading state.

#### **`error`**

Type: `String` | Default: `null`

Toggle a custom error message.\
\
\&#xNAN;**`query`**

Type: `Object` | Default: `DefaultQuery`

Defines custom query parameters for retrieving files.\
\
**Example:**

```javascript
// Set a custom query.
files.state('query', {
    pattern: 'my custom pattern',
    sort: { uploadDate: -1 }
});

// Listen for query changes triggered by user interaction.
files.on('change:query', query => {
    console.log('Current query:', query);
});
```

### Events <a href="#events" id="events"></a>

```javascript
files.on(event, handler)
```

#### **`flow:open`**

```javascript
files.on('flow:open', flowId => {/* ... */})
```

Triggered when the user selects a flow associated with a file listed in the widget.

## Example

```javascript
const files = appmixer.ui.Files({
    el: '#files'
})

files.open()
```


---

# 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.appmixer.com/appmixer-ui-sdk/ui-and-widgets/files.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.
