0.2.2 β€’ Published 20 days ago

tabbed-macos-modal v0.2.2

Weekly downloads
-
License
-
Repository
github
Last release
20 days ago

Tabbed MacOS-Like Modal

Tabbed MacOS-Like Modal is a Vue 3 plugin for creating modals like MacOS Settings App

tabbed macos-like modal

Installation

Use the npm to install

npm i tabbed-macos-modal

Register globally

import TabbedModal from 'tabbed-macos-modal'
import 'tabbed-macos-modal/dist/style.css'

const app = createApp(...)

app.use(TabbedModal)

Or register locally

import { TabbedModal, TabbedModalItem } from 'tabbed-macos-modal'
import 'tabbed-macos-modal/dist/style.css'

Usage

<TabbedModal 
  ref="modal" 
  title="Settings" 
  sidebar-search
  v-if="showModal" 
  @close="showModal = false"
>
  <!-- <template #title>
    custom title 🌍
  </template> -->
  <!-- <template #sidebar>
    <span class="my-custom-tab" @click="modal.goto('main', true)">To Main tab 😱</span>
    <span class="my-custom-tab" @click="modal.goto('modifications', true)">To Modifications</span>
    <span class="my-custom-tab" @click="modal.goto('childModificationsDeep2')">To childModificationsDeep1 πŸ‘½</span>
  </template> -->
  <!-- <template #closeIcon>
      close button here πŸ‘€
  </template> -->

  content here...
  
  <TabbedModalItem name="main" title="Main tab">
    <a href="#" @click="modal.goto('childModificationsDeep2')">-> childModificationsDeep2 tab</a>
    content here...
    <template #footer>
      ITEMFOOTER
    </template>
  </TabbedModalItem> 

  <TabbedModalItem name="products" title="Products">
    <template #header>
      <span class="custom-header">
        my custom header πŸ‘½πŸ‘½πŸ‘½
      </span>
    </template>

    content here...

    <template #footer>
      ITEMFOOTER
    </template>
  </TabbedModalItem>

  <TabbedModalItem name="modifications" head-title="modifications head title πŸ‘‹">
    gogi
    <a href="#" @click="modal.goto('childModifications')">-> childModifications</a>

    <TabbedModalItem name="childModifications" title="Modification Items" @goback="console.log('go back!')">
      I'M childModifications

      <!-- example of dynamic height calculation feature, check in mobile mode! -->
      <button class="button" @click="displayImage = !displayImage">click me</button>

      <img src="/defend.jpg">

      <a href="#" @click="modal.goto('childModificationsDeep1')">-> childModificationsDeep1</a>
      <a href="#" @click="modal.goto('childModificationsDeep2')">-> childModificationsDeep2</a>

      <div class="test" v-if="displayImage">
        dynamic content...
      </div>

      <div class="beautiful-block" v-if="!displayImage" style="width: 50px; height: 50px; background-color: red;"></div>

      <TabbedModalItem name="childModificationsDeep1" ref="childModificationsDeep1Ref" @goback="console.log('childModificationsDeep1')">
        I'M childModificationsDeep1
        <template #footer>
          <button @click="childModificationsDeep1Ref.goBack()">save and go back</button>
          <button @click="modal.goto('products', true)">go to products</button>
        </template>
      </TabbedModalItem>

      <TabbedModalItem name="childModificationsDeep2">
        I'M childModificationsDeep1
      </TabbedModalItem>
    </TabbedModalItem>

  </TabbedModalItem>
  <TabbedModalItem name="composition" title="Composition" head-title="test head title">
    content here
    <template #footer>
      composition footer
    </template>
  </TabbedModalItem>

  <template #mainFooter>
    MAIN FOOTER
  </template>
</TabbedModal>

TabbedModal Props (See example in src/App.vue)

PropTypeDescriptionDefault
titlestringtitle for modal (top left corner)Default Title
sectionsModebooleanif true, then on mobile looks like iOS settings app, otherwise sidebar tabs will be horizontally scrollabletrue
openFirstSectionbooleanIf true and sectionsMode is also set to true, then on mobile, when modal is open, content of the first modalItem will be displayedtrue
sidebarSearchbooleanenables search in sidebar for tabstrue
searchPlaceholderstringPlaceholder for sidebar search inputSearch…
needCloseIconbooleanenables close icon (top right corner)true
sidebarWidthNumber, StringSets sidebar width (will not work if dynamic sidebar width is enabled)180
dynamicSidebarWidthbooleanIf enabled, sidebar width will be based on length of longest item in sidebarfalse
maxDynamicSidebarWidthNumber, StringSets max width for tabs in sidebar if dynamicSidebarWidth is enabled. If width of tabs is greater, then text will be wrapped320
needFooterbooleanEnables or disables footertrue
simplebooleanif true, then sidebar is disabled and content inside modal parent component will be displayedfalse
panDesktopbooleanEnables or disables pan on desktopfalse
panMobilebooleanEnables or disables pan on mobiletrue
heightNumber, StringSets height for modal600
fixedHeightbooleanIf true, then height prop will be set as max height for modal and on mobile dynamic height calculation will be disabledfalse
contentWidthNumber, StringSets content for modalItem content. On mobile content width is set to 100%520

TabbedModalItem Props (See example in src/App.vue)

PropTypeDescriptionDefault
name *stringName for component. This prop is used for navigation between props (see example).* required
titlestringWill be displayed in header contentnull
headTitlestringtitle for content head. If set together with title, then title will be displayed in sidebar and headTitle will be in header contentnull

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

0.2.2

20 days ago

0.2.1

22 days ago

0.2.0

3 months ago

0.1.9

3 months ago

0.1.8

3 months ago

0.1.7

3 months ago

0.1.6

3 months ago

0.1.5

3 months ago

0.1.4

3 months ago

0.1.2

3 months ago

0.1.1

3 months ago

0.1.0

3 months ago

0.0.9

3 months ago

0.0.8

3 months ago

0.0.7

3 months ago

0.0.6

3 months ago

0.0.5

3 months ago

0.0.4

3 months ago

0.0.3

3 months ago

0.0.2

3 months ago

0.0.1

3 months ago

0.0.0

3 months ago