https://github.com/omarluq/stimulus-store
Ultra lightweight state management for your Stimulus-powered web applications.
https://github.com/omarluq/stimulus-store
global-state-management javascript javascript-library npm-package ruby-on-rails state-management stimulus stimulus-controller stimulus-controllers stimulus-js stimulusjs stimulusjs-state-management store typescript
Last synced: about 2 months ago
JSON representation
Ultra lightweight state management for your Stimulus-powered web applications.
- Host: GitHub
- URL: https://github.com/omarluq/stimulus-store
- Owner: omarluq
- License: mit
- Created: 2023-11-22T17:51:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-28T12:29:40.000Z (2 months ago)
- Last Synced: 2025-03-29T03:02:34.670Z (2 months ago)
- Topics: global-state-management, javascript, javascript-library, npm-package, ruby-on-rails, state-management, stimulus, stimulus-controller, stimulus-controllers, stimulus-js, stimulusjs, stimulusjs-state-management, store, typescript
- Language: TypeScript
- Homepage: https://stimulus-store.com
- Size: 1.22 MB
- Stars: 76
- Watchers: 5
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: docs/README.md
- Contributing: docs/CONTRIBUTING.md
- Code of conduct: docs/CODE_OF_CONDUCT.md
- Security: docs/SECURITY.md
Awesome Lists containing this project
- awesome-hotwire - stimulus-store - A simple state management for Stimulus. (**Awesome Hotwire** [](https://github.com/sindresorhus/awesome) / Stimulus)
- awesome-hotwire - stimulus-store - A simple state management for Stimulus. (**Awesome Hotwire** [](https://github.com/sindresorhus/awesome) / Stimulus)
README
[](https://github.com/omarluq/stimulus-store)
[](https://github.com/omarluq/stimulus-store/actions/workflows/test.yml)
[](https://netlify.com)
[](https://github.com/omarluq/stimulus-store/commits/main)
[](https://github.com/omarluq/stimulus-store/graphs/commit-activity)
[](https://github.com/omarluq/stimulus-store/graphs/contributors)
[](https://github.com/omarluq/stimulus-store/pulls)
[](https://github.com/omarluq/stimulus-store/pulls?q=is%3Apr+is%3Aclosed)
[](https://github.com/omarluq/stimulus-store/issues)
[](https://github.com/omarluq/stimulus-store)
[](https://github.com/omarluq/stimulus-store/stargazers)
[](https://github.com/omarluq/stimulus-store/network/members)
[](https://github.com/omarluq/stimulus-store/watchers)
[](https://www.typescriptlang.org)
[](https://biomejs.dev)
[](https://codeclimate.com/github/omarluq/stimulus-store/maintainability)
[](https://codeclimate.com/github/omarluq/stimulus-store/test_coverage)
[](https://npmjs.com/package/stimulus-store)
[](https://npmjs.com/package/stimulus-store)
[](https://bundlephobia.com/[email protected])
[](https://bundlephobia.com/[email protected])
[](https://bundlephobia.com/[email protected])
[](https://github.com/omarluq/stimulus-store)
[](https://github.com/omarluq/stimulus-store)
[](https://github.com/omarluq/stimulus-store)
[](https://dependabot.com)
[](https://github.com/omarluq/stimulus-store)
[](https://discord.gg/ScU4JKgxaU)
Ultra lightweight state management for your Stimulus powered web applications.- **Create and manage global state with ease.** ð
- **Share state between different controllers effortlessly using a unified, atomic `Store` class.** ð
- **1.04KB Minified and Brotlied** ðŠķ## Installation
### With a build system
Install with [npm](https://www.npmjs.com/):
```sh
npm install stimulus-store
```Install with [yarn](https://yarnpkg.com):
```sh
yarn add stimulus-store
```### UMD
If you prefer not to use a build system, you can load `stimulus-store` in a `` tag and it will be globally available through the `window.StimulusStore` object.
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://unpkg.com/stimulus/dist/stimulus.umd.js">
(() => {
const application = Stimulus.Application.start();const helloStore = StimulusStore.createStore({
name: "helloStore",
type: String,
initialValue: "Hello World!",
});application.register(
"hello",
class extends Stimulus.Controller {
static stores = [helloStore];connect() {
StimulusStore.useStore(this);
this.element.innerHtml = `<p>${this.helloStoreValue}</p>`;
}
}
);
})();
âĶ