# st.components.v2.component

Source: https://docs.streamlit.io/develop/api-reference/custom-components/st.components.v2.component

* Function signature:

   ```python
   st.components.v2.component(name, *, html=None, css=None, js=None, isolate_styles=True)
   ```

* Parameters:

   | name | type | default | description |
   |---|---|---|---|
   | name | str |  | A short, descriptive identifier for the component. This is used internally by Streamlit to manage instances of the component. Component names must be unique across an app. Streamlit uses the name exactly as you pass it and doesn't add a prefix. For a component in an installed package, use ".", where  is the name in the package's [project] table and  is the name of the component's entry under [[tool.streamlit.component.components]]. Streamlit uses this name to find the component's asset_dir. If you register multiple components with the same name, a warning is logged and the last-registered component is used. Because this can lead to unexpected behavior, ensure that component names are unique. If you intend to have multiple instances of a component in one app, avoid wrapping a component definition together with its mounting command so you don't re-register your component with each instance. |
   | html | str or None |  | Inline HTML markup for the component root. This can be one of the following strings:  Raw HTML. This doesn't require any , , or  tags; just provide the inner HTML. A path or glob to an HTML file, relative to the component's asset directory.  This is trusted component content. Streamlit does not sanitize it, and any scripts in the HTML can execute in the app page. If any HTML depends on data passed at mount time, use a placeholder element and populate it via JavaScript. Alternatively, you can append a new element to the parent. For more information, see Example 2. |
   | css | str or None |  | Inline CSS. This can be one of the following strings:  Raw CSS (without a  block). A path or glob to a CSS file, relative to the component's asset directory. |
   | js | str or None |  | Inline JavaScript. This can be one of the following strings:  Raw JavaScript (without a  block). A path or glob to a JS file, relative to the component's asset directory.  This is trusted component code. It executes with normal app-page DOM privileges. |
   | isolate_styles | bool |  | Whether to isolate the component styles in a shadow root. If this is True (default), the component's HTML is mounted inside a shadow DOM and, in your component's JavaScript, parentElement returns a ShadowRoot. If this is False, the component's HTML is mounted directly into the app's DOM tree, and parentElement returns a regular HTMLElement. This is style isolation only. It is not a security boundary and does not sandbox the component's JavaScript. |

* Returns: ComponentRenderer

    The component's mounting command.
This callable accepts the component parameters like key and
data and returns a ComponentResult object with the
component's state. The mounting command can be included in a
user-friendly wrapper function to provide a simpler API. A mounting
command can be called multiple times in an app to create multiple
instances of the component.
