mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 19:46:36 +00:00
feat: add LocalStorage component
This commit is contained in:
parent
b5161b6b9e
commit
1f7fe60695
11 changed files with 199 additions and 3 deletions
9
docs/src/pages/components/LocalStorage.svx
Normal file
9
docs/src/pages/components/LocalStorage.svx
Normal file
|
@ -0,0 +1,9 @@
|
|||
<script>
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
</script>
|
||||
|
||||
This utility component wraps the [Window.localStorage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) to persist values by key. This is useful for non-persistent data (e.g., dark mode toggle).
|
||||
|
||||
### Reactive example
|
||||
|
||||
<FileSource src="/framed/LocalStorage/LocalStorage" />
|
Loading…
Add table
Add a link
Reference in a new issue