- v1.9.3Latest
- v1.9.2
- v1.9.0
- v1.8.23
- v1.8.22
- v1.8.21
- v1.8.20
- v1.8.19
- v1.8.18
- v1.8.17
- 1.8.18
- 1.8.17
- v1.8.16
- v1.8.15
- v1.8.14
- v1.8.13
- v1.8.12
- v1.8.11
- v1.8.10
- v1.8.9
- v1.8.8
- v1.8.7
- v1.8.6
- v1.8.5
- v1.8.4
- v1.8.3
- v1.8.2
- v1.8.1
- v1.7.12
- v1.8.0
- v1.7.11
- v1.7.10
- v1.7.9
- v1.7.8
- v1.7.7
- v1.7.6
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.6.15
- v1.7.0
- v1.7.0-beta.5
- v1.6.16
- v1.7.0-beta.4
- v1.7.0-beta.2
- v1.7.0-beta.1
- v1.7.0-beta.0
- v1.6.14
- v1.6.13
- v1.6.12
- v1.6.11
- v1.6.10
- v1.6.9
- v1.6.8
- v1.6.7
- v1.6.6
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.6
- v1.5.5
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.5.0-beta.6
- v1.5.0-beta.7
- v1.5.0-beta.5
- v1.5.0-beta.4
- v1.5.0-beta.3
- v1.5.0-beta.1
- v1.5.0-beta.2
- v1.4.8
- v1.5.0-beta.0
- v1.4.7
- v1.4.6
- v1.4.5
Website ⢠API Docs ⢠Features Tutorial ⢠Playground ⢠Discord
Solid is a declarative JavaScript library for creating user interfaces. Instead of using a Virtual DOM, it compiles its templates to real DOM nodes and updates them with fine-grained reactions. Declare your state and use it throughout your app, and when a piece of state changes, only the code that depends on it will rerun. Check out our intro video or read on!
Key Features
- Fine-grained updates to the real DOM
- Declarative data: model your state as a system with reactive primitives
- Render-once mental model: your components are regular JavaScript functions that run once to set up your view
- Automatic dependency tracking: accessing your reactive state subscribes to it
- Small and fast
- Simple: learn a few powerful concepts that can be reused, combined, and built on top of
- Provides modern framework features like JSX, fragments, Context, Portals, Suspense, streaming SSR, progressive hydration, Error Boundaries and concurrent rendering.
- Naturally debuggable: A
<div>
is a real div, so you can use your browserâs devtools to inspect the rendering - Web component friendly and can author custom elements
- Isomorphic: render your components on the client and the server
- Universal: write custom renderers to use Solid anywhere
- A growing community and ecosystem with active core team support
Quick Start
You can get started with a simple app by running the following in your terminal:
> npx degit solidjs/templates/js my-app
> cd my-app
> npm i # or yarn or pnpm
> npm run dev # or yarn or pnpm
Or for TypeScript:
> npx degit solidjs/templates/ts my-app
> cd my-app
> npm i # or yarn or pnpm
> npm run dev # or yarn or pnpm
This will create a minimal, client-rendered application powered by Vite.
Or you can install the dependencies in your own setup. To use Solid with JSX (recommended), run:
> npm i -D babel-preset-solid
> npm i solid-js
The easiest way to get set up is to add babel-preset-solid
to your .babelrc
, babel config for webpack, or rollup configuration:
"presets": ["solid"]
For TypeScript to work, remember to set your .tsconfig
to handle Solidâs JSX:
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "solid-js",
}
Why Solid?
Performant
Meticulously engineered for performance and with half a decade of research behind it, Solidâs performance is almost indistinguishable from optimized vanilla JavaScript (See Solid on the JS Framework Benchmark). Solid is small and completely tree-shakable, and fast when rendering on the server, too. Whether youâre writing a fully client-rendered SPA or a server-rendered app, your users see it faster than ever. (Read more about Solidâs performance from the libraryâs creator.)
Powerful
Solid is fully-featured with everything you can expect from a modern framework. Performant state management is built-in with Context and Stores: you donât have to reach for a third party library to manage global state (if you donât want to). With Resources, you can use data loaded from the server like any other piece of state and build a responsive UI for it thanks to Suspense and concurrent rendering. And when youâre ready to move to the server, Solid has full SSR and serverless support, with streaming and progressive hydration to get to interactive as quickly as possible. (Check out our full interactive features walkthrough.)
Pragmatic
Do more with less: use simple, composable primitives without hidden rules and gotchas. In Solid, components are just functions - rendering is determined purely by how your state is used - so youâre free to organize your code how you like and you donât have to learn a new rendering system. Solid encourages patterns like declarative code and read-write segregation that help keep your project maintainable, but isnât opinionated enough to get in your way.
Productive
Solid is built on established tools like JSX and TypeScript and integrates with the Vite ecosystem. Solidâs bare-metal, minimal abstractions give you direct access to the DOM, making it easy to use your favorite native JavaScript libraries like D3. And the Solid ecosystem is growing fast, with custom primitives, component libraries, and build-time utilities that let you write Solid code in new ways.
Show Me!
import { render } from "solid-js/web";
import { createSignal } from "solid-js";
// A component is just a function that (optionally) accepts properties and returns a DOM node
const Counter = props => {
// Create a piece of reactive state, giving us a accessor, count(), and a setter, setCount()
const [count, setCount] = createSignal(props.startingCount || 1);
// The increment function calls the setter
const increment = () => setCount(count() + 1);
console.log(
"The body of the function runs once, like you'd expect from calling any other function, so you only ever see this console log once."
);
// JSX allows us to write HTML within our JavaScript function and include dynamic expressions using the { } syntax
// The only part of this that will ever rerender is the count() text.
return (
<button type="button" onClick={increment}>
Increment {count()}
</button>
);
};
// The render function mounts a component onto your page
render(() => <Counter startingCount={2} />, document.getElementById("app"));
See it in action in our interactive Playground!
Solid compiles our JSX down to efficient real DOM expressions updates, still using the same reactive primitives (createSignal
) at runtime but making sure thereâs as little rerendering as possible. Hereâs what that looks like in this example:
import { render, createComponent, delegateEvents, insert, template } from "solid-js/web";
import { createSignal } from "solid-js";
const _tmpl$ = /*#__PURE__*/ template(`<button type="button">Increment </button>`, 2);
const Counter = props => {
const [count, setCount] = createSignal(props.startingCount || 1);
const increment = () => setCount(count() + 1);
console.log("The body of the function runs once . . .");
return (() => {
//_el$ is a real DOM node!
const _el$ = _tmpl$.cloneNode(true);
_el$.firstChild;
_el$.$$click = increment;
//This inserts the count as a child of the button in a way that allows count to update without rerendering the whole button
insert(_el$, count, null);
return _el$;
})();
};
render(
() =>
createComponent(Counter, {
startingCount: 2
}),
document.getElementById("app")
);
delegateEvents(["click"]);
More
Check out our official documentation or browse some examples
Browser Support
SolidJS Core is committed to supporting the last 2 years of modern browsers including Firefox, Safari, Chrome and Edge (for desktop and mobile devices). We do not support IE or similar sunset browsers. For server environments, we support Node LTS and the latest Deno and Cloudflare Worker runtimes.
Community
Come chat with us on Discord! Solidâs creator and the rest of the core team are active there, and weâre always looking for contributions.
Contributors
Open Collective
Support us with a donation and help us continue our activities. [Contribute]
Sponsors
Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]