> For the complete documentation index, see [llms.txt](https://legacy-docs.aragon.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://legacy-docs.aragon.org/developers/tools/aragonui/structure/timer.md).

# Timer

Displays a countdown or stopwatch.

## Usage <a href="#usage" id="usage"></a>

```jsx
import { Timer } from '@aragon/ui'

const NOW = Date.now()
const DAY = 1000 * 60 * 60 * 24

const endDate = new Date(NOW + 5 * DAY)
const startDate = new Date(NOW - 5 * DAY)

const App = () => (
  <div>
    <Timer end={endDate} />
    <Timer start={startDate} />
  </div>
)
```

## Demonstration

![](/files/QfY8EJIOH9nBX9iVU6Je)

## Props <a href="#props" id="props"></a>

#### `end` <a href="#end" id="end"></a>

| TYPE   | DEFAULT VALUE |
| ------ | ------------- |
| `Date` | None          |

The end of the countdown, as a `Date` instance.

#### `start` <a href="#start" id="start"></a>

| TYPE   | DEFAULT VALUE |
| ------ | ------------- |
| `Date` | None          |

The start of a timer, as a `Date` instance.

#### `format` <a href="#format" id="format"></a>

| TYPE   | DEFAULT VALUE |
| ------ | ------------- |
| `Enum` | `'dhms'`      |

* Options: `[ 'yMdhms', 'yMdhm', 'yMdh','yMd', 'yM', 'Mdhms', 'Mdhm', 'Mdh', 'Md', 'dhms', 'dhm', 'hms', 'hm', 'ms', 'm', 's' ]`

Format output in years 'y', months 'M', days 'd', hours 'h', minutes 'm', seconds 's'

#### `maxUnits` <a href="#maxunits" id="maxunits"></a>

| TYPE     | DEFAULT VALUE |
| -------- | ------------- |
| `Number` | `-1`          |

Is the number of units to be displayed regardless of the `format`. By default, it’s set to -1 which will display all the available units. If it’s set to a number `n`, which can be from `1` to all the units used in the `format` prop, it will display only the first `n` units, left to right.

#### `showEmpty` <a href="#showempty" id="showempty"></a>

| TYPE      | DEFAULT VALUE |
| --------- | ------------- |
| `Boolean` | `False`       |

Display the units on the left side of the timer when they are equal to zero.

#### `showIcon` <a href="#showicon" id="showicon"></a>

| TYPE      | DEFAULT VALUE |
| --------- | ------------- |
| `Boolean` | `True`        |

Display the clock icon on the left side of the timer.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://legacy-docs.aragon.org/developers/tools/aragonui/structure/timer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
