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.
There are following components included:
Dialog
- dialog elementDialogButton
- dialog button elementName | Type | Default | Description |
---|---|---|---|
backdrop | boolean | true | Enables Popup backdrop (dark semi transparent layer behind) |
buttons | string | Dialog buttons content | |
colors | object | Object with Tailwind CSS colors classes | |
colors.bgIos | string | 'bg-white dark:bg-neutral-800' | Dialog bg color in iOS theme |
colors.bgMaterial | string | 'bg-md-light-surface-3 dark:bg-md-dark-surface-3' | Dialog bg color in iOS theme |
colors.contentTextIos | string | '' | Content text color in iOS theme |
colors.contentTextMaterial | string | 'text-md-light-on-surface-variant dark:text-md-dark-on-surface-variant' | Content text color in Material theme |
colors.titleIos | string | '' | Title text color in iOS theme |
colors.titleMaterial | string | 'text-md-light-on-surface dark:text-md-dark-on-surface' | Title text color in Material theme |
component | string | 'div' | Component's HTML Element |
content | string | Dialog main content | |
opened | boolean | false | Allows to open/close Popup and set its initial state |
sizeIos | string | 'w-[16.875rem]' | Tailwind CSS size classes for iOS theme |
sizeMaterial | string | 'w-[19.5rem]' | Tailwind CSS size classes for Material theme |
title | string | Dialog title content | |
titleFontSizeIos | string | 'text-[18px]' | Tailwind CSS classes for title font size iOS theme |
titleFontSizeMaterial | string | 'text-[24px]' | Tailwind CSS classes for title font size Material theme |
translucent | boolean | true | Makes Dialog background translucent (with |
Name | Type | Default | Description |
---|---|---|---|
colors | object | Object with Tailwind CSS colors classes | |
colors.activeBgIos | string | 'active:bg-black active:bg-opacity-10 dark:active:bg-white dark:active:bg-opacity-10' | Active/pressed state bg color in iOS theme |
colors.disabledTextIos | string | 'text-black text-opacity-30 dark:text-white dark:text-opacity-30' | Disabled button text color in iOS theme |
colors.textIos | string | ''text-primary | Text color in iOS theme |
component | string | 'button' | Component's HTML Element |
disabled | boolean | false | Makes button disabled |
strong | boolean | false | Makes button bold in iOS theme and fill in Material theme, overwrites |
strongIos | boolean | false | Makes button bold in iOS theme |
strongMaterial | boolean | false | Makes button fill in Material theme |
Name | Description |
---|---|
buttons | Dialog buttons content |
content | Dialog main content |
title | Dialog title content |
<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 toprovide 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 toprovide 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-radiocomponent="div"value="batman":checked="radioValue === 'batman'"@change="() => (radioValue = 'batman')"/></template></k-list-item><k-list-item label title="Spider-man"><template #after><k-radiocomponent="div"value="spiderman":checked="radioValue === 'spiderman'"@change="() => (radioValue = 'spiderman')"/></template></k-list-item><k-list-item label title="Hulk"><template #after><k-radiocomponent="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>