1.0.1 • Published 3 years ago

@bobthered/svelte-modal v1.0.1

Weekly downloads
21
License
ISC
Repository
github
Last release
3 years ago

@bobthered/svelte-modal

Svelte component for creating modals with tailwindcss

Installation

npm i -D @bobthered/svelte-modal

Basic Usage

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

<Modal>Modal Body</Modal>

Core Props

PropDefaultDescription
closeabletrueDetermine if the modal can be closed by the user
container{}Container classes ( see below for available props )
modal{}Modal classes ( see below for available props )
overlay{}Overlay classes ( see below for available props )
showfalseSet whether the modal is visible or not
showTitleBartrueSet whether the modal title bar is visible or not
title""Set the modal title text
titleBar{}Title bar classes ( see below for available props )

Styling

Multiple components can be styled. Each component has it's own default classes that can be overwritten

Container Props

PropDefault
alignItemsitems-center
class""
displayflex
heighth-screen
justifyContentjustify-center
leftleft-0
pointerEventspointer-events-none
positionfixed
toptop-0
widthw-screen
zIndexz-30

Modal Props

PropDefault
bgbg-white
class""
displayflex
durationduration-200
flexDirectionflex-col
maxHeightmax-h-full
maxWidthmax-w-4xl
overflowoverflow-hidden
roundedrounded
shadowshadow
show{ false : "opacity-0 pointer-events-none -translate-y-8", true : "opacity-100 pointer-events-auto translate-y-0"}
transformtransform
transitiontransition

Overlay Props

PropDefault
bgbg-black
class""
durationduration-200
heighth-screen
leftleft-0
positionabsolute
show{ false : "opacity-0 pointer-events-none", true : "opacity-70 pointer-events-auto" }
toptop-0
transitiontransition
widthw-screen

Title Bar Props

PropDefault
borderborder-b border-gray-300
class""
displayflex
justifyContentjustify-between
paddingp-4