Toast Components
Import the Toast component and Icons.
<script>
import {Toast} from 'flowbite-svelte'
import {FireOutline, CheckCircleSolid, PlusCircleOutline,ArchiveSolid} from 'svelte-heros'
</script>
Examples
Use fade, fly, slide, or blur for transitionType.
Fade examples
Transition type: fade
<Toast>
<span slot="icon">
<FireOutline />
</span>
<span slot="text">
Transition type: fade
</span>
</Toast>
Slide examples
You can use one of Svelte/easing.
Transition type: slide
Transition type: slide, delay: 250, duration: 300, easing: quintOut
Transition type: slide, delay: 250, duration: 2000, easing: elasticOut
<Toast transitionType="slide" iconColor='red'>
<span slot="icon">
<CheckCircleSolid class="text-red-500"/>
</span>
<span slot="text">
Transition type: slide
</span>
</Toast>
<Toast transitionType="slide" iconColor='red' transitionParams="{{delay: 250, duration: 300, easing: quintOut}}">
<span slot="icon">
<CheckCircleSolid class="text-red-500"/>
</span>
<span slot="text">
Transition type: slide, delay: 250, duration: 300, easing: quintOut
</span>
</Toast>
<Toast transitionType="slide" iconColor='red' transitionParams="{{delay: 250, duration: 2000, easing: elasticOut}}">
<span slot="icon">
<CheckCircleSolid class="text-red-500"/>
</span>
<span slot="text">
Transition type: slide, delay: 250, duration: 2000, easing: elasticOut
</span>
</Toast>
Blur examples
Transition type: blur, amount: 10
Transition type: blur, amount: 50, delay 1000
<Toast transitionType="blur" iconColor='purple' transitionParams="{{amount: 10}}">
<span slot="icon">
<PlusCircleOutline class="text-purple-500"/>
</span>
<span slot="text">
Transition type: blur, amount: 10
</span>
</Toast>
<Toast transitionType="blur" iconColor='purple' transitionParams="{{amount: 50, delay: 1000}}">
<span slot="icon">
<PlusCircleOutline class="text-purple-500"/>
</span>
<span slot="text">
Transition type: blur, amount: 50, delay 1000
</span>
</Toast>
Fly examples
Transition type: fly right
Transition type: fly down
<Toast transitionType="fly" transitionParams="{{x: 200}}" iconColor="green">
<span slot="icon">
<ArchiveSolid class="text-green-500"/>
</span>
<span slot="text">
Transition type: fly right
</span>
</Toast>
<Toast transitionType="fly" transitionParams="{{y: 200}}" iconColor="green">
<span slot="icon">
<ArchiveSolid class="text-green-500"/>
</span>
<span slot="text">
Transition type: fly down
</span>
</Toast>
Icons
Use any icon components.
<script>
import {Toast} from 'flowbite-svelte'
import {FireIconOutline, CheckCircleIconSolid, PlusCircleIconOutline,ArchiveIconSolid} from 'svelte-heros'
</scrip>
Props
The component has the following props, type, and default values. See types page for type information.
Name | Type | Default |
---|---|---|
iconColor | Colors | 'blue' |
transitionType | TransitionTypes | 'fade' |
transitionParams | TransitionParamTypes | {} |
divClass | string | 'flex items-center w-full max-w-xs p-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800' |
textClass | string | 'ml-3 text-sm font-normal' |
btnClass | string | 'ml-auto -mx-1.5 -my-1.5 bg-white text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700' |