Aqua Basis
Directives in Aqua DS are implemented through a custom system based on the DOM MutationObserver API, allowing us to replicate the behavior of directives commonly seen in frameworks. This system observes changes in the DOM and applies specific behaviors automatically, ensuring reactive and declarative enhancements without requiring additional boilerplate code.
They allow developers to extend the HTML syntax with additional capabilities, such as showing tooltips, handling click triggers, or modify some element of the DOM manually.
Instead of writing JavaScript logic for each component individually, directives encapsulate that logic in a reusable and consistent way.
aq-
syntax.We use an enum to enable an autocomplete feature at the moment of implement the directives. You can use it importing our Directives
Enum.
// Example Vue
// main.ts
import { Directives } from "@aqua-ds/web-components/enums";
app.use(LibraryDirectives, {
directives: [Directives.DIALOG, Directives.DRAWER, Directives.TOOLTIP, Directives.SPINNER],
})
The flexibility makes directives framework-agnostic while keeping the developer experience familiar and loading this directives on-load demanding. therefore, the directives can be easily integrated depending on the framework.
import { setupDirectives } from '@aqua-ds/web-components/directives';
setupDirectives(['aq-spinner', 'aq-dialog', 'aq-drawer', 'aq-tooltip'])
<aside> ℹ️
We are working on this feature.
</aside>
// main.ts
import { LibraryDirectives } from '@aqua-ds/vue/lib/plugin.ts'
app.use(LibraryDirectives, {
directives: ['aq-spinner', 'aq-dialog', 'aq-drawer', 'aq-tooltip'],
})
// main.ts
import { LibraryDirectives } from '@aqua-ds/react/lib/index.js';
LibraryDirectives(['aq-dialog', 'aq-tooltip', 'aq-spinner', 'aq-drawer']);
// main.ts
import { LibraryDirectives } from '@aqua-ds/angular';
LibraryDirectives(['aq-dialog', 'aq-spinner', 'aq-drawer', 'aq-tooltip']);
Provides contextual information when hovering over or focusing on an element.
Displays a modal dialog by targeting a component’s ID.
Enables the display of a side panel (drawer) by binding the directive to a component’s ID.
Toggles a loading spinner overlay on a component.
On this page
✨ Design together. Build together. Speak the same language. ✨