# loadSlotContent

Learn how to asynchronously retrieve default slot content.

This function asynchronously retrieves the default content for a [Slot](/explanation/slot) from the [`@croct/content`](/reference/cli/fallback-content) package.

> **Lazy loading**
>
> When using bundlers that support code splitting, prefer this function over its [sync counterpart](get-slot-content), as it enables lazy loading of content modules.

## Signature

This function has the following signature:

```ts
loadSlotContent(slotId: string, language?: string): Promise<JsonObject | null>
```

The return is a `Promise` that resolves to the content as a JSON object, or `null` if no content is available for the given slot and locale.

## Example

Here is a minimal example of how to use this function:

```ts
import {loadSlotContent} from '@croct/content';

const content = await loadSlotContent('home-hero');

if (content !== null) {
console.log(content.title);
}
```

## Parameters

The following list describes the supported parameters:

- `slotId`: `string`

  The slot identifier, for example `home-hero`.

- `language`: `string` (optional)

  The locale code, for example `en`. If omitted, defaults to the project's default locale.

## Explore

- [Content package](https://github.com/croct-tech/content-js): Explore and contribute to the package development on GitHub.
