Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »


0.9.2 • Public • Published

Build Status npm version

Launchy! 🚀

An accessible modal window! — https://launchy.io

Features include:

  • Easy to use and implement!
  • On launch, keyboard focus shifts to the modal window container
  • The modal window is described via optional modal heading
  • Traps the keyboard focus within the modal when active/visible
  • Closes the window on esc key press
  • Closes the window on overlay mouse click
  • Sets keyboard focus back to the launcher element on window close
  • Add your own custom close controls!
  • Add your own custom controls which send focus to somewhere else on the page!
  • Transparent border for Windows High Contrast themes

For more details on the accessibility of modal windows:


  • Check out the demo! 👈
  • Try your own HTML with the CodePen demo!


Launchy! is very easy to install and use:


Wherever you want to have a Launchy! control + window appear in your HTML content, simply wrap your content with a <div> and add the data-launchy attribute.


<div data-launchy data-launchy-text="Launch window!" data-launchy-title="My modal window">
    <p>This content will appear in the modal window.</p>
  • Required: data-launchy -- Attribute is required but the value can be anything
  • Required: data-launchy-text -- This is the text that will be output to the launcher control
  • Optional: data-launchy-title -- The text which appears in the heading of the modal window, recommended for greater a11y context 👍
  • Optional: data-launchy-button -- If you'd rather have button elements instead of the default a elements as launcher and close controls

Custom Close Controls

You can add your own custom close controls to any Launchy! modal window!

  1. Add the HTML element you wish to use for the control within your content
  2. Apply the data-launchy-close attribute


<div data-launchy data-launchy-text="Launch window!" data-launchy-title="My modal window">
    <p>This content will appear in the modal window.</p>
    <a href="#" data-launchy-close="🔥">Ok!</a>

Clicking on the "Ok!" link will hide the modal window and send focus back to the launcher control!

Custom Refocus Controls

You can add your own custom "refocus" controls to any Launchy! modal window!

  1. Add the HTML element you wish to use for the control within your content
  2. Apply the data-launchy-refocus attribute
  3. Set the value of the data-launchy-refocus attribute to the id of the element you wish to send focus to


<div data-launchy data-launchy-text="Launch window!" data-launchy-title="My modal window">
    <p>This content will appear in the modal window.</p>
    <a href="#" data-launchy-refocus="post-title">Send me to the article headline!</a>
<!-- Somewhere else in your page… -->
<h1 id="post-title" tabindex="-1">My perfect sundae…</h1>

Clicking on the "Send me to the article headline!" link will hide the modal window and shift keyboard focus to the <h1 id="post-title"/> element!


Launchy! has many CSS classes available on its generated elements for custom styles. Check out the style.scss file for class names and an example on how you might want to style your modal windows!


For any site, grab the /dist/launchy.js file and include it at the bottom of your HTML page/template:

<script src="js/launchy.js"></script>

Launchy! will run automatically and generate all the modal windows for you!

npm Package

Launchy! is also available as an npm package!


npm i launchy-modal-window


Include the launchy.js directly in your app or site template.

<script src="node_modules/launchy-modal-window/launchy.js"></script>


See the CONTRIBUTING file.


See the LICENSE file.


npm i launchy-modal-window

Downloadsweekly downloads










last publish


  • avatar
Report a vulnerability