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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fouita/dialog

v0.0.1

Published

Dialog component built with svelte and tailwindcss, show modal or info messages!

Downloads

2

Readme

Svelte and tailwindcss Dialog component

Dialog component built with svelte and tailwindcss, show modal or info messages!

Installation

$npm i -D @fouita/dialog

Usage

To show the dialog component we just need to set true to the visible prop

fouita dialog

<script>
 import Dialog from '@fouita/dialog'
</script>

<Dialog visible title="Simple Title" body="Simple message!" />

Show and hide + Filter

If we want to show the Dialog when clicking on a button, we better bind the value with bind:visible={value} prop.

We can use also filter={false} to show the dialog without background

fouita dialog

<script>
 import Dialog from '@fouita/dialog'
 let visible = false
 function toggle(){
     visible = !visible
 }
</script>

<button class="px-4 py-2 m-2 border" on:click={toggle}>Toggle</button>
<Dialog bind:visible title="Simple Title" body="Simple message!" />

Change round and color

To change the rounding style we can use tailwindcss rounding suffixes none, sm, md, lg and to change the color we can from tailwindcss color names

fouita dialog

<Dialog rounded=sm color=pink visible title="Simple Title" body="Simple message!" />

You can also invert colors by adding inverted prop

fouita dialog

<Dialog rounded=sm inverted color=pink visible title="Simple Title" body="Simple message!" />

Add custom elements

To add custom elements in the title, we can use icon prop, and to update the body with html we can just write inside the Dialog tag

fouita dialog

<script>
 import Dialog from '@fouita/dialog'
 import {LockIcon} from 'svelte-feather-icons'
</script>

<Dialog visible title="With Icon" icon={LockIcon}>
    <div class="p-4 text-center w-64 h-64 text-2xl">
        Cusom Body
    </div>
</Dialog>

Dialog position & align

position prop indicates the starting point when showing a dialog, there is 3 positions top, middle, bottom

align prop handles the horizontal position of the component left, center, right

by default we use middle and center to have the dialog in the center of the page

fouita dialog

<Dialog visible title="Simple Title" inverted position=bottom align=left rounded=none >
    <div class="p-4 text-center w-64 h-64 text-2xl">
        Cusom Body
    </div>
</Dialog>

The follwing is an example of dialog that popsup from the bottom center of the page

fouita dialog

<script>
	import Chip from '@fouita/chip'
    import Dialog from '@fouita/dialog'			
    import {CheckCircleIcon} from 'svelte-feather-icons'

    let visible = true
</script>

<Dialog bind:visible position=bottom align=center filter={false} rounded="md" >
    <Chip size="xl" rounded="none" color="teal" class="mx-0 my-0" onDelete={() => dialog4=false} >
        <div slot="avatar">
            <CheckCircleIcon class='w-5 h-5 mx-2' />
        </div>
        <div class="py-2">
            This is a success messsage
            <div class="text-sm font-base">
                More information about the message can be found <u>here</u>
            </div>
        </div>
    </Chip>
</Dialog>

Here is another example to show a list of icons in a dialog box

fouita dialog

<script>
    import Dialog from '@fouita/dialog'
    import {LinkedinIcon,FacebookIcon,TwitterIcon,SlackIcon} from 'svelte-feather-icons'
</script>
<Dialog visible filter={false} align=right color=purple >
    <div class="p-4 text-center w-12 h-48 text-purple-600 text-2xl flex flex-col items-center">
        <LinkedinIcon class="w-6 h-6 m-2 cursor-pointer hover:text-purple-800" />
        <FacebookIcon class="w-6 h-6 m-2 cursor-pointer hover:text-purple-800" />
        <TwitterIcon class="w-6 h-6 m-2 cursor-pointer hover:text-purple-800" />
        <SlackIcon class="w-6 h-6 m-2 cursor-pointer hover:text-purple-800" />
    </div>
</Dialog>

Custom width and height

With position we can also indicate the width and the height of the dialog by using w and h props

fouita dialog

<Dialog position=bottom w=full filter={false} rounded=none >
 ...
</Dialog> 

or we can show a side bar like the following, we used closable={false} to hide the X icon and disable default closing

fouita dialog

<Dialog visible h=full title="Side Menu" closable={false} inverted align=left rounded=none >
    <div class="p-4 text-center w-64 h-64 text-2xl">
        Cusom Menu
    </div>
</Dialog>

About

Fouita : UI framework for svelte + tailwind components