Pesan penting di dalam halaman dengan varian info, success, warning, dan danger.
Heads up
Heads up
Heads up
Heads up
Heads up
Heads up
Update available
Payment received
Quota almost full
Could not save
Update available
Payment received
Quota almost full
Could not save
<x-markas.alert variant="info" title="Heads up">You can add components to your app with the CLI.</x-markas.alert><x-markas.alert variant="success" title="Heads up">You can add components to your app with the CLI.</x-markas.alert><x-markas.alert variant="warning" title="Heads up">You can add components to your app with the CLI.</x-markas.alert><x-markas.alert variant="danger" title="Heads up">You can add components to your app with the CLI.</x-markas.alert>import { Alert } from "@/components/markas/Alert";
<Alert variant="info" title="Heads up">You can add components to your app with the CLI.</Alert>import { Alert } from "@/components/markas/Alert";
<Alert variant="success" title="Heads up">You can add components to your app with the CLI.</Alert>import { Alert } from "@/components/markas/Alert";
<Alert variant="warning" title="Heads up">You can add components to your app with the CLI.</Alert>import { Alert } from "@/components/markas/Alert";
<Alert variant="danger" title="Heads up">You can add components to your app with the CLI.</Alert>import Alert from "@/components/markas/Alert.vue";
<Alert variant="info" title="Heads up">You can add components to your app with the CLI.</Alert>import Alert from "@/components/markas/Alert.vue";
<Alert variant="success" title="Heads up">You can add components to your app with the CLI.</Alert>import Alert from "@/components/markas/Alert.vue";
<Alert variant="warning" title="Heads up">You can add components to your app with the CLI.</Alert>import Alert from "@/components/markas/Alert.vue";
<Alert variant="danger" title="Heads up">You can add components to your app with the CLI.</Alert>Contoh
Tanpa judul
<div class="grid gap-3">
<x-markas.alert role="status">Your changes are saved as a draft until you publish.</x-markas.alert>
<x-markas.alert variant="success">Your password has been changed.</x-markas.alert>
<x-markas.alert variant="warning">This link expires in 24 hours.</x-markas.alert>
<x-markas.alert variant="danger">You do not have permission to edit this page.</x-markas.alert>
</div><script lang="ts">
import Alert from "$lib/components/markas/Alert.svelte";
</script>
<div class="grid gap-3">
<Alert role="status">
Your changes are saved as a draft until you publish.
</Alert>
<Alert variant="success">Your password has been changed.</Alert>
<Alert variant="warning">This link expires in 24 hours.</Alert>
<Alert variant="danger">You do not have permission to edit this page.</Alert>
</div>Dengan aksi
Your trial ends in 3 days
Upgrade now to keep access to all of your projects.
Sync failed
We could not reach the server. Your last 2 edits are not saved.
Your trial ends in 3 days
Upgrade now to keep access to all of your projects.
Sync failed
We could not reach the server. Your last 2 edits are not saved.
Your trial ends in 3 days
Upgrade now to keep access to all of your projects.
Sync failed
We could not reach the server. Your last 2 edits are not saved.
Your trial ends in 3 days
Upgrade now to keep access to all of your projects.
Sync failed
We could not reach the server. Your last 2 edits are not saved.
Your trial ends in 3 days
Upgrade now to keep access to all of your projects.
Sync failed
We could not reach the server. Your last 2 edits are not saved.
Daftar error
Please fix 3 errors
- Email address is required.
- Password must be at least 8 characters.
- Accept the terms to continue.
Please fix 3 errors
- Email address is required.
- Password must be at least 8 characters.
- Accept the terms to continue.
Please fix 3 errors
- Email address is required.
- Password must be at least 8 characters.
- Accept the terms to continue.
Please fix 3 errors
- Email address is required.
- Password must be at least 8 characters.
- Accept the terms to continue.
Please fix 3 errors
- Email address is required.
- Password must be at least 8 characters.
- Accept the terms to continue.
<x-markas.alert variant="danger" title="Please fix 3 errors">
<ul class="grid list-disc gap-1 pl-5">
<li>Email address is required.</li>
<li>Password must be at least 8 characters.</li>
<li>Accept the terms to continue.</li>
</ul>
</x-markas.alert><script lang="ts">
import Alert from "$lib/components/markas/Alert.svelte";
</script>
<Alert variant="danger" title="Please fix 3 errors">
<ul class="grid list-disc gap-1 pl-5">
<li>Email address is required.</li>
<li>Password must be at least 8 characters.</li>
<li>Accept the terms to continue.</li>
</ul>
</Alert>---
import Alert from "@/components/markas/Alert.astro";
---
<Alert variant="danger" title="Please fix 3 errors">
<ul class="grid list-disc gap-1 pl-5">
<li>Email address is required.</li>
<li>Password must be at least 8 characters.</li>
<li>Accept the terms to continue.</li>
</ul>
</Alert>Dalam card
Delete workspace
All projects, files, and members will be removed.
This cannot be undone
Delete workspace
All projects, files, and members will be removed.
This cannot be undone
Delete workspace
All projects, files, and members will be removed.
This cannot be undone
Delete workspace
All projects, files, and members will be removed.
This cannot be undone
Delete workspace
All projects, files, and members will be removed.
This cannot be undone
<div class="grid gap-4 rounded-lg border border-line bg-surface p-5">
<div class="grid gap-1">
<h3 class="text-base font-semibold text-ink">Delete workspace</h3>
<p class="text-sm text-muted">All projects, files, and members will be removed.</p>
</div>
<x-markas.alert variant="danger" title="This cannot be undone">Export your data first if you want to keep a copy.</x-markas.alert>
<div class="flex justify-end gap-2">
<x-markas.button variant="secondary">Cancel</x-markas.button>
<x-markas.button variant="danger">Delete workspace</x-markas.button>
</div>
</div>Instalasi
npx markasui@latest add alertpnpm dlx markasui@latest add alertyarn dlx markasui@latest add alertbunx --bun markasui@latest add alert- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
resources/views/components/markas/alert.blade.php.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/Alert.tsx.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/Alert.vue.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/lib/components/markas/Alert.svelte.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/Alert.astro.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/app/markas/alert.component.ts.
Pemakaian
<x-markas.alert title="Pembaruan tersedia" role="status">Versi 2.1 bisa dipasang kapan saja.</x-markas.alert>
<x-markas.alert variant="danger" title="Gagal menyimpan">Periksa koneksi internet lalu coba lagi.</x-markas.alert>import { Alert } from "@/components/markas/Alert";
<Alert title="Pembaruan tersedia" role="status">
Versi 2.1 bisa dipasang kapan saja.
</Alert>
<Alert variant="danger" title="Gagal menyimpan">
Periksa koneksi internet lalu coba lagi.
</Alert><script setup lang="ts">
import Alert from "@/components/markas/Alert.vue";
</script>
<template>
<Alert title="Pembaruan tersedia" role="status">
Versi 2.1 bisa dipasang kapan saja.
</Alert>
<Alert variant="danger" title="Gagal menyimpan">
Periksa koneksi internet lalu coba lagi.
</Alert>
</template><script lang="ts">
import Alert from "$lib/components/markas/Alert.svelte";
</script>
<Alert title="Update available" role="status">
Version 2.1 can be installed at any time.
</Alert>
<Alert variant="danger" title="Could not save">
Check your internet connection and try again.
</Alert>---
import Alert from "@/components/markas/Alert.astro";
---
<Alert title="Update available" role="status">
Version 2.1 can be installed at any time.
</Alert>
<Alert variant="danger" title="Could not save">
Check your internet connection and try again.
</Alert>import { Component } from "@angular/core";
import { Alert } from "./markas/alert.component";
@Component({
selector: "app-status",
imports: [Alert],
template: `
<markas-alert title="Update available" role="status">
Version 2.1 can be installed at any time.
</markas-alert>
<markas-alert variant="danger" title="Could not save">
Check your internet connection and try again.
</markas-alert>
`,
})
export class Status {}- Default
role="alert"langsung dibacakan pembaca layar. Untuk info yang tidak mendesak, isirole="status". - Tanpa JavaScript, jadi versi Blade tidak butuh Alpine.js.
Props
| Nama | Tipe | Default | Keterangan |
|---|---|---|---|
variant | 'info' | 'success' | 'warning' | 'danger' | info | Warna latar, border, dan ikon. |
title | string | - | Judul tebal di atas isi. Isi alert lewat slot atau children. |
role | 'alert' | 'status' | alert | Atribut role native. Pakai status untuk info yang tidak mendesak agar pembaca layar tidak menyela. |
Aksesibilitas
- Default role alert, jadi pembaca layar langsung membacakan alert yang muncul setelah halaman dimuat.
- Isi role status untuk informasi yang tidak mendesak.
- Ikon hanya hiasan (aria-hidden), makna tetap dibawa oleh judul dan teks.
- Judul dan isi memakai warna ink sehingga kontras AA di mode terang dan gelap.
Komponen terkait
Komponen feedback lain dengan class yang sama di setiap framework.
- BadgeLabel status kecil berbentuk pil dengan titik warna untuk neutral, primary, success, warning, dan danger.
- ProgressBilah kemajuan berbasis elemen progress native dengan label, persentase, dan mode tak tentu.
- SkeletonPlaceholder berdenyut untuk konten yang sedang dimuat, ukurannya diatur lewat class.
- ToastNotifikasi singkat di pojok kanan bawah yang hilang sendiri, dipicu lewat fungsi toast() atau event.