# Solid

Use the rupa-player custom element in Solid.

## Quick start

1. Install the player.

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

2. Put `hero.rupaplay` (export as **Player file** in Rupamotion) in `public/`.

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

   ```tsx
   import "@rupamotion/player/element";

   export function Hero() {
   	return <rupa-player src="/hero.rupaplay"></rupa-player>;
   }
   ```

   For TypeScript, declare `rupa-player` in `JSX.IntrinsicElements`.

That's it: the animation plays.

## Need control?

The element's `player` is the player once the file is mounted (`null` before). Keep the element in a variable with
`ref`:

```tsx
import "@rupamotion/player/element";
import type { RupaPlayerElement } from "@rupamotion/player/element";

export function Hero() {
	let el!: RupaPlayerElement;
	return (
		<>
			<rupa-player ref={el} src="/hero.rupaplay"></rupa-player>
			<button onClick={() => el.player?.pause()}>Pause</button>
		</>
	);
}
```

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