npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

inertiax-ui

v0.0.25

Published

UI component library for Inertia X

Downloads

3,136

Readme

Inertia X UI

A collection of Svelte components for Inertia X.

Demo: https://inertiax-ui.netlify.app

Modal

The Modal component displays an Inertia X Frame within a modal. The preview below shows the default dark theme, which renders as a bottom sheet on mobile and centered on desktop. See below for styling options

modal.css demo

Creating a modal

You can programmatically create a Modal using the createModal(props) function. All passed props are handed down to the Frame component, in addition to a close function (see below).

import { createModal } from 'inertiax-ui'

const modal = createModal({
  src: '/profile/edit'
})

createModal returns a close function you can call to close the modal programmatically. Call close() or close(true) to navigate back in history then unmount. Call close(false) to unmount without touching history:

const closeModal = createModal({ src: '/profile/edit' })

// Navigate back, then unmount
closeModal()

// Or just unmount, skip history
closeModal(false)

modal action

Inertia X UI also ships with a modal action. This is a small wrapper for createModal and passes the href attribute as the src prop.

<script>
  import { modal } from 'inertiax-ui'
</script>

<a href="/profile/edit" use:modal>Edit profile</a>

You can also pass options like onclose:

<script>
  import { modal } from 'inertiax-ui'
  import { router } from 'inertiax-svelte'
</script>

<a href="/profile/edit" use:modal={{ onclose: () => router.reload() }}>Edit profile</a>

Closing a modal

The Modal component passes a close function down to its page component as a prop. You can call this function to close it. Behind the scenes, calling close will use the browsers Navigation API to traverse the history back to before the modal was opened, which in turn triggers callbacks that unmount the modal. Alternatively, you can call close(false) to close the modal without going back in history. This will prevent forward-navigation from re-opening the modal.

<script>
  const { close } = $props()
</script>

<button onclick={close}>Close</button>

Note that createModal also returns a close function you can call to close the modal programmatically from the parent.

onclose callback

Pass an onclose callback to run custom logic when the modal closes. This fires regardless of how the modal was closed — via the close button, backdrop click, or browser back button.

import { createModal } from 'inertiax-ui'
import { router } from 'inertiax-svelte'

createModal({
  src: '/profile/edit',
  onclose: () => router.reload()
})

Common use cases: reloading the parent page after an edit, resetting form state, or cleaning up side effects.

animateHeight

By default, the modal smoothly animates its height whenever the content changes (e.g., navigating between pages inside the modal). Set animateHeight: false to disable this behavior and let the modal resize instantly.

createModal({
  src: '/profile/edit',
  animateHeight: false
})

Communicating with the parent

All props passed to createModal (except src) are forwarded to the page component rendered inside the modal. This lets you pass callbacks that the modal page can call to communicate back to the parent.

// In your parent component
import { createModal } from 'inertiax-ui'

createModal({
  src: '/profile/edit',
  onSave: (data) => {
    console.log('Saved:', data)
  }
})
<!-- Inside the modal page (e.g. /profile/edit) -->
<script>
  const { onSave, close } = $props()

  let name = $state('')
</script>

<button onclick={() => { onSave({ name }); close() }}>Save</button>
// Also works with the modal action
<a href="/profile/edit" use:modal={{ onSave: (data) => handleSave(data) }}>Edit</a>

Installation

To start using Inertia X UI, install the inertiax-ui package and import the CSS style you'd like to use.

Styling

Inertia X UI ships with modal.css which automatically adapts to the system color scheme preference. You can override this by setting the [data-theme] attribute on html or body:

import 'inertiax-ui/modal.css'

To force a theme:

// Force dark theme
document.documentElement.setAttribute('data-theme', 'dark')

// Force light theme
document.documentElement.setAttribute('data-theme', 'light')

For full styling control, you can of course bring your own CSS. The key classes to target are:

| Class | Element | |-------|---------| | .inx-modal_wrapper | Full-screen overlay container | | .inx-modal_bg | Clickable backdrop | | .inx-modal | The modal panel itself | | .inx-spinner | The loading animation spinner |

Additionally, Svelte injects a --progress variable with the current progress of the modal in- and out-transition (0 to 1). You can use it to create your own in- and out-transitions.