UX4G Logo
Components

PAN Card Input

Specialized 10-character Indian PAN number input with uppercase auto-formatting and Income Tax regex validation

The Ux4gPanInputField is a specialized citizen identity input component designed specifically for 10-character Indian Permanent Account Numbers (PAN cards).

It features:

  • Auto-Uppercase Conversion: Automatically transforms entered alphanumeric characters to uppercase format (ABCDE1234F).
  • Alphanumeric Filter: Disallows spaces and special characters.
  • Income Tax PAN Regex Validation: Validates the official pattern: 5 letters + 4 digits + 1 letter (^[A-Z]{5}[0-9]{4}[A-Z]{1}$).
  • Dynamic Status Updates: Automatically transitions to Ux4gInputFieldStatus.Success ("Valid PAN number") or Ux4gInputFieldStatus.Error ("Please enter a valid PAN number") upon reaching 10 characters.

Import from com.ux4g.designsystemv1.components.inputfield.Ux4gPanInputField.


Interactive Previews

1. Default State

Standard PAN card input with placeholder, label, and helper caption.

Ux4gPanInputField (Default)Jetpack Compose
UX4G PAN Card Input Default State

2. Success State

Displays valid 10-character PAN number with green success indicator.

Ux4gPanInputField (Success)Jetpack Compose
UX4G PAN Card Input Success State

3. Error State

Displays invalid format alert with red border and error message caption.

Ux4gPanInputField (Error)Jetpack Compose
UX4G PAN Card Input Error State

4. Warning State

Displays warning indicator with amber border and warning message caption.

Ux4gPanInputField (Warning)Jetpack Compose
UX4G PAN Card Input Warning State

5. Disabled State

Read-only disabled container preventing citizen interaction.

Ux4gPanInputField (Disabled)Jetpack Compose
UX4G PAN Card Input Disabled State

Kotlin Usage

PAN Verification Example
import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.CreditCard
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.components.inputfield.Ux4gInputFieldSize
import com.ux4g.designsystemv1.components.inputfield.Ux4gPanInputField

@Composable
fun PanVerificationScreen() {
    var panInput by remember { mutableStateOf("") }

    Column(
        modifier = Modifier
            .fillMaxWidth()
            .padding(16.dp),
        verticalArrangement = Arrangement.spacedBy(16.dp)
    ) {
        Ux4gPanInputField(
            value = panInput,
            onValueChange = { cleanPan -> 
                panInput = cleanPan 
            },
            label = "Permanent Account Number",
            required = true,
            size = Ux4gInputFieldSize.Medium,
            leadingIcon = Icons.Default.CreditCard,
            trailingIcon = if (panInput.isNotEmpty()) Icons.Default.Close else null,
            onTrailingIconPressed = { panInput = "" }
        )
    }
}

Parameters

Ux4gPanInputField Props

PropTypeDescriptionDefault
value *String10-character alphanumeric PAN string.—
onValueChange *(String) -> UnitCallback providing uppercase 10-character sanitized input.—
modifierModifierCompose layout modifier applied to outer container.Modifier
sizeUx4gInputFieldSizeHeight variant: Small (32dp), Medium (40dp), Large (48dp), XL (56dp).Ux4gInputFieldSize.Medium
statusUx4gInputFieldStatusStatus state override. Automatically resolves to Success or Error upon 10 characters.Ux4gInputFieldStatus.Default
labelString?Header title label."PAN Card Number"
requiredBooleanDisplays required red asterisk when true.false
placeholderString?Placeholder displayed when field is empty."ABCDE1234F"
captionString?Helper or error caption text below input."Enter your 10-character PAN number"
leadingIconAny?Icon placed at start (ImageVector, Ux4gIcon, or drawable resource Int).null
trailingIconAny?Icon placed at end (e.g. clear input icon).null
onTrailingIconPressed(() -> Unit)?Click handler for trailing icon.null
enabledBooleanInteractive state.true
readOnlyBooleanWhen true, value cannot be edited.false
styleTextStyle?Custom text style override for typed text.null
labelStyleTextStyle?Custom text style override for label.null
placeholderStyleTextStyle?Custom text style override for placeholder.null
captionStyleTextStyle?Custom text style override for caption.null

PAN Regex Validation Utility

Ux4gPanInputField provides programmatic verification:

// Validate PAN string programmatically
val isValid = Ux4gPanInputField.validatePan("ABCDE1234F") // Returns true
val isInvalid = Ux4gPanInputField.validatePan("12345ABCDE") // Returns false

// Format raw input into uppercase 10-char limit
val formatted = Ux4gPanInputField.formatPan("abcde1234f") // Returns "ABCDE1234F"

On this page