Getting started
Installation
Pick the path that matches your stack. Every path ends with the same stylesheet.
Package managers#
Halora ships as a tarball attached to each GitHub release. The package is @originlabsbr/halora and has no runtime dependencies. Once published to the npm registry, the same name will install with npm i @originlabsbr/halora.
# npm
npm install https://github.com/originlabsbr/halora/releases/download/v0.1.0/originlabsbr-halora-0.1.0.tgz
# pnpm
pnpm add https://github.com/originlabsbr/halora/releases/download/v0.1.0/originlabsbr-halora-0.1.0.tgz
# yarn
yarn add https://github.com/originlabsbr/halora/releases/download/v0.1.0/originlabsbr-halora-0.1.0.tgzImport in a bundler#
// everything: tokens, base, components (origin brand)
import '@originlabsbr/halora/css';
// or one layer at a time
import '@originlabsbr/halora/tokens.css';
import '@originlabsbr/halora/base.css';
import '@originlabsbr/halora/components/button.css';
// the Gabarito brand as an add-on (set data-brand="gabarito")
import '@originlabsbr/halora/brands/gabarito.css';
// behaviors, tree-shakeable
import { initTheme } from '@originlabsbr/halora/theme';
import { startReveal } from '@originlabsbr/halora/reveal';Fonts#
Halora does not bundle fonts. The Origin brand uses Inter and JetBrains Mono, with optional Saira Condensed for large numerals. Gabarito uses Plus Jakarta Sans. Self-host them or use a font service, with font-display: swap and only the weights you use.
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400..700&family=JetBrains+Mono:wght@400..600&display=swap">CDN#
Every release is served at an immutable, versioned path. halora@latest follows the newest release and is cached for a short time only, so pin a version in production.
| File | URL |
|---|---|
halora.min.css | https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/halora.min.css |
halora.css | https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/halora.css |
Gabarito bundle | https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/bundles/halora.gabarito.min.css |
tokens.css | https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/tokens.css |
tokens.json | https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/tokens.json |
halora.iife.js | https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/halora.iife.js |
theme-init.js | https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/theme-init.js |
ES modules | https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/js/index.js |
<link rel="stylesheet" href="https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/halora.min.css">
<script src="https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/halora.iife.js" defer></script>
<script>
addEventListener('DOMContentLoaded', function () { Halora.init({ themeKey: 'theme' }); });
</script>Static sites with the IIFE bundle#
Sites without a build step load halora.iife.js. It defines window.Halora with every behavior. Put the pre-paint snippet in the head so the theme is set before first paint.
<head>
<script>
(function(){var d=document.documentElement,t="light",q="(prefers-color-scheme: dark)";
try{var s=localStorage.getItem("theme");if(s==="light"||s==="dark")t=s;else if(matchMedia(q).matches)t="dark"}
catch(e){try{if(matchMedia(q).matches)t="dark"}catch(_){}}
d.setAttribute("data-theme",t)})();
</script>
<link rel="stylesheet" href="https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/halora.min.css">
</head>If your Content Security Policy forbids inline scripts, serve theme-init.js instead, or generate a snippet for your own storage key with themeInitScript({ storageKey }).
Tailwind CSS#
The preset maps Tailwind theme keys to the CSS variables, so utilities follow the active theme and brand. It works with Tailwind 3. Keep importing the Halora stylesheet so the variables exist.
// tailwind.config.js (CommonJS)
module.exports = {
presets: [require('@originlabsbr/halora/tailwind-preset')],
content: ['./src/**/*.{js,jsx,ts,tsx,html}'],
};
// tailwind.config.mjs (ESM)
import preset from '@originlabsbr/halora/tailwind-preset';
export default { presets: [preset], content: ['./src/**/*.{js,ts,html}'] };| Theme key | Examples |
|---|---|
colors | bg-canvas, bg-surface, bg-surface-2, text-ink, text-muted, text-faint, border-line, border-line-strong, bg-accent-fill, text-accent-on, text-accent-text, text-danger, text-success |
fontFamily | font-sans, font-mono, font-display |
fontSize | text-display, text-h1, text-h2, text-h3, text-lede, text-body, text-small, text-caption |
borderRadius | rounded-sm, rounded-md, rounded-lg, rounded-card, rounded-pill |
boxShadow | shadow-glass, shadow-raised, shadow-accent, shadow-overlay |
Other | ease-halora, duration-reveal, z-ha-header, max-w-ha-page, ha-sm and ha-md screens, p-ha-4 spacing |
TypeScript#
Token names are typed, and every behavior ships declarations.
import type { TokenName, ColorToken } from '@originlabsbr/halora/tokens';
import { cssVar } from '@originlabsbr/halora/tokens';
cssVar('accent-fill'); // "var(--ha-accent-fill)"Package contents#
| Export | File |
|---|---|
@originlabsbr/halora | dist/js/index.js, ESM entry with every behavior |
/css, /css/min | dist/halora.css, dist/halora.min.css |
/tokens.css, /base.css, /components.css | Individual layers |
/components/* | One CSS file per component |
/brands/* | origin.css and gabarito.css (scoped by data-brand) |
/bundles/* | Per-brand full bundles, for example halora.gabarito.min.css |
/theme, /reveal, /header, /motion, /dialog, /particles | Behavior modules |
/theme-init | Pre-paint script file |
/iife | dist/halora.iife.js for window.Halora |
/tokens, /tokens.json | Token names, values, and types |
/tailwind-preset | CommonJS and ESM presets |