🔥 新しいプロジェクトをご紹介 t0ggles - 究極のプロジェクト管理ツール! 🔥

ダイアログ Vue コンポーネント

ダイアログは、アプリコンテンツの前面に表示され、重要な情報を提供したり、意思決定を促したりするモーダルウィンドウの一種です。

ダイアログコンポーネント

以下のコンポーネントが含まれています

  • Dialog - ダイアログ要素
  • DialogButton - ダイアログボタン要素

ダイアログプロパティ

名前タイプデフォルト説明
backdropbooleantrue

ポップアップの背景(背後の暗い半透明のレイヤー)を有効にします

buttonsstring

ダイアログボタンのコンテンツ

colorsobject

Tailwind CSSの色のクラスを持つオブジェクト

colors.bgIosstring'bg-white dark:bg-neutral-800'

iOSテーマでのダイアログの背景色

colors.bgMaterialstring'bg-md-light-surface-3 dark:bg-md-dark-surface-3'

iOSテーマでのダイアログの背景色

colors.contentTextIosstring''

iOSテーマでのコンテンツテキストの色

colors.contentTextMaterialstring'text-md-light-on-surface-variant dark:text-md-dark-on-surface-variant'

Materialテーマでのコンテンツテキストの色

colors.titleIosstring''

iOSテーマでのタイトルのテキスト色

colors.titleMaterialstring'text-md-light-on-surface dark:text-md-dark-on-surface'

Materialテーマでのタイトルのテキスト色

componentstring'div'

コンポーネントのHTML要素

contentstring

ダイアログのメインコンテンツ

openedbooleanfalse

ポップアップを開閉し、初期状態を設定できます

sizeIosstring'w-[16.875rem]'

iOSテーマ用のTailwind CSSサイズクラス

sizeMaterialstring'w-[19.5rem]'

Materialテーマ用のTailwind CSSサイズクラス

titlestring

ダイアログのタイトルコンテンツ

titleFontSizeIosstring'text-[18px]'

iOSテーマのタイトルのフォントサイズ用のTailwind CSSクラス

titleFontSizeMaterialstring'text-[24px]'

Materialテーマのタイトルのフォントサイズ用のTailwind CSSクラス

translucentbooleantrue

iOSテーマでダイアログの背景を半透明にします(backdrop-filter: blurを使用)

DialogButton プロパティ

名前タイプデフォルト説明
colorsobject

Tailwind CSSの色のクラスを持つオブジェクト

colors.activeBgIosstring'active:bg-black active:bg-opacity-10 dark:active:bg-white dark:active:bg-opacity-10'

iOSテーマでのアクティブ/押された状態の背景色

colors.disabledTextIosstring'text-black text-opacity-30 dark:text-white dark:text-opacity-30'

iOSテーマでの無効なボタンのテキスト色

colors.textIosstring''text-primary

iOSテーマでのテキスト色

componentstring'button'

コンポーネントのHTML要素

disabledbooleanfalse

ボタンを無効にします

strongbooleanfalse

iOSテーマでボタンを太字にし、Materialテーマで塗りつぶします。strongIosおよびstrongMaterialを上書きします

strongIosbooleanfalse

iOSテーマでボタンを太字にします

strongMaterialbooleanfalse

Materialテーマでボタンを塗りつぶします

ダイアログスロット

名前説明
buttons

ダイアログボタンのコンテンツ

content

ダイアログのメインコンテンツ

title

ダイアログのタイトルコンテンツ

Dialog.vue
<template>
<k-page>
<k-navbar title="Dialog" />
<k-block strong inset class="space-y-4">
<p>
Dialog is a type of modal window that appears in front of app content to
provide critical information, or prompt for a decision to be made.
</p>
</k-block>
<k-block strong inset>
<p class="grid grid-cols-2 md:grid-cols-4 gap-4">
<k-button rounded @click="() => (basicOpened = true)">Basic</k-button>
<k-button rounded @click="() => (alertOpened = true)">Alert</k-button>
<k-button rounded @click="() => (confirmOpened = true)"
>Confirm</k-button
>
<k-button rounded @click="() => (listOpened = true)">List</k-button>
</p>
</k-block>
<k-dialog
:opened="basicOpened"
@backdropclick="() => (basicOpened = false)"
>
<template #title>Dialog Title</template>
Dialog is a type of modal window that appears in front of app content to
provide critical information, or prompt for a decision to be made.
<template #buttons>
<k-dialog-button @click="() => (basicOpened = false)">
Action 2
</k-dialog-button>
<k-dialog-button @click="() => (basicOpened = false)">
Action 1
</k-dialog-button>
</template>
</k-dialog>
<k-dialog
:opened="alertOpened"
@backdropclick="() => (alertOpened = false)"
>
<template #title>Konsta UI</template>
Hello world!
<template #buttons>
<k-dialog-button @click="() => (alertOpened = false)"
>Ok</k-dialog-button
>
</template>
</k-dialog>
<k-dialog
:opened="confirmOpened"
@backdropclick="() => (confirmOpened = false)"
>
<template #title>Konsta UI</template>
All good today?
<template #buttons>
<k-dialog-button @click="() => (confirmOpened = false)"
>No</k-dialog-button
>
<k-dialog-button strong @click="() => (confirmOpened = false)">
Yes
</k-dialog-button>
</template>
</k-dialog>
<k-dialog :opened="listOpened" @backdropclick="() => (listOpened = false)">
<template #title>Your super hero</template>
<k-list nested class="-mx-4">
<k-list-item label title="Batman">
<template #after>
<k-radio
component="div"
value="batman"
:checked="radioValue === 'batman'"
@change="() => (radioValue = 'batman')"
/>
</template>
</k-list-item>
<k-list-item label title="Spider-man">
<template #after>
<k-radio
component="div"
value="spiderman"
:checked="radioValue === 'spiderman'"
@change="() => (radioValue = 'spiderman')"
/>
</template>
</k-list-item>
<k-list-item label title="Hulk">
<template #after>
<k-radio
component="div"
value="hulk"
:checked="radioValue === 'hulk'"
@change="() => (radioValue = 'hulk')"
/>
</template>
</k-list-item>
</k-list>
<template #buttons>
<k-dialog-button @click="() => (listOpened = false)"
>Confirm</k-dialog-button
>
</template>
</k-dialog>
</k-page>
</template>
<script>
import { ref } from 'vue';
import {
kPage,
kNavbar,
kNavbarBackLink,
kBlock,
kButton,
kDialog,
kDialogButton,
kList,
kListItem,
kRadio,
} from 'konsta/vue';
export default {
components: {
kPage,
kNavbar,
kNavbarBackLink,
kBlock,
kButton,
kDialog,
kDialogButton,
kList,
kListItem,
kRadio,
},
setup() {
const basicOpened = ref(false);
const alertOpened = ref(false);
const confirmOpened = ref(false);
const listOpened = ref(false);
const radioValue = ref('batman');
return {
basicOpened,
alertOpened,
confirmOpened,
listOpened,
radioValue,
};
},
};
</script>
コードは以下に基づいてライセンスされています MIT.
2022 © Konsta UI by nolimits4web.