# Class challenge card

> Canonical HTML: https://screenrig.ai/docs/cards/class-challenge/

Class against class: lanes with a runner for each class racing to a goal on reading minutes, attendance or a fundraiser, with the leader marked, the total together and the time left.

Category: Schools. Tags: Schools and campuses, Leaderboards and standings, Recognition.

## Previews

![Class challenge](/cards/class-challenge/v1/screenshots/canvas-bloom.webp?sha=36e51386a31145612c672c6eaac8551823d311332a939c342bbacdddfa8f8adf)

Canvas

![Class challenge](/cards/class-challenge/v1/screenshots/corner-bloom.webp?sha=e7df416bc2844804e1f63e794350cc3388c39a7e9ef1e90613ce8b52d841a2e5)

Corner

![Class challenge](/cards/class-challenge/v1/screenshots/chip-bloom.webp?sha=b27e5f9526003797fd7b086f093eee13ce697fec3b6f00de13f3f7635979d880)

Chip

## Views and forms

Views: canvas, corner, chip. Canvas forms: landscape, portrait, square, strip.

[Card views, themes and publishing](/docs/cards/). [Browse the gallery](/apps/#cards).

## Data and privacy

This card uses its configured properties and live card data.

A class is a name, never a student.

## Properties

For theme, background, accent and position, see [Common properties](/docs/cards/#common-properties).

Set static properties in `params`. Bind `data` to a project card data key for live values; that document holds only dynamic properties. Without a data key, put the complete configuration in `params`. Nested rows describe the contents of their parent property.

### Static properties

| Name | Type | Default | Values and limits | Description |
| --- | --- | --- | --- | --- |
| `format` | string | `"number"` | `"number"`, `"percent"`, `"money"` | How values show: a number with its unit, a percentage or an amount of money. |
| `unit` | string | `""` | maxLength: `12` | The unit after a number, for example min or books. |
| `currency` | string | `"$"` | maxLength: `3` | The symbol before an amount of money. |
| `scaleFrom` | number | `0` | minimum: `0`; maximum: `99999999` | Where the bars start, so close values (attendance of 94 to 98 percent) still show a difference. |
| `showTotal` | boolean | `true` |  | Show the total of all classes (the average for percentages) and the countdown. |
| `timeZone` | string, null | `null` |  |  |

### Dynamic properties

| Name | Type | Default | Values and limits | Description |
| --- | --- | --- | --- | --- |
| `title` | string | `"Class challenge"` | maxLength: `40` | The heading, for example Reading challenge. |
| `classes` | array | `[]` | minItems: `0`; maxItems: `10` | The classes and their values. Rank, bar lengths and the leader come from the values. A class is a name, never a student. |
| `classes[].name` | string |  | minLength: `1`; maxLength: `48`; Required |  |
| `classes[].value` | number |  | minimum: `0`; maximum: `99999999`; Required |  |
| `classes[].color` | string |  | pattern: `"^#[0-9A-Fa-f]{6}$"` | The class colour as #RRGGBB. Absent, the class takes a colour from the theme. |
| `goal` | number | `0` | minimum: `0`; maximum: `99999999` | The target. 0 sets none. |
| `goalFor` | string | `"each"` | `"each"`, `"total"` | each: every class races to the goal. total: the classes reach it together. |
| `endsAt` | string | `""` | maxLength: `40` | ISO 8601 instant the challenge ends (a time without an offset is wall time in the screen's zone). Empty shows no countdown. |

## Canvas example

Add this item to a playlist page’s `primitives`. [Publish the playlist and assign a screen](/docs/cards/#publish-a-card-canvas).

```json
{
  "id": "class-challenge",
  "primitive": "card",
  "card": "class-challenge",
  "major": 1,
  "params": {
    "theme": "neomustard"
  },
  "rect": {
    "x": 0,
    "y": 0,
    "width": 1920,
    "height": 1080
  },
  "layer": 0,
  "content_fit": "fill",
  "data": "class-challenge-main"
}
```

## Write live data

Create this document before showing the card, then replace it to update the screen without republishing. Use the same project as the playlist. Supply your API authorization through the environment; see [API authentication](/docs/authentication/).

```console
curl --request PUT "https://api.screenrig.ai/api/card-data/class-challenge-main" \
  --header "Authorization: Bearer $SCREENRIG_TOKEN" \
  --header "ScreenRig-Project: $SCREENRIG_PROJECT" \
  --header "Content-Type: application/json" \
  --data '{"document":{"title":"Class challenge","classes":[],"goal":0,"goalFor":"each","endsAt":""}}'
```
