def __init__(self, component_name: str | None = None, **kwargs):
        """Initialize the props with validation.

        Args:
            component_name: The custom name of the component.
            kwargs: Kwargs to initialize the props.

        Raises:
            InvalidPropValueError: If invalid props are passed on instantiation.
        """
        component_name = component_name or type(self).__name__

        # Validate fields BEFORE setting them
        known_fields = set(self.__class__.get_fields().keys())
        provided_fields = set(kwargs.keys())
        invalid_fields = provided_fields - known_fields

        if invalid_fields:
            invalid_fields_str = ", ".join(invalid_fields)
            supported_props_str = ", ".join(f'"{field}"' for field in known_fields)
            msg = f"Invalid prop(s) {invalid_fields_str} for {component_name!r}. Supported props are {supported_props_str}"
            raise InvalidPropValueError(msg)

        # Use parent class initialization after validation
        super().__init__(**kwargs)
Initialize the props with validation.

        Args:
            component_name: The custom name of the component.
            kwargs: Kwargs to initialize the props.

        Raises:
            InvalidPropValueError: If invalid props are passed on instantiation.
        
reflex/components/props.py