Skip to content
Halorav0.1.0

Behaviors

Behaviors

Small modules that wire up the accessible defaults. Zero dependencies, safe to import on the server.

Modules#

ModuleImportDoes
theme@originlabsbr/halora/themeTheme contract, storage key, toggle labels, pre-paint snippet.
reveal@originlabsbr/halora/revealScroll reveal with the v3 rules.
header@originlabsbr/halora/headerScroll state for the pill header.
motion@originlabsbr/halora/motionPause switch and reduced-motion helpers.
dialog@originlabsbr/halora/dialogOpen and close helpers, backdrop click, hash deep links.
particles@originlabsbr/halora/particlesOptional canvas field behind the page.

Use as ES modules#

JavaScript
import { initTheme } from '@originlabsbr/halora/theme';
import { initHeader } from '@originlabsbr/halora/header';
import { startReveal } from '@originlabsbr/halora/reveal';
import { initDialogs } from '@originlabsbr/halora/dialog';

initTheme({ storageKey: 'theme' });
initHeader();
startReveal();
initDialogs({ hash: true });

Every module is a separate file with no side effects on import, so bundlers drop what you do not use, and importing on the server does not touch window or document.

Use without a build#

HTML
<script src="https://designsystem.lab.mateuseap.com/cdn/halora@0.1.0/halora.iife.js" defer></script>
<script>
  addEventListener('DOMContentLoaded', function () {
    Halora.init({ themeKey: 'originlabs-theme', hash: true });
    // or call pieces: Halora.theme.initTheme(...), Halora.reveal.startReveal(), ...
  });
</script>
NameSignatureDescription
Halora.init(options?) => voidOne call for the common case. Options: themeKey, reveal (false to skip), dialogs (false to skip), hash.
Halora.versionstringThe package version.
Halora.theme, reveal, header, motion, dialog, particlesnamespacesEvery export of the module.

Events#

EventOnDetail
ha:themechangedocument{ theme: "light" | "dark" }
ha:motionchangedocument{ motion: "on" | "off" }

Size#

All behaviors together, minified and gzipped, are 5.2 kB. CI fails above 8 kB.

Markup hooks#

Attribute or classUsed by
data-ha-theme-toggletheme
data-ha-motion-togglemotion
data-ha-dialog-open="id", data-ha-dialog-closedialog
.ha-header, .is-scrolledheader
.ha-reveal, .is-visible, .is-instantreveal
canvas.ha-particlesparticles

Edit this page on GitHub

Type to search.