Skip to main content
Version: Next

button

README.md

:OCButton - A Custom Composable UI Component

This OCButton is a custom Jetpack Compose component designed to trigger an action.

Types:

  • Primary.
  • Secondary.
  • Tertiary.
  • Primary Danger.
  • Secondary Danger.
  • Primary Inline.
  • Secondary Inline.

Features:

  • Have seven types of button.
  • 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 OCButton

  1. Add the necessary imports:

    import your.package.name.OCButton

  2. Use the OCButton within your Composable:

        OCButton(title = "Button",
    buttonType = SecondaryInline,// pass the type
    enabled = false // can pass the state of the button
    onClick = {
    // Provide the action required
    })

Parameters:

  • onClick: Listener that observes click event of the button.
  • buttonType: Type of the button.
  • title: (Optional) Configuration to change style of the checkbox.
  • icon: An image shown on the button
  • externalIcon: An optional composable image shown on the button
  • iconAlignment: Position of icon on button can be [Trailing] or [Leading] based on [iconAlignment]
  • enabled: A boolean representing if button is active or not