# 🤗 Encabezado del espacio de Hugging Face

Un wrapper con tecnología Typescript para la función `mini_header` de Space.

![space header preview](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/space-header-package/thumbnail.png)

## Instalación

```console
pnpm add @huggingface/space-header

npm add @huggingface/space-header

yarn add @huggingface/space-header
```

### Deno

```ts
// esm.sh
import { init } from "https://esm.sh/@huggingface/space-header"
// or npm:
import { init } from "npm:@huggingface/space-header"
```

### Inicializar
```ts
import { init } from "@huggingface/space-header";

// ...

init(":user/:spaceId");
// init("enzostvs/lora-studio") for example
```
❗Nota importante: el método `init` debe llamarse en el lado del cliente.

## Uso

Utiliza la opción `target` para inyectar el encabezado de espacio en otro elemento del DOM

```ts
const app = document.getElementById("app");

// ...

init(":user/:spaceId", {
  target: app
});
```

Si ya tienes los datos del espacio, también puedes pasarlos como parámetro para evitar una solicitud

```ts
init(space);

// space = {
//  id: string;
//  likes: number;
//  author: string;
// }
```

