Socket
Socket
Sign inDemoInstall

modal-svelte

Package Overview
Dependencies
21
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    modal-svelte

Modal component for Svelte


Version published
Weekly downloads
10
increased by400%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

1.3.1 - 2024 Jan 10

  • Fix escape handling in Safari

Readme

Source

Modal Svelte

Modal component for Svelte

NPM License NPM Downloads Test

Features:

  • Autofocus
  • Focus trapping
  • Returns focus after closing
  • Form mode

Demo

Install

npm install modal-svelte

Usage

<script>
	import Modal from 'modal-svelte'
</script>

<Modal title="Hello world!" onCancel={() => (open = false)}>
	<p>Content</p>
</Modal>

Functionality

This shows all available functionality

<Modal
	title="Hello world!"
	onCancel={() => (open = false)}
	form={() => submitMyForm()}
	noEscapeHandling
	noCloseIcon
	class="w-full"
>
	<p>Content</p>
	<input />

	<!-- If you want to bring focus to a specific element -->
	<input autofocus />

	<div slot="buttons">
		<button type="submit">Submit</button>
	</div>

</Modal>
:root {
	--modal-bg: #fff;
	color: #000;
}

Dev instructions

Get started

  1. Install Node.js
  2. Run npm install

Commands

  • npm run dev: Start in dev mode
  • npm run build: Build
  • npm run lint: Lint
  • npm run format: Format

Publish new version

  1. Update CHANGELOG.md
  2. Check for errors
    npm run lint
    
  3. Bump the version number
    npm version --no-git-tag <version>
    
  4. Generate the package
    npm run build:package
    
  5. Publish the package
    npm publish
    
  6. Commit with a tag in format "v#.#.#"
  7. Create GitHub release with release notes

Keywords

FAQs

Last updated on 10 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc