def _post_init(self, *args, **kwargs):
        """Initialize the component.

        Args:
            *args: Args to initialize the component.
            **kwargs: Kwargs to initialize the component.

        Raises:
            TypeError: If an invalid prop is passed.
            ValueError: If an event trigger passed is not valid.
        """
        # Set the id and children initially.
        children = kwargs.get("children", [])

        self._validate_component_children(children)

        # Get the component fields, triggers, and props.
        fields = self.get_fields()
        component_specific_triggers = self.get_event_triggers()
        props = self.get_props()

        # Add any events triggers.
        if "event_triggers" not in kwargs:
            kwargs["event_triggers"] = {}
        kwargs["event_triggers"] = kwargs["event_triggers"].copy()

        # Iterate through the kwargs and set the props.
        for key, value in kwargs.items():
            if (
                key.startswith("on_")
                and key not in component_specific_triggers
                and key not in props
            ):
                msg = (
                    f"The {(comp_name := type(self).__name__)} does not take in an `{key}` event trigger. If {comp_name}"
                    f" is a third party component make sure to add `{key}` to the component's event triggers. "
                    f"visit https://reflex.dev/docs/wrapping-react/guide/#event-triggers for more info."
                )
                raise ValueError(msg)
            if key in component_specific_triggers:
                # Event triggers are bound to event chains.
                is_var = False
            elif key in props:
                # Set the field type.
                is_var = (
                    field.type_origin is Var if (field := fields.get(key)) else False
                )
            else:
                continue

            # Check whether the key is a component prop.
            if is_var:
                try:
                    kwargs[key] = LiteralVar.create(value)

                    # Get the passed type and the var type.
                    passed_type = kwargs[key]._var_type
                    expected_type = types.get_args(
                        types.get_field_type(type(self), key)
                    )[0]
                except TypeError:
                    # If it is not a valid var, check the base types.
                    passed_type = type(value)
                    expected_type = types.get_field_type(type(self), key)

                if not satisfies_type_hint(value, expected_type):
                    value_name = value._js_expr if isinstance(value, Var) else value

                    additional_info = (
                        " You can call `.bool()` on the value to convert it to a boolean."
                        if expected_type is bool and isinstance(value, Var)
                        else ""
                    )

                    raise TypeError(
                        f"Invalid var passed for prop {type(self).__name__}.{key}, expected type {expected_type}, got value {value_name} of type {passed_type}."
                        + additional_info
                    )
            # Check if the key is an event trigger.
            if key in component_specific_triggers:
                kwargs["event_triggers"][key] = EventChain.create(
                    value=value,
                    args_spec=component_specific_triggers[key],
                    key=key,
                )

        # Remove any keys that were added as events.
        for key in kwargs["event_triggers"]:
            kwargs.pop(key, None)

        # Place data_ and aria_ attributes into custom_attrs
        special_attributes = [
            key
            for key in kwargs
            if key not in fields and SpecialAttributes.is_special(key)
        ]
        if special_attributes:
            custom_attrs = kwargs.setdefault("custom_attrs", {})
            custom_attrs.update(
                {
                    format.to_kebab_case(key): kwargs.pop(key)
                    for key in special_attributes
                }
            )

        # Add style props to the component.
        style = kwargs.get("style", {})
        if isinstance(style, Sequence):
            if any(not isinstance(s, Mapping) for s in style):
                msg = "Style must be a dictionary or a list of dictionaries."
                raise TypeError(msg)
            # Merge styles, the later ones overriding keys in the earlier ones.
            style = {
                k: v
                for style_dict in style
                for k, v in cast(Mapping, style_dict).items()
            }

        if isinstance(style, (Breakpoints, Var)):
            style = {
                # Assign the Breakpoints to the self-referential selector to avoid squashing down to a regular dict.
                "&": style,
            }

        fields_style = self.get_fields()["style"]

        kwargs["style"] = Style(
            {
                **fields_style.default_value(),
                **style,
                **{attr: value for attr, value in kwargs.items() if attr not in fields},
            }
        )

        # Convert class_name to str if it's list
        class_name = kwargs.get("class_name", "")
        if isinstance(class_name, (list, tuple)):
            has_var = False
            for c in class_name:
                if isinstance(c, str):
                    continue
                if isinstance(c, Var):
                    if not isinstance(c, StringVar) and not issubclass(
                        c._var_type, str
                    ):
                        msg = f"Invalid class_name passed for prop {type(self).__name__}.class_name, expected type str, got value {c._js_expr} of type {c._var_type}."
                        raise TypeError(msg)
                    has_var = True
                else:
                    msg = f"Invalid class_name passed for prop {type(self).__name__}.class_name, expected type str, got value {c} of type {type(c)}."
                    raise TypeError(msg)
            if has_var:
                kwargs["class_name"] = LiteralArrayVar.create(
                    class_name, _var_type=list[str]
                ).join(" ")
            else:
                kwargs["class_name"] = " ".join(class_name)
        elif (
            isinstance(class_name, Var)
            and not isinstance(class_name, StringVar)
            and not issubclass(class_name._var_type, str)
        ):
            msg = f"Invalid class_name passed for prop {type(self).__name__}.class_name, expected type str, got value {class_name._js_expr} of type {class_name._var_type}."
            raise TypeError(msg)
        # Construct the component.
        for key, value in kwargs.items():
            setattr(self, key, value)
Initialize the component.

        Args:
            *args: Args to initialize the component.
            **kwargs: Kwargs to initialize the component.

        Raises:
            TypeError: If an invalid prop is passed.
            ValueError: If an event trigger passed is not valid.
        
reflex/components/component.py