def add_child(self, child):
        """
        Add a new child element to this widget.

        :param child: Object inheriting :class:`BaseElement`.
        """
        self.children.append(child)
        child.parent = self

        if self.view and self.view.is_loaded:
            self.view.dispatch({
                'name': 'append',
                'html': child.compile(),
                'selector': '#' + str(self.id)
            })