Skip to content

Toast

It is not bread. It is toast.

Example

Basic

Show Code
vue
<script lang="ts" setup>
import { RButton, RToast } from 'roughness'
import { ref } from 'vue'

let open = ref(false)

function toggle() {
  open.value = !open.value
}
</script>

<template>
  <RButton @click="toggle">Toggle</RButton>
  <RToast v-model:open="open">Clunk!</RToast>
</template>
Clunk!

Composition

Show Code
vue
<script lang="ts" setup>
import { RToastProvider } from 'roughness'
</script>

<template>
  <RToastProvider>
    <App />
  </RToastProvider>
</template>
vue
<script lang="ts" setup>
import { useToast } from 'roughness'

const toast = useToast()

function add() {
  toast('Yummy!', {
    type: ['primary', 'info', 'success', 'warning', 'error', 'comment'][Math.floor(Math.random() * 6)],
  })
}
</script>

<template>
  <RButton @click="add">Add</RButton>
</template>

Usage

Props

NameTypeDefault ValueDescription
duration
graphicsOptions
open
size
type

Events

NameTypeDescription
update:open

Slots

NameTypeDescription
default

Styles

NameTypeDefault ValueDescription
--r-toast-color

ToastProvider Slots

NameTypeDescription
default

ToastProvider Styles

NameTypeDefault ValueDescription
--r-toast-provider-base-size
--r-toast-provider-gap-size

Released under the ISC License.