# Leaderboard

Configure leaderboard functionality.

| Parameter | Type | Default | Description | Effect |
|-----------|------|---------|-------------|--------|
| showLeaderboard | boolean | - | Show leaderboard UI | Enables/disables leaderboard visibility |
| username | string | - | Display name for leaderboard | Sets the user's name shown on leaderboards |
| autoSubmitLeaderboard | boolean | false | Silent leaderboard submission (Challenge only) | When true, Challenge results are submitted to the leaderboard without showing the submission modal. The display name is read from the previously stored `leaderboard_username` (or falls back to the user ID) |

**Note:** Username is automatically saved to localStorage for future sessions.

**`autoSubmitLeaderboard` use case:** Use this only for Challenge integrations where you want every completion silently posted to the leaderboard (e.g., when your host app already manages display names and doesn't want a second prompt). Leave it unset (or `false`) to keep the standard modal-based flow.

**Leaderboard Configuration**

_Swift (iOS)_
```swift
// Via customParams
kinestex.createView(
    customParams: [
        "showLeaderboard": true,
        "username": "FitnessPro123",
        "autoSubmitLeaderboard": true // Challenge-only: skip submit modal
    ]
)
```

_Kotlin (Android)_
```kotlin
// Via customParams
KinesteXSDK.createView(
    customParams = mapOf(
        "showLeaderboard" to true,
        "username" to "FitnessPro123",
        "autoSubmitLeaderboard" to true // Challenge-only: skip submit modal
    )
)
```

_React Native_
```jsx
// Via customParameters
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    showLeaderboard: true,
    username: 'FitnessPro123',
    autoSubmitLeaderboard: true, // Challenge-only: skip submit modal
  },
};
```

_Flutter_
```dart
// Via customParams
KinesteXAIFramework.createView(
  customParams: {
    "showLeaderboard": true,
    "username": "FitnessPro123",
    "autoSubmitLeaderboard": true, // Challenge-only: skip submit modal
  },
);
```

_HTML / JavaScript_
```html
// Direct in postData object
const postData = {
  userId: "user-123",
  company: "YOUR_COMPANY",
  key: "YOUR_API_KEY",
  showLeaderboard: true,
  username: "FitnessPro123",
  autoSubmitLeaderboard: true, // Challenge-only: skip submit modal
};
```

_React (TypeScript)_
```tsx
// Via customParameters
const postData: IPostData = {
  key: 'YOUR_API_KEY',
  userId: 'user-123',
  company: 'YOUR_COMPANY',
  customParameters: {
    showLeaderboard: true,
    username: 'FitnessPro123',
    autoSubmitLeaderboard: true, // Challenge-only: skip submit modal
  },
};
```

---
Source: https://kinestex.com/docs/customization-parameters/leaderboard · Index: https://kinestex.com/llms.txt
