Skip to content

Android library providing an implementation of the Material Design Floating Action Button Speed Dial.

Notifications You must be signed in to change notification settings

lemillion12/multi-floating-action-button

Repository files navigation

Multi Floating Action Button

Android library providing an implementation of the Material Design Floating Action Button Speed Dial.

Features

  • Main Floating Action Button expands into multiple Small Floating Action Buttons
  • Highly customizable (label, icon and background colors, themes support)
  • Easy to use

How to use

Gradle setup

Official releases

The library is available on JitPack. To add the dependency in your project:

Step 1. Add the JitPack repository to your root build.gradle at the end of repositories:

	allprojects {
        repositories { 
            //...
            maven { url 'https://jitpack.io' }
        }
    }

Step 2. Add the dependency entry (latest version on JitPack):

    dependencies {
        implementation 'com.github.lemillion12:multi-floating-action-button:1.0.0'
    }

Basic use

Multi Floating Action Button

Use the MultiFloatingActionButton constructor to create your composable:

@Composable
fun SpeedDial() {
    val fabItems = listOf(
        FabItem(
            Icons.Filled.ShoppingCart,
            "Shopping Cart"
        ) { /*TODO*/ },
        FabItem(
            Icons.Filled.Favorite,
            "Favorite"
        ) { /*TODO*/ }
    )
    MultiFloatingActionButton(
        fabIcon = Icons.Filled.Add,
        items = fabItems,
        showLabels = true
    )
}

FAQs

Q. How do I change the color of the buttons?

A. This library leverages the colors from app theme specified using Material Design 3. The colors can be customized in the same way as for the FABs (refer: FAB Specs).

Credits

This project is based on ComposeCompanion by ComposeAcademy.