Skip to content

ReturDev/MultiPickers

Repository files navigation


The Multipicker library features a collection of easily implementable composable pickers.

Current pickers:

  • TextPicker
  • NumberPicker
  • TimePicker

Setup 🔧

Gradle KTS

  • Add it in root build.gradle
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {url = uri("https://jitpack.io")}
    }
}
  • Add the dependency
  implementation ("com.github.returdev:multipickers:$version")

Examples 👀

Short Picker

Long Picker

Time Picker

Picker with colorful selection


Implementation ✏️

  • TextPicker

@Composable
fun TextPicker() {
    val textList = listOf("One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten")

    val pickerState = rememberSaveablePickerState(
        itemsCount = textList.size
    )

    TextPicker(items = textList, pickerState = pickerState)

}
  • NumberPicker

@Composable
fun NumberPicker() {
    val numberList = (0..100).toList()
    val pickerState = rememberSaveablePickerState(
        itemsCount = numberList.size,
        pickerLength = PickerLength.Long
    )

   TimePicker(pickerState = pickerState)

}
  • TimePicker

@Composable
fun TimePickerPreview() {

    val pickerState = rememberTimePickerState(
        initialHour = 12,
        initialMinute = 30,
        initialSecond = 0,
        pickerLength = PickerLength.LONG
    )
   NumberPicker(items = numberList, pickerState = pickerState)

}

License 📄

Copyright 2024 ReturDev

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.