Skip to content

A simple library that provides an easy to use jetpack compose OTP component.

License

Notifications You must be signed in to change notification settings

ibraheemalazzawi/android-compose-otp

Repository files navigation

Android Jetpack Compose - OTP Component

Platform

A simple library that provides an easy to use OTP component.

Screenshots

image

Gradle

Step 1. Add the JitPack repository to your build file

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

Step 2. Add the dependency

dependencies {
    implementation 'com.github.ibraheemalazzawi:android-compose-otp:v1.0.0.alpha02'
}

Usage

Minimum Configurations

OtpComponent(
    onOtpComplete = { otp ->
        //The otp is complete and returned 
    },
    onEnableButtonStateChanged = { state ->
        //To attach the otp component with a button, you can use this status to
        //enable or disable the button
    }
)

Customized Configurations

OtpComponent(
    onOtpComplete = { otp ->
        //The otp is complete and returned
    },
    onEnableButtonStateChanged = { state ->
        //To attach the otp component with a button, you can use this status to
        //enable or disable the button
    },
    keyStyle = KeyStyle(
        height = 30.dp,
        textColor = Primary,
        keyFontSize = 20.sp
    ),
    inputStyle = InputStyle(
        gradientEnabledColor = listOf(Primary, PrimaryDark),
        gradientDisabledColor = listOf(Accent, AccentLight),
        inputFontSize = 20.sp
    )
)

License

Apache License

About

A simple library that provides an easy to use jetpack compose OTP component.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages