# Lit

Use the rupa-player custom element inside a Lit template.

## Quick start

1. Install the player.

   ```sh
   npm i @rupamotion/player
   ```

2. Put `hero.rupaplay` (export as **Player file** in Rupamotion) where your build serves static files.

3. Import the element and use it in a template:

   ```js
   import { html } from "lit";
   import "@rupamotion/player/element";

   export const hero = html`<rupa-player src="/hero.rupaplay"></rupa-player>`;
   ```

That's it: the animation plays.

## Need control?

The element's `player` is the player once the file is mounted. Find the element in your component and call it:

```js
import { LitElement, html } from "lit";
import "@rupamotion/player/element";

class HeroSection extends LitElement {
	render() {
		return html`
			<rupa-player src="/hero.rupaplay"></rupa-player>
			<button @click=${this.pause}>Pause</button>
		`;
	}

	pause() {
		this.renderRoot.querySelector("rupa-player")?.player?.pause();
	}
}
customElements.define("hero-section", HeroSection);
```

See [Control playback](/guides/control/) and [Events](/guides/events/).
