# @jill64/svelte-html

> 🏷️ Declarative attribute binding for the root html element

Latest version **2.0.1** (published 2025-05-18) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @jill64/svelte-html
pnpm add @jill64/svelte-html
yarn add @jill64/svelte-html
bun add @jill64/svelte-html
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2025-05-18 |
| First published | 2023-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jill64 |
| Maintainers | jill64 |
| Keywords | attributes, declarative, html, svelte |

## Links

- npm: https://www.npmjs.com/package/@jill64/svelte-html
- Repository: https://github.com/jill64/svelte-html
- Homepage: https://github.com/jill64/svelte-html#readme
- Issues: https://github.com/jill64/svelte-html/issues
- npm.io page: https://npm.io/package/@jill64/svelte-html

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2025-05-18
- 2.0.0 — 2024-12-25
- 1.1.20 — 2024-07-29
- 2.0.0-next-.2 — 2024-07-25
- 2.0.0-next-.1 — 2024-07-24
- 1.1.19 — 2024-07-05
- 1.1.18 — 2024-06-15
- 1.1.17 — 2024-06-01
- 1.1.16 — 2024-05-14
- 1.1.15 — 2024-05-01
- 1.1.14 — 2024-04-20
- 1.1.13 — 2024-04-10
- 1.1.12 — 2024-04-04
- 1.1.11 — 2024-03-28
- 1.1.10 — 2024-03-19
- … 16 more at https://npm.io/package/@jill64/svelte-html/versions

## README

<!----- BEGIN GHOST DOCS HEADER ----->

# @jill64/svelte-html

<!----- BEGIN GHOST DOCS BADGES ----->

<a href="https://npmjs.com/package/@jill64/svelte-html"><img src="https://img.shields.io/npm/v/@jill64/svelte-html" alt="npm-version" /></a> <a href="https://npmjs.com/package/@jill64/svelte-html"><img src="https://img.shields.io/npm/l/@jill64/svelte-html" alt="npm-license" /></a> <a href="https://npmjs.com/package/@jill64/svelte-html"><img src="https://img.shields.io/npm/dm/@jill64/svelte-html" alt="npm-download-month" /></a> <a href="https://npmjs.com/package/@jill64/svelte-html"><img src="https://img.shields.io/bundlephobia/min/@jill64/svelte-html" alt="npm-min-size" /></a> <a href="https://github.com/jill64/svelte-html/actions/workflows/ci.yml"><img src="https://github.com/jill64/svelte-html/actions/workflows/ci.yml/badge.svg" alt="ci.yml" /></a> <a href="https://svelte-html.jill64.dev"><img src="https://img.shields.io/website?up_message=working&down_message=down&url=https%3A%2F%2Fsvelte-html.jill64.dev" alt="website" /></a>

<!----- END GHOST DOCS BADGES ----->

🏷️ Declarative attribute binding for the root html element

## [Demo](https://svelte-html.jill64.dev)

<!----- END GHOST DOCS HEADER ----->

## Installation

```sh
npm i @jill64/svelte-html
```

## Usage

By passing a key-value set to the `<SvelteHTML />` component, attributes are bind to the root html element.

```svelte
<script>
  import { SvelteHTML } from '@jill64/svelte-html'
</script>

<SvelteHTML lang="en" prefix="example" />
```

↓

```html
<html lang="en" prefix="example">
  <!-- ... -->
</html>
```

## SSR

Attribute binding with `<SvelteHTML>` is only applied on the client.
To assign arbitrary attributes during SSR, use the `apply` function in the `handle` hook.

```js
// hooks.server.js
import { apply } from '@jill64/svelte-html'

export const handle = async ({ event, resolve }) => {
  // ...
  return resolve(event, {
    transformPageChunk: apply({
      lang: 'en',
      prefix: 'example'
    })
  })
}
```

<!----- BEGIN GHOST DOCS FOOTER ----->

## License

[MIT](LICENSE)

<!----- END GHOST DOCS FOOTER ----->

---
_Source: https://npm.io/package/@jill64/svelte-html · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
