svelte-pen

1.2.2 • Public • Published

svelte-pen

Create Svelte component demo quickly.

<script type="module" src="https://unpkg.com/svelte-pen"></script>

<svelte-pen><textarea>
  <button on:click={handleClick}>{count}</button>

  <script>
    let count = 0;

    function handleClick() {
      count += 1;
    }
  </script>
</textarea></svelte-pen>

Import another pen as Svelte component on CodePen.

See example: https://codepen.io/yuanchuan/pen/RwJPoNr

<svelte-pen><textarea>
  <Percent value={20} />

  <script>
    import Percent from '/yuanchuan/pen/WNybLmE.svelte';
  </script>
</textarea></svelte-pen>

Pass component attributes to Svelte.

<svelte-pen name="svelte"><textarea>
  <p>
    Hello {name}!
  </p>

  <script>
    export let name
  </script>
</textarea></svelte-pen>

Use different Svelte version.

The default version is 3.52.0 but you can specify a different version through svelte:version attribute.

<svelte-pen svelte:version="latest">

</svelte-pen>

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.2.216latest

Version History

VersionDownloads (Last 7 Days)Published
1.2.216
1.2.10
1.2.00
1.1.30
1.1.20
1.1.10
1.1.00
1.0.00

Package Sidebar

Install

npm i svelte-pen

Weekly Downloads

16

Version

1.2.2

License

MIT

Unpacked Size

11.7 kB

Total Files

7

Last publish

Collaborators

  • yuanchuan