@@ -360,6 +360,7 @@ const ZenstackBaseForm = (props: ZenstackBaseFormProps) => {
360360 key = { fieldName }
361361 field = { field }
362362 index = { - 1 }
363+ className = { element . props . className }
363364 { ...props }
364365 />
365366 ) ;
@@ -451,6 +452,7 @@ interface ZenstackFormInputProps extends ZenstackBaseFormProps {
451452 field : Field
452453 index : number
453454 customElement ?: React . ReactElement
455+ className ?: string
454456}
455457const ZenstackFormInputInternal = ( props : ZenstackFormInputProps ) => {
456458 const { metadata : originalMetadata , elementMap, hooks, enumLabelTransformer } = useZenstackUIProvider ( ) ;
@@ -588,12 +590,16 @@ const ZenstackFormInputInternal = (props: ZenstackFormInputProps) => {
588590
589591 // If we have a custom element, use it instead of the element mapping
590592 if ( props . customElement ) {
593+ const originalClassName = props . customElement . props . className || '' ;
594+ const dirtyClassName = isDirty ? 'dirty' : '' ;
595+ const combinedClassName = `${ originalClassName } ${ dirtyClassName } ` . trim ( ) ;
596+
591597 return React . cloneElement ( props . customElement , {
592598 ...props . form . getInputProps ( fieldName ) ,
593599 onChange : handleChange ,
594600 required,
595601 key : props . form . key ( fieldName ) ,
596- className : isDirty ? 'dirty' : '' ,
602+ className : combinedClassName ,
597603 disabled : isDisabled ,
598604 placeholder : placeholder ,
599605 } ) ;
@@ -608,7 +614,7 @@ const ZenstackFormInputInternal = (props: ZenstackFormInputProps) => {
608614 onChange = { handleChange } // Override onChange with our wrapped version
609615 label = { label }
610616 data = { labelData }
611- className = { isDirty ? 'dirty' : '' }
617+ className = { ` ${ props . className || '' } ${ isDirty ? 'dirty' : '' } ` . trim ( ) }
612618 disabled = { isDisabled }
613619 data-autofocus = { props . index === 0 }
614620 />
0 commit comments