# Data

The optional data configuration allows you to either modify a pre-selected value for a particular data field before rendering, or implement your own logic to select a desired value.

It accepts an object with optional data selectors for a library item's asset, date, description and title. Each field accepts a callback function, that accepts a show's source object as first and an optional preSelected value as second argument.

### Type definition

```
type DataConfig = {
  asset?: (source: ComposedShow, preSelected?: Asset) => Asset | undefined;
  date?: ((source: ComposedShow, preSelected?: Date) => string) | string | undefined;
  description?: (source: ComposedShow, preSelected?: string) => string | undefined;
  title?: (source: ComposedShow, preSelected?: string) => string | undefined;
}
```

### Asset

If provided, the asset data selector's preSelected value is an object of type Asset. Its return value is either an Asset object (see Type definitions ) or undefined.

```
window.LiSA.library.configs.push({
  data: {
    asset: (source, preSelected): => {
      /* Your code goes here... */
    }
  },
});
```

### Date

If provided, the date data selector's preSelected value is an object of type Date. Its return value is either a string (formatted date) or undefined.

```
// callback function
window.LiSA.library.configs.push({
  data: {
    date: (source, preSelected) => {
      /* Your code goes here... */
    },
  },
});
```

### Date format

In addition to a callback, date also accepts a string value, which represents a date format string. Format of the string is based on Unicode Technical Standard #35.

```
// date format
window.LiSA.library.configs.push({
  data: {
    date: 'MMMM d, hh:mm', // June 23, 12:15
  },
});
```

If no date data selector or format string is provided, LiSA Library uses 'MMMM d, h:mm aa' as a default date format, which translates to: June 23, 12:15 PM.

### Description

If provided, the description data selector's preSelected value is a string. Its return value is either a string or undefined.

```
// callback function
window.LiSA.library.configs.push({
  data: {
    description: (source, preSelected) => {
      /* Your code goes here... */
    },
  },
});
```

### Title

If provided, the title data selector's preSelected value is a string. Its return value is either a string or undefined.

```
window.LiSA.library.configs.push({
  data: {
    description: (source, preSelected) => {
      /* Your code goes here... */
    },
  },
});
```


---

# 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.hello-lisa.com/developers/widgets/configuration-options/data.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.
