0.0.2 • Published 3 years ago
hide-svelte v0.0.2
hide-svelte
An incredibly simple action that, when enabled, hides the target element.
It works by simply setting display: none
and aria-hidden: "true"
when
enabled and restoring them when disabled.
Install
npm install hide-svelte -D
# pnpm add -D hide-svelte
# yarn add -D hide-svelte
Usage
<script>
import { hide } from "hide-svelte";
let enabled = false;
function toggle() {
enabled = !enabled;
}
</script>
<button on:click="{toggle}">toggle</button>
<h1 use:hide="{enabled}">Example</h1>
Example
https://svelte.dev/repl/1009b09fac6147bd82a19897ce09cc43
Contributing
Pull requests are always welcome.