Lewati ke konten

Callout

Kotak admonition note/tip/warning/danger untuk konten long-form.

Penggunaan

Note

This applies to every recent version - no upgrade needed.

Tip

Pass icon="false" to drop the leading icon entirely.

Warning

This changes how the export command behaves - check the migration notes first.

Danger

Running this in production deletes the entire dataset.
vue-html
<SCallout type="tip" title="Tip">
  Pass <code>icon="false"</code> to drop the leading icon entirely.
</SCallout>

type memilih warna aksen sekaligus ikon default - note (default), tip, warning, dan danger, menyamai empat level admonition yang dipakai kebanyakan situs docs. Ia berbagi surface soft dan perlakuan warna semantik milik Alert. Menghover-nya, atau memfokus konten di dalamnya, mengungkapkan border bergaris 2px dalam warna itu. Berbeda dengan Alert, callout tidak memiliki variant/closable - ia dimaksudkan duduk inline dalam prose dan tidak memiliki perilaku dismiss.

Dalam markdown

Setiap komponen Selaras sudah terdaftar secara global di bawah nama berawalan S (panggilan addComponentsDir milik modul ini sendiri, src/module.ts) - berbeda dengan dua komponen enhanced milik Prose, tidak ada lagi yang perlu dihubungkan agar @nuxt/content me-resolve blok ::s-component-name{...} polos langsung ke sana. Prop masuk ke attrs {...} milik blok sendiri; named slot (title di sini) adalah baris #slot-name di dalam blok, konvensi @nuxtjs/mdc sendiri (MDCSlot) - dan body blok sendiri menjadi slot default:

text
::s-callout{type="warning"}
#title
Heads up
This changes how the export command behaves - check the migration notes first.
::

Heads up

This changes how the export command behaves - check the migration notes first.

Pola yang sama berfungsi untuk komponen apa pun yang sudah dikirim, props dan named slot termasuk - bukan hanya dua yang terbukti di sini. Alert, misalnya, berfungsi identik:

text
::s-alert{color="info"}
#title
Heads up
#description
This changes how the export command behaves - check the migration notes first.
::

Heads up

This changes how the export command behaves - check the migration notes first.

Custom :ui

Untuk melihat dengan tepat apa yang akan Anda timpa - kelas default saat ini untuk setiap slot dan varian - berikut adalah file tema Callout itu sendiri:

Theme source "callout" not found

Recipe tema global dan scoped menggunakan ui.callout.

Props

PropTipeDefault
type'note' | 'tip' | 'warning' | 'danger''note'
titlestring-
iconstring | false-
uiPartial<Record<CalloutSlot, string | object>>-

Slots

SlotDeskripsi
titleKonten title kustom, mengoverride prop title
defaultBody callout