For sub-menus, cascade will automatically navigate back when their title is clicked. For manual navigation, CascadeState#navigateBack() can be used.
+
valstate=rememberCascadeState()
+CascadeDropdownMenu(
+state=state,
+…
+){
+DropdownMenuItem(
+text={Text("Remove")},
+childrenHeader={
+// childrenHeader is an optional parameter. If you don't provide one, cascade
+// will automatically use the text composable ("Remove" in this example).
+DropdownMenuHeader{Text("Are you sure?")}
+},
+children={
+DropdownMenuItem(
+text={Text("Burn them all")},
+onClick={…}
+)
+DropdownMenuItem(
+text={Text("Take me back")},
+onClick={state.navigateBack()}
+)
+},
+)
+}
+
Because cascade reuses the same components as DropdownMenu, you can follow the
+official material3 documentation for theming menus and expect the
+specs to work with cascade.
cascade builds nested popup menus with smooth height animations. It is designed to be a drop-in replacement for both PopupMenu and DropdownMenu, so using it in your project is beautifully only a word away. Try out the sample app to see it in action.
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/overrides/main.html b/overrides/main.html
new file mode 100644
index 0000000..e2a1603
--- /dev/null
+++ b/overrides/main.html
@@ -0,0 +1,17 @@
+{% extends "base.html" %}
+
+{% block extrahead %}
+
+{% if page and page.meta and page.meta.title %}
+
+{% elif page and page.title and not page.is_homepage %}
+
+{% else %}
+
+{% endif %}
+
+
+
+
+
+{% endblock %}
diff --git a/search/search_index.json b/search/search_index.json
new file mode 100644
index 0000000..330fa03
--- /dev/null
+++ b/search/search_index.json
@@ -0,0 +1 @@
+{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"cascade","text":"
cascade builds nested popup menus with smooth height animations. It is designed to be a drop-in replacement for both PopupMenu and DropdownMenu, so using it in your project is beautifully only a word away. Try out the sample app to see it in action.
For sub-menus, cascade will automatically navigate back when their title is clicked. For manual navigation, CascadeState#navigateBack() can be used.
val state = rememberCascadeState()\nCascadeDropdownMenu(\nstate = state, \u2026\n) {\nDropdownMenuItem(\ntext = { Text(\"Remove\") },\nchildrenHeader = {\n// childrenHeader is an optional parameter. If you don't provide one, cascade\n// will automatically use the text composable (\"Remove\" in this example).\nDropdownMenuHeader { Text(\"Are you sure?\") }\n},\nchildren = {\nDropdownMenuItem(\ntext = { Text(\"Burn them all\") },\nonClick = { \u2026 }\n)\nDropdownMenuItem(\ntext = { Text(\"Take me back\") },\nonClick = { state.navigateBack() }\n)\n},\n)\n}\n
Because cascade reuses the same components as DropdownMenu, you can follow the official material3 documentation for theming menus and expect the specs to work with cascade.
"},{"location":"compose/theming/#cascadedropdownmenu","title":"CascadeDropdownMenu","text":"Design attribute Theme token Shape MaterialTheme.shapes.extraSmall Background color MaterialTheme.colorScheme.surface"},{"location":"compose/theming/#dropdownmenuheader","title":"DropdownMenuHeader","text":"Design attribute Theme token Content color LocalContentColor with 60% opacity Text style MaterialTheme.typography.labelLarge with 90% font size and letter spacing"},{"location":"compose/theming/#dropdownmenuitem","title":"DropdownMenuItem","text":"Design attribute Theme token Icon size 24dp minimum Colors MenuItemColors Text style MaterialTheme.typography.labelLarge"},{"location":"views/","title":"cascade","text":"
cascade offers a drop-in replacement for PopupMenu. For guidance on creating & nesting menus, the official documentation can be followed while replacing any usages of PopupMenu with CascadePopupMenu.
- val popup = PopupMenu(context, anchor)\n+ val popup = CascadePopupMenu(context, anchor)\n popup.inflate(R.menu.nicolas_cage_movies)\n popup.show()\n
"},{"location":"views/#consistency-with-toolbars-overflow-menu","title":"Consistency with Toolbar's overflow menu","text":"
Toolbar uses PopupMenu for showing overflow menu without offering any way to change this. If you're replacing all PopupMenu usages in your project with cascade, there are a few ways you could achieve consistency by forcing Toolbar to use cascade:
The safest way is to extract out your toolbar menu items with app:showAsAction=\"ifRoom\" into their own menu that is shown using cascade manually.
Alternatively, cascade offers an override using reflection but is currently incompatible with Proguard:
toolbar.overrideAllPopupMenus { context, anchor ->\nCascadePopupMenu(context, anchor)\n}\n// The lambda can be collapsed into a reference\n// if you're only using the two-param constructor.\ntoolbar.overrideAllPopupMenus(with = ::CascadePopupMenu)\n
cascade was originally inspired by Google Drive's 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 customMenuView: View = \u2026\nval popup = CascadePopupWindow(context)\npopup.contentView.addView(customMenuView) // Also see contentView.goBack().\npopup.show(anchor)\n
I really like Google Drive's popup menu that smoothly animates between sub-menus. Is there any existing library that recreates this? pic.twitter.com/bnalL56pcR
\u2014 Saket Narayan (@saketme) October 5, 2020"},{"location":"views/navigation/","title":"Navigation","text":"
For sub-menus, cascade will automatically navigate back when their title is clicked. For manual navigation, cascade provides a back navigator:
val popup = CascadePopupMenu(context, anchor)\npopup.menu.addSubMenu(\"Remove\").also {\nit.setHeaderTitle(\"Are you sure?\")\nit.add(\"Burn them all\")\nit.add(\"Take me back\").setOnMenuItemClickListener {\npopup.navigateBack()\n}\n}\n
You can also provide your own back navigator. This injection is useful if a navigator is needed before an instance of cascade can be created.
val backNavigator = CascadeBackNavigator()\nCascadePopupMenu(context, anchor, backNavigator)\n
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).
cascade was originally inspired by Google Drive's 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.
+
valcustomMenuView:View=…
+
+valpopup=CascadePopupWindow(context)
+popup.contentView.addView(customMenuView)// Also see contentView.goBack().
+popup.show(anchor)
+
+
I really like Google Drive's popup menu that smoothly animates between sub-menus. Is there any existing library that recreates this? pic.twitter.com/bnalL56pcR
cascade offers a drop-in replacement for PopupMenu. For guidance on creating & nesting menus, the official documentation can be followed while replacing any usages of PopupMenu with CascadePopupMenu.
+
implementation"me.saket.cascade:cascade:2.3.0"
+
+
- val popup = PopupMenu(context, anchor)
++ val popup = CascadePopupMenu(context, anchor)
+ popup.inflate(R.menu.nicolas_cage_movies)
+ popup.show()
+
Toolbar uses PopupMenu for showing overflow menu without offering any way to change this. If you're replacing all PopupMenu usages in your project with cascade, there are a few ways you could achieve consistency by forcing Toolbar to use cascade:
+
+
+
The safest way is to extract out your toolbar menu items with app:showAsAction="ifRoom" into their own menu that is shown using cascade manually.
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)
+
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).