Modrinth/docs/components/notifications.md
Geometrically 097a1cc799
Notifications (#52)
* Notifications

* fix docs
2023-05-22 14:33:45 -07:00

47 lines
1.3 KiB
Markdown

# Notifications
<script setup>
import { ref } from "vue";
const notifsContainer = ref(null);
function addNotification(type) {
console.log(notifsContainer);
notifsContainer.value.addNotification({
title: 'Test Notification',
text: 'This is a test! Random number: ' + Math.random(),
type,
});
}
</script>
<DemoContainer>
<Notifications ref="notifsContainer" />
<Button color="primary" @click="addNotification('success')">Success</Button>
<Button color="highlight" @click="addNotification('warn')">Warning</Button>
<Button color="danger" @click="addNotification('error')">Error</Button>
<Button @click="addNotification('info')">Info</Button>
</DemoContainer>
```vue
<script setup>
import { ref } from "vue";
const notifsContainer = ref(null);
function addNotification(type) {
console.log(notifsContainer);
notifsContainer.value.addNotification({
title: 'Test Notification',
text: 'This is a test! Random number: ' + Math.random(),
type,
});
}
</script>
<Notifications ref="notifsContainer" />
<Button color="primary" @click="addNotification('success')">Success</Button>
<Button color="highlight" @click="addNotification('warn')">Warning</Button>
<Button color="danger" @click="addNotification('error')">Error</Button>
<Button @click="addNotification('info')">Info</Button>
```