Skip to main content
Version: Next

textbutton

README.md

:OCTextButton - A Custom Composable UI Component

This OCTextButton is a custom Jetpack Compose component with a label designed to trigger an action.

Features:

  • Have TextButtons with and without Icons.
  • Icon can be passed to position in left, right or both sides of the label.
  • 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 OCTextButton

  1. Add the necessary imports:

    import your.package.name.OCTextButton

  2. Use the OCTextButton within your Composable:

        OCTextButton(title = "Button",
    enabled = false, // can pass the state of the text button
    hasUnderline = true, //(Optional) pass this if underline is required for label. Will be false by default.
    leadingIcon = R.drawable.XXX, // (Optional)pass the icon to be displayed on the left side of the text
    trailingIcon = R.drawable.XXX, // (Optional)pass the icon to be displayed on the right side of the text
    onClick = {
    // Provide the action required
    })

Parameters:

  • onClick: Listener that observes click event of the TextButton.
  • title: Text label to be displayed.
  • hasUnderline: Boolean value to be passed if the label needs to be underlined.
  • leadingIcon: Icon to be placed on the left side of the label.
  • trailingIcon: Icon to be placed on the right side of the label.
  • enabled: Boolean value to be passed to determine the state of the text button.