GIGAMOLE / ComposeScrollbars

ComposeScrollbars: Polish your Android Compose UI with advanced scrollbars
https://www.linkedin.com/in/gigamole/
MIT License
132 stars 4 forks source link
android android-compose android-library android-ui compose design-tools jetpack-compose kotlin kotlin-android sample-app scroll scrollbar scrollbars

| Setup Guide | Report new issue

ComposeScrollbars

The ComposeScrollbars is a feature-rich Android Compose UI library that seamlessly incorporates customisable scrollbars, including size, animations, background/knob layer style, and scroll behavior, for a seamless UX.

Features:

Sample App

Sample 1 Sample 2 Sample 3
Sample 4 Sample 5 Sample 6

Download or clone this repository to discover the sample app.

Setup

Add to the root build.gradle.kts:

allprojects {
    repositories {
        ...
        maven("https://jitpack.io")
    }
}

Add to the package build.gradle.kts:

dependencies {
    implementation("com.github.GIGAMOLE:ComposeScrollbars:{latest-version}")
}

Latest version: .

Also, it's possible to download the latest artifact from the releases page.

Guide

The ComposeScrollbars comes with the main component: Scrollbars.

For more technical and detailed documentation, read the library KDoc.

Scrollbars

The Scrollbars presents scrollbars based on the provided ScrollbarsState.

Just place it above (Z-order) of your scrollable content so its visible.

ScrollbarsState

The ScrollbarsState consists of two required components: ScrollbarsConfig and ScrollbarsScrollType.

To create a ScrollbarsState, use one of the utility functions: rememberScrollbarsState(...) or make it on your own.

ScrollbarsConfig

The ScrollbarsConfig setups the scrollbars layouts, styles and appearances:

Param Description
orientation The scrollbars orientation: Horizontal or Vertical.
gravity The scrollbars gravity: Start or End.
isReverseLayout The scrollbars reverse layout indicator.
paddingValues The scrollbars layers container padding values.
sizeType The scrollbars layers container size: Full, Fraction or Exact.
layersType The ScrollbarsLayersType.
backgroundLayerContentType The background ScrollbarsLayerContentType.
knobLayerContentType The knob ScrollbarsLayerContentType.
visibilityType The ScrollbarsVisibilityType.
ScrollbarsLayersType

The ScrollbarsLayersType can be one of the following:

Each mode can set layers thickness(Exact or Wrap), padding values, and layer gravity (Start, Center or End).

ScrollbarsLayerContentType

The ScrollbarsLayerContentType can be one of the following:

The Default mode can set the content layer shape, style (Backgrond or Border), color (Idle or IdleActive).

ScrollbarsVisibilityType

The ScrollbarsVisibilityType can be one of the following:

The Dynamic mode can be one of the following:

The Dynamic mode can the following UX utility params:

ScrollbarsScrollType

The ScrollbarsScrollType can be one of the following:

The Lazy.List and Lazy.Grid supports the scrollbars for Static or Dynamic items heights.

The Lazy.StaggeredGrid only supports the scrollbars for Dynamic items heights.

Each mode can set the knob size type:

License

MIT License. See the LICENSE file for more details.

Credits

Special thanks to the GoDaddy for the amazing color picker library.

Author:

Basil Miller
gigamole53@gmail.com