Skip to main content
This release is 1 version behind 0.1.0 — the latest version of @nidhugg/modal. Jump to latest

A basic web component for creating modals.

This package works with BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
70%
Published
2 hours ago (0.0.1)

Nidhugg Modal

A basic web component for creating modals.

Basic usage

  1. Include the script in your HTML file:

  2. Add the nidhugg-modal element to your HTML file.

  3. Add content to the modal using the header, content, and footer slots.

    
    

Hello World

This is a test of the Nidhugg Modal

```

Styling

The modal can be styled using CSS custom variables. The following variables are available:

:root{
  --nidhugg-base-100:#2A303C;
  --nidhugg-base-200:#242933;
  --nidhugg-base-300:#20252E;
  --nidhugg-base-content:#B2CCD6;
  --nidhugg-neutral:#1C212B;
  --nidhugg-neutral-content:#B2CCD6;
  --nidhugg-rounded: 0.5rem;
}

The modal will also add the nidhugg-modal-open-class to the body when it is open.

/* Example: */
 .nidhugg-modal-open{
     overflow: hidden;
     filter: blur(2px);
     height: 100vh;
     width: 100vw;
 }

Add Package

deno add jsr:@nidhugg/modal

Import symbol

import * as modal from "@nidhugg/modal";

---- OR ----

Import directly with a jsr specifier

import * as modal from "jsr:@nidhugg/modal";

Add Package

npx jsr add @nidhugg/modal

Import symbol

import * as modal from "@nidhugg/modal";

Add Package

yarn dlx jsr add @nidhugg/modal

Import symbol

import * as modal from "@nidhugg/modal";

Add Package

pnpm dlx jsr add @nidhugg/modal

Import symbol

import * as modal from "@nidhugg/modal";

Add Package

bunx jsr add @nidhugg/modal

Import symbol

import * as modal from "@nidhugg/modal";