Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mcwv/drawer

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcwv/drawer

The Vue Material Adapter for the web drawer component

  • 0.1.0-5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Usage

The mdc-drawer component implements permanent, persistent, and temporary drawers. By default the drawer component is responsive and will switch from temporary to persistent design according to viewport width.

<mdc-drawer v-model="open">
  <mdc-drawer-list>
    <mdc-drawer-item start-icon="inbox">Inbox</mdc-drawer-item>
    <mdc-drawer-item start-icon="send">Sent Mail</mdc-drawer-item>
    <mdc-drawer-item start-icon="drafts">Drafts</mdc-drawer-item>
  </mdc-drawer-list>
</mdc-drawer>

For proper positioning of the drawer, use the mdc-layout-app component.

<mdc-layout-app>
  <mdc-toolbar slot="toolbar" fixed>
    <mdc-toolbar-row>
      <mdc-toolbar-section align-start >
        <mdc-toolbar-menu-icon event="toggle-drawer"></mdc-toolbar-menu-icon>
        <mdc-toolbar-title>Drawer Example</mdc-toolbar-title>
      </mdc-toolbar-section>
    </mdc-toolbar-row>
  </mdc-toolbar>
  <mdc-drawer slot="drawer" toggle-on="toggle-drawer">
    <mdc-drawer-list>
        <mdc-drawer-item start-icon="inbox">Inbox</mdc-drawer-item>
        <mdc-drawer-item start-icon="send">Sent Mail</mdc-drawer-item>
        <mdc-drawer-item start-icon="drafts">Drafts</mdc-drawer-item>
    </mdc-drawer-list>
  </mdc-drawer>
  <main class="content" >
  </main>
</mdc-layout-app>

Drawer

propTypeDefaultDescription
drawer-typeStringundefined'temporary', 'persistent' or 'permanent' (*)
permanentBooleanundefinedshorthand for drawer-type="permanent" (*)
persistentBooleanundefinedshorthand for drawer-type="persistent" (*)
temporaryBooleanundefinedshorthand for drawer-type="temporary" (*)
toolbar-spacerBooleanundefinedadd a toolbar spacer
openBooleanfalseoptional v-model when true opens drawer
toggle-onStringundefinedoptional toggle event to listen on
toggle-on-sourceObjectvm.$rootoptional toggle event source, defaults to root bus
open-onStringundefinedoptional open event to listen on
open-on-sourceObjectvm.$rootoptional open event source, defaults to root bus
close-onStringundefinedoptional close event to listen on
close-on-sourceObjectvm.$rootoptional close event source, defaults to root bus

(*) drawer is responsive if drawer-type undefined: temporary on mobile breakpoint and persistent otherwise.

eventargsDescription
@changeBooleannotify v-model/listeners that drawer state has changed.
@opentriggered on drawer open
@closetriggered on drawer close
@vma:layoutBooleannotify listeners that screen layout has changed.

Drawer Header

propTypeDefaultDescription
permanentBooleanundefinedshow only if drawer is permanent (**)
persistentBooleanundefinedshow only if drawer is persistent (**)
temporaryBooleanundefinedshow only if drawer is temporary (**)

(**) specifies whether or not the header is shown for responsive drawer

Drawer Items

propTypeDefaultDescription
start-iconStringundefinedmaterial start icon
temporary-closeBooleantruewhether temporary drawer closes on click
eventStringundefinedoptional event to emit on click
event-targetObjectvm.$rootoptional event target, defaults to root bus
event-argsArray[]optional event args
toString, Objectundefinedrouter-link property (*)
replaceBooleanfalserouter-link property (*)
appendBooleanfalserouter-link property (*)
exactBooleanfalserouter-link property (*)
active-classStringrouter-link-activerouter-link property (*)
exact-active-classStringrouter-link-exact-activerouter-link property (*)
activatedBooleanundefinedwhether this item is selected (not needed if router-link mode is used)

(*) Requires vue-router If the to property is defined, the item behaves as a router-link

Item usage

  • A simple link
  <mdc-drawer-item href="#">Inbox</mdc-drawer-item>
  • With vue-router
  <mdc-drawer-item  to="/path">Inbox</mdc-drawer-item>
  <mdc-drawer-item  :to='folder' append >Inbox</mdc-drawer-item>

Customize the active links style with vue-router active or exact-active classes:

.mdc-drawer-item.router-link-exact-active {
  color: red;
}
  • Trigger an event
  <mdc-drawer-item event='my-event'>Inbox</mdc-drawer-item>
  • Click handler
  <mdc-drawer-item @click='handler'>Inbox</mdc-drawer-item>
Start Detail
<mdc-drawer>
  <mdc-drawer-list>
    <mdc-drawer-item start-icon="inbox">Inbox</mdc-drawer-item>
    <mdc-drawer-item start-icon="send">Sent Mail</mdc-drawer-item>
    <mdc-drawer-item start-icon="drafts">Drafts</mdc-drawer-item>
    <mdc-drawer-divider />
    <mdc-drawer-item start-icon="email">All mail</mdc-drawer-item>
    <mdc-drawer-item start-icon="delete">Trash</mdc-drawer-item>
    <mdc-drawer-item start-icon="report">Spam</mdc-drawer-item>
  </mdc-drawer-list>
</mdc-drawer>

to override start-icon detail, use start-detail named slot:

<mdc-drawer-item>
  <mdc-icon slot='start-detail' class="fa fa-home"></mdc-icon>
  {{ Text }}
</mdc-drawer-item>

Reference

Keywords

FAQs

Package last updated on 08 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc