Skip to content

Frameworks

There is no wrapper package

A component is markup and one stylesheet. There is no behaviour to bind and no state to sync, so a framework component that renders the markup is the whole integration.

Run npx nojsui add <name> to copy the CSS into your project, import it, then paste the markup from the component's page into your own component. That covers most of the kit as written.

The one thing to change: IDs

The demos use fixed IDs like sk-popover-info, and the markup links elements through them: popovertarget and commandfor on the overlays, for and aria-describedby on the form controls. Render the same component twice with a fixed ID and the second trigger opens the first panel.

So generate the ID once per instance with your framework's own helper. Here is popover in all three:

Popover in a framework
import { useId } from "react";
import "./popover.css"; // from: npx nojsui add popover

export function Popover({ label, children }) {
  const id = useId();
  return (
    <div className="sk-popover">
      <button type="button" className="sk-popover__trigger" popoverTarget={id}>
        {label}
      </button>
      <div id={id} popover="auto" className="sk-popover__panel">
        {children}
      </div>
    </div>
  );
}
<script setup>
import { useId } from "vue";
import "./popover.css"; // from: npx nojsui add popover

defineProps({ label: String });
const id = useId();
</script>

<template>
  <div class="sk-popover">
    <button type="button" class="sk-popover__trigger" :popovertarget="id">
      {{ label }}
    </button>
    <div :id="id" popover class="sk-popover__panel">
      <slot />
    </div>
  </div>
</template>
<script>
  import "./popover.css"; // from: npx nojsui add popover

  let { label, children } = $props();
  const id = $props.id();
</script>

<div class="sk-popover">
  <button type="button" class="sk-popover__trigger" popovertarget={id}>
    {label}
  </button>
  <div {id} popover class="sk-popover__panel">
    {@render children?.()}
  </div>
</div>

Smaller differences

  • React spells class as className and for as htmlFor. React 19 knows popover and popoverTarget. Attributes it doesn't know, like commandfor, pass through to the DOM as written.
  • Vue and Svelte take the HTML as it is. Only the ID becomes a binding.
  • Theming doesn't change. Set --sk-<component>-* properties in your own CSS, on the component or any ancestor, exactly as in plain HTML.
  • Server rendering works without extra steps. All three helpers produce the same ID on the server and the client, and the component needs nothing to hydrate.

Check a framework component against the keyboard contract in the original component's README. If it renders the same markup, it inherits the same behaviour, and the same browser support.