Popup is a popup window with any HTML content that pops up over App's main content. Popup as all other overlays is part of so called "Temporary Views".
There are following components included:
Popup
- popup elementName | Type | Default | Description |
---|---|---|---|
backdrop | boolean | true | Enables Popup backdrop (dark semi transparent layer behind) |
colors | object | Object with Tailwind CSS colors classes | |
colors.bg | string | 'bg-white dark:bg-black' | Popup bg color |
component | string | 'div' | Component's HTML Element |
opened | boolean | false | Allows to open/close Popup and set its initial state |
size | string | 'w-screen h-screen md:w-160 md:h-160' | Tailwind CSS size classes |
onBackdropClick | function(e) | Click handler on backdrop element |
import React, { useState } from 'react';import {Page,Navbar,NavbarBackLink,Popup,Block,Link,Button,} from 'konsta/react';export default function PopupPage() {const [popupOpened, setPopupOpened] = useState(false);return (<Page><Navbartitle="Popup"/><Block strong className="space-y-4"><p>Popup is a modal window with any HTML content that pops up over App'smain content. Popup as all other overlays is part of so called"Temporary Views".</p><p><Button onClick={() => setPopupOpened(true)}>Open Popup</Button></p></Block><Popup opened={popupOpened} onBackdropClick={() => setPopupOpened(false)}><Page><Navbartitle="Popup"right={<Link navbar onClick={() => setPopupOpened(false)}>Close</Link>}/><Block className="space-y-4"><p>Here comes popup. You can put here anything, even independent viewwith its own navigation. Also not, that by default popup looks abit different on iPhone/iPod and iPad, on iPhone it is fullscreen.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.Suspendisse faucibus mauris leo, eu bibendum neque congue non. Utleo mauris, eleifend eu commodo a, egestas ac urna. Maecenas inlacus faucibus, viverra ipsum pulvinar, molestie arcu. Etiamlacinia venenatis dignissim. Suspendisse non nisl semper tellusmalesuada suscipit eu et eros. Nulla eu enim quis quam elementumvulputate. Mauris ornare consequat nunc viverra pellentesque.Aenean semper eu massa sit amet aliquam. Integer et neque sedlibero mollis elementum at vitae ligula. Vestibulum pharetra sedlibero sed porttitor. Suspendisse a faucibus lectus.</p><p>Duis ut mauris sollicitudin, venenatis nisi sed, luctus ligula.Phasellus blandit nisl ut lorem semper pharetra. Nullam tortornibh, suscipit in consequat vel, feugiat sed quam. Nam risuslibero, auctor vel tristique ac, malesuada ut ante. Sed molestie,est in eleifend sagittis, leo tortor ullamcorper erat, atvulputate eros sapien nec libero. Mauris dapibus laoreet nibh quisbibendum. Fusce dolor sem, suscipit in iaculis id, pharetra aturna. Pellentesque tempor congue massa quis faucibus. Vestibulumnunc eros, convallis blandit dui sit amet, gravida adipiscinglibero.</p></Block></Page></Popup></Page>);}