svelte-styleak Svelte Themes

Svelte Styleak

Pass(Leak) CSS To Child Component In Svelte

styleak : Svelte Style Leak

Usage

npm i -D @s0kil/svelte-styleak

App.svelte

<script>
  import Text from "./Text.svelte";
</script>

<Text textContent="Hello!" />

<Text
  textContent="See Ya Later!"
  !color="blue"
  !background-color="red"
/>

Text.svelte

<script>
  import styleak from "@s0kil/svelte-styleak";

  export let textContent = "";
</script>

<style>
  p {
    padding: 10px;
    color: tomato;
    background-color: beige;
  }
</style>

<p style="{styleak($$props)}">{textContent}</p>

Demo

styleak in svelte repl

Top categories

Loading Svelte Themes