Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AndroidPoet/Dropdown
💧A Powerful and customizable Compose Multiplatform dropdown menu with cascade and animations.
https://github.com/AndroidPoet/Dropdown
android androidpoet dropdown jetpack-compose kotlin material-design material-ui menubar
Last synced: 2 months ago
JSON representation
💧A Powerful and customizable Compose Multiplatform dropdown menu with cascade and animations.
- Host: GitHub
- URL: https://github.com/AndroidPoet/Dropdown
- Owner: AndroidPoet
- Created: 2022-04-25T01:28:25.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-03T16:23:15.000Z (4 months ago)
- Last Synced: 2024-09-18T23:44:57.486Z (4 months ago)
- Topics: android, androidpoet, dropdown, jetpack-compose, kotlin, material-design, material-ui, menubar
- Language: Kotlin
- Homepage: https://androidpoet.github.io/Dropdown/
- Size: 59.2 MB
- Stars: 373
- Watchers: 2
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-list - AndroidPoet/Dropdown - 💧A Powerful and customizable Compose Multiplatform dropdown menu with cascade and animations. (Kotlin)
- jetpack-compose-awesome - Dropdown - A Powerful and customizable Jetpack Compose dropdown menu with cascade and animations (Libraries / UI)
- jetpack-compose-awesome - Dropdown - A Powerful and customizable Jetpack Compose dropdown menu with cascade and animations (Libraries / UI)
README
Dropdown
💧A Powerful and customizable Compose Multiplatform dropdown menu with cascade and animations.
## Who's using Dropdown?
**👉 [Check out who's using Dropdown](/usecases.md)**
## Include in your project
[![Maven Central](https://img.shields.io/maven-central/v/io.github.androidpoet/dropdown.svg?label=Maven%20Central)](https://search.maven.org/artifact/io.github.androidpoet/dropdown)
### Gradle
Add the dependency below to your **module**'s `build.gradle` file:
```gradle
dependencies {
implementation("io.github.androidpoet:dropdown:$version"")
}
```For Kotlin Multiplatform, add the dependency below to your **module**'s `build.gradle.kts` file:
```gradle
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.github.androidpoet:dropdown:$version"")
}
}
}
```
### Create Menu Builder
Create an instance of the `Menu Builder`.
```kotlin
fun getMenu(): MenuItem {
val menu = dropDownMenu {
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`.
```kotlin
@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
```kotlin
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
```kotlin
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
```kotlin
Easing.FastOutSlowInEasing
Easing.LinearOutSlowInEasing
Easing.FastOutLinearInEasing
Easing.LinearEasing
```
| Fade | SharedAxisX | SharedAxisY | SharedAxisZ |
|:---:|:---:|:---:|:---:|
| | | | |
| ElevationScale | SlideIn(SlideOut) | SlideHorizontally | SlideVertically |
| | | | |
| Scale | Expand | Expand Horizontally | Expand Vertically |
| | | | |
List icons created by
Freepik - Flaticon## Find this repository useful? :heart:
Support it by joining __[stargazers](https://github.com/AndroidPoet/Dropdown/stargazers)__ for this
repository. :star:
Also, __[follow me](https://github.com/AndroidPoet)__ on GitHub for more cool projects! 🤩# License
```xml
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 athttp://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.
```