💧 A customizable jetpack compose dropdown menu with cascade and animations

Overview

Dropdown

💧 A customizable jetpack compose dropdown menu with cascade and animations.

Google

License Profile


Who's using Dropdown?

👉 Check out who's using Dropdown

Include in your project

Maven Central

Gradle

Add the dependency below to your module's build.gradle file:

dependencies {
    implementation("io.github.androidpoet:dropdown:1.0.0")
}

Create Menu Builder

Create an instance of the Menu Builder.

	    
fun getMenu(): MenuItem<String> {
  val menu = dropDownMenu<String> {
    item("about", "About") {
      icon(Icons.TwoTone.Language)
    }
    item("copy", "Copy") {
      icon(Icons.TwoTone.FileCopy)
    }
    item("share", "Share") {
      icon(Icons.TwoTone.Share)
      item("to_clipboard", "To clipboard") {
        item("pdf", "PDF")
        item("epub", "EPUB")
        item("web_page", "Web page")
        item("microsoft_word", "Microsoft word")
      }
      item("as_a_file", "As a file") {
        item("pdf", "PDF")
        item("epub", "EPUB")
        item("web_page", "Web page")
        item("microsoft_word", "Microsoft word")
      }
    }
    item("remove", "Remove") {
      icon(Icons.TwoTone.DeleteSweep)
      item("yep", "Yep") {
        icon(Icons.TwoTone.Done)
      }
      item("go_back", "Go back") {
        icon(Icons.TwoTone.Close)
      }
    }
  }
  return menu
}
	  
	  

Create Dropdown menu

Create an instance of the Dropdown menu.

@ExperimentalAnimationApi
@Composable
fun Menu(isOpen: Boolean = false, setIsOpen: (Boolean) -> Unit, itemSelected: (String) -> Unit) {
  val menu = getMenu()
  Dropdown(

    isOpen = isOpen,
    menu = menu,
    colors = dropDownMenuColors(Teal200, White),
    onItemSelected = itemSelected,
    onDismiss = { setIsOpen(false) },
    offset = DpOffset(8.dp, 0.dp),
    enter = EnterAnimation.ElevationScale,
    exit = ExitAnimation.ElevationScale,
    easing = Easing.FastOutSlowInEasing,
    enterDuration = 400,
    exitDuration = 400

  )
}	  

  

Supported Animations

Enter Animations

 EnterAnimation.FadeIn
 EnterAnimation.SharedAxisXForward
 EnterAnimation.SharedAxisYForward
 EnterAnimation.SharedAxisZForward
 EnterAnimation.ElevationScale
 EnterAnimation.SlideIn
 EnterAnimation.SlideInHorizontally
 EnterAnimation.SlideInVertically
 EnterAnimation.ScaleIn
 EnterAnimation.ExpandIn
 EnterAnimation.ExpandHorizontally
 EnterAnimation.ExpandVertically

Exit Animations

 ExitAnimation.FadeOut
 ExitAnimation.SharedAxisXBackward
 ExitAnimation.SharedAxisYBackward
 ExitAnimation.SharedAxisZBackward
 ExitAnimation.ElevationScale
 ExitAnimation.SlideOut
 ExitAnimation.SlideOutHorizontally
 ExitAnimation.SlideOutVertically
 ExitAnimation.ScaleOut
 ExitAnimation.ShrinkOut
 ExitAnimation.ShrinkHorizontally
 ExitAnimation.ShrinkVertically

Easing

 Easing.FastOutSlowInEasing
 Easing.LinearOutSlowInEasing
 Easing.FastOutLinearInEasing
 Easing.LinearEasing

Inspiration

This library was heavily inspired by ComposeCookBook.

A Collection on all Jetpack compose UI elements, Layouts, Widgets and Demo screens to see it's potential.

List icons created by Freepik - Flaticon

Find this repository useful? ❤️

Support it by joining stargazers for this repository.
Also, follow me on GitHub for cool projects! 🤩

License

Copyright 2022 AndroidPoet (Ranbir Singh)

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.
You might also like...
A menu consisting of icons (ImageViews) and metaball bouncing selection to give a blob effect. Inspired by Material design

Metaball-Menu A menu consisting of icons (ImageViews) and metaball bouncing selection to give a blob effect. Inspired by Material design ScreenShot Us

An Android Library that allows users to pull down a menu and select different actions. It can be implemented inside ScrollView, GridView, ListView.
An Android Library that allows users to pull down a menu and select different actions. It can be implemented inside ScrollView, GridView, ListView.

AndroidPullMenu AndroidPullMenu is an Open Source Android library that allows developers to easily create applications with pull menu. The aim of this

an animated circular menu for Android
an animated circular menu for Android

CircularFloatingActionMenu An animated, customizable circular floating menu for Android, inspired by Path app. Getting Started Requirements API = 15

Side menu with some categories to choose.
Side menu with some categories to choose.

Side Menu Side menu with some categories to choose. Check this project on dribbble. Check this project on Behance. God bless Ukraine! Sample Sample &

You can easily add awesome animated context menu to your app.
You can easily add awesome animated context menu to your app.

ContextMenu You can easily add awesome animated context menu to your app. Check this project on dribbble Check this project on Behance Usage: For a wo

A menu which can ... BOOM! - Android
A menu which can ... BOOM! - Android

BoomMenu 2.0.0 Comes Finally Approximately 8 months ago, I got an inspiration to creating something that can boom and show menu, which I named it Boom

** A slide-out menu implementation, which allows users to navigate between views in your app.

MenuDrawer A slide-out menu implementation, which allows users to navigate between views in your app. Most commonly the menu is revealed by either dra

Android Satellite Menu
Android Satellite Menu

#Satellite Menu 'Path' has a very attractive menu sitting on the left bottom corner of the screen. Satellite Menu is the open version of this menu. Fo

An android custom view which looks like the menu in Path 2.0 (for iOS).

ArcMenu & RayMenu ArcMenu An android custom view which looks like the menu in Path 2.0 (for iOS). RayMenu About The user experience in Path 2.0 (for i

Comments
  • Update dependencies.gradle

    Update dependencies.gradle

    Can we decrease min Sdk to 21. Can not use this library in projects which supports 21 sdk devices.

    First time contributing to AndroidPoet/Dropdown? If you know how to fix an issue, consider opening a pull request for it.

    You can read this repository’s contributing guidelines to learn how to open a good pull request.

    opened by sanjeet131 0
Releases(1.0.1)
Owner
Ranbir Singh
Android Developer • Android Poet•Open Source Contributor•Obsessed with Animations. #DevelopWithGoogle
Ranbir Singh
Floating Action Menu for Android. Inspired by the Google Plus floating menu

android-floating-action-menu Floating Action Menu for Android. Inspired by the Google Plus floating menu. Demo Setup The simplest way to use this libr

Alessandro Crugnola 242 Nov 10, 2022
Classic Power Menu is a Power Menu Replacement for Android 11+

Classic Power Menu is a Power Menu Replacement for Android 11+, with the main aim being restoring power menu options (Device Controls & Quick Access Wallet) on Android 12.

Kieron Quinn 385 Dec 31, 2022
imitate Tumblr's menu, dragging animations look like a snake

android-snake-menu imitate Tumblr's menu, dragging animations look like a snake unexpected episode I found another repository some time ago which impl

stone 586 Nov 10, 2022
A powerful & customizable menu implementation for android.

A powerful & customizable menu implementation for android. It supports any level of nested menu structures along with custom header and footer views, and much more. Follow the steps below to import the library to your project. You will also find some sample codes.

Nowrose Muhammad Ragib 5 Nov 8, 2022
A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.

AnimatedBottomBar A customizable and easy to use bottom bar view with sleek animations. Examples Playground app Download the playground app from Googl

Joery 1.2k Dec 30, 2022
🎨A Jetpack Compose searchable drop down menu library

Searchable-Dropdown-Menu-Jetpack-Compose ?? A Jetpack Compose Android Library to create a dropdown menu that is searchable. How to include it into you

Breens Robert 30 Dec 26, 2022
:fire: The powerful and easiest way to implement modern material popup menu.

PowerMenu ?? The powerful and easiest way to implement modern material popup menu. PowerMenu can be fully customized and used for popup dialogs. Downl

Jaewoong Eum 1k Dec 29, 2022
Simple and easy to use circular menu widget for Android.

Deprecated This project is no longer maintained. No new issues or pull requests will be accepted. You can still use the source or fork the project to

Anup Cowkur 420 Nov 25, 2022
A multicard menu that can open and close with animation on android

MultiCardMenu A multicard menu that can open and close with animation on android,require API level >= 11 Demo ##Usage <net.wujingchao.android.view.

null 562 Nov 10, 2022