@swim/web implements a thin web application framework built on the
@swim/ui toolkit. @swim/web makes it easy to embed
views and @swim/ux
widgets in any web page by simply adding special
swim- attributes to ordinary
HTML elements. @swim/web is a part of the broader
The @swim/web umbrella package depends on, and re-exports, the following component libraries:
- @swim/site (npm, doc) – inimalist components that implement common dynamic website behaviors.
lightweight application loader that dynamically instantiates views and
controllers declared by
For an npm-managed project,
npm install @swim/web to make it a dependency.
TypeScript sources will be installed into
node_modules/@swim/web/lib/main. And a pre-built UMD script, which
bundles all @swim/web component libraries, can be found in
Browser applications can load
swim-web.js, along with its
swim-ui.js dependencies, from the swimOS CDN.
<!-- Development --> <script src="https://cdn.swimos.org/js/latest/swim-core.js"></script> <script src="https://cdn.swimos.org/js/latest/swim-ui.js"></script> <script src="https://cdn.swimos.org/js/latest/swim-web.js"></script> <!-- Production --> <script src="https://cdn.swimos.org/js/latest/swim-core.min.js"></script> <script src="https://cdn.swimos.org/js/latest/swim-ui.min.js"></script> <script src="https://cdn.swimos.org/js/latest/swim-web.min.js"></script>
Alternatively, the standalone
swim-system.js script may be loaded
from the swimOS CDN, which bundles @swim/web together with all other
<!-- Development --> <script src="https://cdn.swimos.org/js/latest/swim-system.js"></script> <!-- Production --> <script src="https://cdn.swimos.org/js/latest/swim-system.min.js"></script>
@swim/web can be imported as an ES6 module from TypeScript and other
ES6-compatible environments. All component libraries are re-exported by
import * as swim from "@swim/web";
@swim/web can also be used with CommonJS-compatible module systems.
All component libraries are re-exported by the umbrella
var swim = require("@swim/web");
When loaded by a web browser, the
swim-web.js script adds all component
library exports to the global
swim namespace. The
swim-ui.js have already been loaded.
swim-system.js script also adds all @swim/web component library
exports to the global
swim namespace, making it a drop-in replacement
swim-web.js when additional @swim/system frameworks are needed.