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>

Dependencies (0)

    Dev Dependencies (0)

      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