Skip to main content
Version: Next

fab

README.md

:OCFab - A Custom Composable UI Component

This OCFab is a custom Jetpack Compose component Floating Action Button designed to trigger an action.

Types:

  • Primary.
  • Secondary.

Features:

  • Have two types of fab with and without labels.
  • Can be switched to different types by just passing the required type.
  • Have active and inactive state which can be handled by the consumer.

:How to use OCFab

  1. Add the necessary imports:

    import your.package.name.OCFab

  2. Use the OCFab within your Composable:

        OCFab(
    icon = R.drawable.icon_left_input_chip, // the icon to be displayed
    title = "Button", // (Optional)Label to be disblayed on right of icon
    fabType = Primary,// pass the type
    enabled = false // can pass the state of the fab
    onClick = {
    // Provide the action required
    })

Parameters:

  • onClick: Listener that observes click event of the fab.
  • fabType: Type of the fab.
  • title: (Optional) Label to be displayed on the FAB .
  • icon: The icon to be displayed inside the button
  • enabled: A lambda function called when a checkbox is toggled.