Getting Started with HelixUI
This guide provides an opinionated set of instructions for installing and setting up HelixUI and its dependencies for use in a simple static HTML project with the following assumptions.
- A bundler is not being used.
-
The
public/
directory is the web root for serving files via a web server.
1 - Installing HelixUI Assets
First and foremost, we need to obtain the assets required to configure our application.
To install HelixUI and its dependencies, run the following from the root of your project.
Once complete, assets should be available in
node_modules/helix-ui/
.
2 - Copy Assets into App
Even though we've installed the required assets, they're not where the web server can serve them.
In order to serve the required assets, run the following commands from the root of your project.
Once complete, the directory structure of public/
should resemble the following:
3 - Consuming Assets
Now that assets are in a location that can be served by a web server,
we need to update public/index.html
in order to make
use of the assets.
3.1 - Add test content
To validate that assets are loading as we progress, let's add
the following to the <body>
of our markup.
When viewed in a browser, the heading should be visible but you won't
see any icon. This is because <hx-icon>
hasn't
been upgraded yet to a custom element (handled as part of
HelixUI.initialize()
functionality). We'll fix the icon
in a later step.
3.2 - Load HelixUI Styles
To load HelixUI styles, add the following markup
to the <head>
element.
If configured correctly, the <h1>
element
should be rendered in a thin, sans-serif font.
3.3 - Load Polyfills
The Web Components polyfills are built specifically to be
run directly in the browser (uncompiled and unbundled).
As such, we'll add the following markup to the
<head>
of our document.
The webcomponents-loader.js
polyfill script uses feature
detection to identify the minimum polyfill bundle required by the
current browser. If the browser requires polyfills, an additional
<script>
element (loading a polyfill bundle from
vendor/bundles/
) will be injected after the loader.
3.4 - Load HelixUI Scripts
In order to load HelixUI in a way that is compatible with the largest
set of browsers, add the following markup to the bottom of the
<body>
element.
Once complete, <hx-icon>
should render a visible SVG image.
4 - Verify Configuration
The markup in public/index.html
should resemble the following markup.
Next Steps
Now that everything is wired up correctly, here are some suggestions for what to do next.
- Configure a Layout to arrange page content consistently across your application.
-
Explore the documentation to learn how you can add meaningful interactivity to your application.