All Projects → saket → Cascade

saket / Cascade

Licence: apache-2.0
Nested popup menus with smooth height animations

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Cascade

nativescript-menu
A plugin that adds a pop-up menu to NativeScript
Stars: ✭ 17 (-98.86%)
Mutual labels:  popup, menu
Customalertviewdialogue
Custom AlertView Dialogue is the world's most advanced alert view library. Custom AlertView Dialogue includes simple message popups, confirmation alerts, selector popups, action sheet bottom menus, and input/feedback contact forms.
Stars: ✭ 100 (-93.3%)
Mutual labels:  menu, popup
Menu
The most customizable menu for macOS apps.
Stars: ✭ 84 (-94.37%)
Mutual labels:  popup, menu
Selectmenu
Simple, easily and diversity menu solution
Stars: ✭ 284 (-80.98%)
Mutual labels:  menu, popup
Fepopupmenucontroller
A simple, elegant pop-up menu view
Stars: ✭ 32 (-97.86%)
Mutual labels:  menu, popup
Dropdownmenukit
UIKit drop down menu, simple yet flexible and written in Swift
Stars: ✭ 246 (-83.52%)
Mutual labels:  menu, popup
Vc Popup
一个行为标准的vue popup组件集
Stars: ✭ 289 (-80.64%)
Mutual labels:  menu, popup
Material Ui Popup State
boilerplate for common Material-UI Menu, Popover and Popper use cases
Stars: ✭ 186 (-87.54%)
Mutual labels:  menu, popup
Ybpopupmenu
快速集成popupMenu
Stars: ✭ 816 (-45.34%)
Mutual labels:  menu, popup
Anylayer
Android稳定高效的浮层创建管理框架
Stars: ✭ 745 (-50.1%)
Mutual labels:  menu, popup
Fwpopupview
弹窗控件:支持AlertView、Sheet、自定义视图的PopupView。AlertView中可以嵌套自定义视图,各组件的显示隐藏可配置;Sheet仿微信样式;同时提供自定义弹出。更多配置请参考”可设置参数“,提供OC使用Demo。
Stars: ✭ 361 (-75.82%)
Mutual labels:  menu, popup
Fwpopupviewoc
信手拈来的OC弹窗库:1、继承 FWPopupBaseView 即可轻松实现各种位置、动画类型的弹窗;2、新功能引导弹窗。更多弹窗场景等你来挑战,总之,想怎么弹就怎么弹!!!
Stars: ✭ 70 (-95.31%)
Mutual labels:  menu, popup
Electron Tray Window
🖼️ Generates custom tray windows with Electron.js
Stars: ✭ 71 (-95.24%)
Mutual labels:  menu, popup
Tippyjs
Tooltip, popover, dropdown, and menu library
Stars: ✭ 9,433 (+531.82%)
Mutual labels:  menu, popup
Jbox
jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.
Stars: ✭ 1,251 (-16.21%)
Mutual labels:  popup
Mbpopup
macOS status bar popups done right 😎
Stars: ✭ 89 (-94.04%)
Mutual labels:  popup
Ngcontextmenu
Handcraft your very own context menus for a richer UX!
Stars: ✭ 81 (-94.57%)
Mutual labels:  menu
Alertjs
Dialog Builder allows you to create fully customisable dialogs and popups in Dynamics 365.
Stars: ✭ 80 (-94.64%)
Mutual labels:  popup
Bmenu
A general purpose terminal menu that focuses on ease of configuration and use.
Stars: ✭ 94 (-93.7%)
Mutual labels:  menu
Discord.js Menu
💬 Easily create Discord.js v12 embed menus with reactions and unlimited customizable pages.
Stars: ✭ 89 (-94.04%)
Mutual labels:  menu

cascade

demo

cascade builds nested popup menus with smooth height animations. It is designed to be a drop-in replacement for PopupMenu so using it in your project is beautifully only a word away. Try out the sample app to see it in action.

implementation "me.saket.cascade:cascade:1.3.0"
- val popup = PopupMenu(context, anchor)
+ val popup = CascadePopupMenu(context, anchor)
  popup.inflate(R.menu.nicolas_cage_movies)
  popup.show()

Use as Toolbar's overflow menu

toolbar.overrideAllPopupMenus { context, anchor ->
  CascadePopupMenu(context, anchor)
}

// The lambda can be collapsed into a reference
// if you're only using the two-param constructor.
toolbar.overrideAllPopupMenus(with = ::CascadePopupMenu)

Customization

cascade is great for apps that prefer applying dynamic themes at runtime, which PopupMenu makes it extremely hard to do so. By providing a CascadePopupMenu.Styler object, you can adjust colors, spacings and text styles from Kotlin (example).

CascadePopupMenu(context, anchor, styler = CascadePopupMenu.Styler(...))

By default, cascade will pick up values from your theme in the same way as PopupMenu would.

<style name="AppTheme">
  <item name="popupMenuStyle">@style/PopupMenuStyle</item>
  <item name="colorControlNormal">@color/menu_icon_color</item>
  <item name="android:textColorPrimary">@color/menu_item_text_color</item>
  <item name="android:textColorSecondary">@color/menu_title_text_color</item>
</style>

<style name="PopupMenuStyle" parent="@style/Widget.AppCompat.PopupMenu">
  <item name="android:popupBackground">...</item>
  <item name="android:popupElevation">...</item>
</style>

Navigation

For sub-menus, cascade will automatically navigate to the parent menu when the title is clicked. For manual navigation, CascadePopupMenu#navigateBack() or CascadeBackNavigator can be used.

popup.menu.addSubMenu("Remove").also {
  it.setHeaderTitle("Are you sure?")
  it.add("Burn them all")
  it.add("Take me back").setOnMenuItemClickListener {
    popup.navigateBack()
  }
}

Custom layouts

cascade was originally inspired by Google Drive's menu that uses a variety of complex controls. For apps that want to create something similar, a batteries-included CascadePopupWindow is provided for use with custom layouts.

val popup = CascadePopupWindow(context)
popup.contentView.addView(CustomMenuView(context))  // Also see contentView.goBack().
popup.show(anchor)

License

Copyright 2020 Saket Narayan.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].