> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt
> Use this file to discover all available pages before exploring further.

# Earn component

> Open the market selector and let users deposit into DeFi yield protocols from any chain or funding source.

The `Earn` component opens a market selector so users can deposit into yield protocols (Aave, Morpho, Yearn, and others) from any chain or funding source.

<Note>
  Earn currently supports open market selection only. Pre-configured deposits and contract calldata deposits are not yet available. For programmable deposits today, use [composable actions](/cross-chain/sdk/composable-actions/index) with market IDs.
</Note>

## Basic usage

```tsx theme={null}
import { Earn } from "0xtrails";

<Earn apiKey="YOUR_API_KEY" />
```

## Props reference

| Prop            | Type     | Required | Description                 |
| --------------- | -------- | -------- | --------------------------- |
| `apiKey`        | string   | Yes      | Your API key                |
| `onEarnStart`   | function | No       | Called when the user begins |
| `onEarnSuccess` | function | No       | Called on completion        |
| `onEarnError`   | function | No       | Called on failure           |

For appearance and wallet options, see [SDK configuration](/cross-chain/sdk/configuration).
