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

# Timer

A component that emits an event repeatedly at specified time intervals, enabling time-based refresh.

<img src="https://mintcdn.com/writer/dHnl9w_Om9ycQRLE/framework/public/components/timer.png?fit=max&auto=format&n=dHnl9w_Om9ycQRLE&q=85&s=033c952ea8a45dc5e1bfd30ff1d1a6f4" width="424" height="125" data-path="framework/public/components/timer.png" />

## Fields

<table className="componentFields">
  <thead>
    <th>Name</th>
    <th>Type</th>
    <th class="desc">Description</th>
    <th>Options</th>
  </thead>

  <tbody>
    <tr>
      <td>Interval (ms)</td>
      <td>Number</td>
      <td>How much time to wait between ticks. A tick is considered finished when its event is handled.</td>

      <td>
        <span>-</span>
      </td>
    </tr>

    <tr>
      <td>Active</td>
      <td>Boolean</td>
      <td>Whether the timer should trigger tick events.</td>

      <td>
        <span>-</span>
      </td>
    </tr>

    <tr>
      <td>Accent</td>
      <td>Color</td>
      <td>-</td>

      <td>
        <span>-</span>
      </td>
    </tr>

    <tr>
      <td>Custom CSS classes</td>
      <td>Text</td>
      <td>CSS classes, separated by spaces. You can define classes in custom stylesheets.</td>

      <td>
        <span>-</span>
      </td>
    </tr>
  </tbody>
</table>

## Events

<AccordionGroup>
  <Accordion title="wf-tick" icon="code">
    Emitted when the timer ticks.

    ```python theme={null}
    def handle_timer_tick(state):

    # Increment counter when the timer ticks

    state["counter"] += 1
    ```
  </Accordion>
</AccordionGroup>

<events />
