---
tags: [gradio-custom-component, SimpleTextbox, gradio, navbar, navar-component, gradio-navbar, UI-component]
title: gradio_navbar
short_description: Gradio custom navbar component
colorFrom: blue
colorTo: yellow
sdk: gradio
pinned: false
app_file: space.py
---
# `gradio_navbar`
<img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange"> <a href="https://github.com/DigitalKin-ai/gradio_navbar/issues" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Issues-white?logo=github&logoColor=black"></a>
Gradio custom navbar component
## Installation
```bash
pip install gradio_navbar
```
## Usage
```python
"""
Demo for the NavBar component.
"""
import gradio as gr
from gradio_navbar import NavBar
example = NavBar().example_value()
demo = gr.Interface(
lambda x: x,
[
NavBar(
value={
"company_logo_url": "https://avatars.githubusercontent.com/u/\
55248617?v=4",
"company_name": "Gradio",
"logout_link": "https://www.gradio.app",
"username": "gradio",
"profile_photo_url": "https://avatars.githubusercontent.com/u/\
55248607?v=4",
}
),
], # interactive version of your component
NavBar(), # static version of your component
examples=[
[example]
], # uncomment this line to view the "example version" of your component
)
if __name__ == "__main__":
demo.launch()
```
## `NavBar`
### Initialization
<table>
<thead>
<tr>
<th align="left">name</th>
<th align="left" style="width: 25%;">type</th>
<th align="left">default</th>
<th align="left">description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>value</code></td>
<td align="left" style="width: 25%;">
```python
Dict[str, Any] | Callable | None
```
</td>
<td align="left"><code>None</code></td>
<td align="left">None</td>
</tr>
<tr>
<td align="left"><code>every</code></td>
<td align="left" style="width: 25%;">
```python
Timer | float | None
```
</td>
<td align="left"><code>None</code></td>
<td align="left">Continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.</td>
</tr>
<tr>
<td align="left"><code>inputs</code></td>
<td align="left" style="width: 25%;">
```python
Component | Sequence[Component] | set[Component] | None
```
</td>
<td align="left"><code>None</code></td>
<td align="left">Components that are used as inputs to calculate `value` if `value` is a function (has no effect otherwise). `value` is recalculated any time the inputs change.</td>
</tr>
<tr>
<td align="left"><code>visible</code></td>
<td align="left" style="width: 25%;">
```python
bool
```
</td>
<td align="left"><code>True</code></td>
<td align="left">If False, component will be hidden.</td>
</tr>
<tr>
<td align="left"><code>elem_id</code></td>
<td align="left" style="width: 25%;">
```python
str | None
```
</td>
<td align="left"><code>None</code></td>
<td align="left">An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.</td>
</tr>
<tr>
<td align="left"><code>elem_classes</code></td>
<td align="left" style="width: 25%;">
```python
list[str] | str | None
```
</td>
<td align="left"><code>None</code></td>
<td align="left">An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.</td>
</tr>
<tr>
<td align="left"><code>render</code></td>
<td align="left" style="width: 25%;">
```python
bool
```
</td>
<td align="left"><code>True</code></td>
<td align="left">If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.</td>
</tr>
<tr>
<td align="left"><code>key</code></td>
<td align="left" style="width: 25%;">
```python
int | str | None
```
</td>
<td align="left"><code>None</code></td>
<td align="left">if assigned, will be used to assume identity across a re-render. Components that have the same key across a re-render will have their value preserved.</td>
</tr>
</tbody></table>
### User function
The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
- When used as an Input, the component only impacts the input signature of the user function.
- When used as an output, the component only impacts the return signature of the user function.
The code snippet below is accurate in cases where the component is used as both an input and an output.
- **As output:** Is passed, passes text value as a {str} into the function.
- **As input:** Should return, expects a {str} returned from function and sets textarea value to it.
```python
def predict(
value: typing.Optional[typing.Dict[str, typing.Any]][
typing.Dict[str, typing.Any][str, typing.Any], None
]
) -> typing.Optional[typing.Dict[str, typing.Any]][
typing.Dict[str, typing.Any][str, typing.Any], None
]:
return value
```
Raw data
{
"_id": null,
"home_page": null,
"name": "gradio-navbar",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "UI-component, gradio, gradio-custom-component, gradio-navbar, navar-component, navbar",
"author": null,
"author_email": "Thibaud Perrin <t.perrin@digitalkin.ai>",
"download_url": "https://files.pythonhosted.org/packages/60/13/3186d17c3634ab3a049bad628eec112f5e537a369e686034f8275c710303/gradio_navbar-0.0.1.tar.gz",
"platform": null,
"description": "---\ntags: [gradio-custom-component, SimpleTextbox, gradio, navbar, navar-component, gradio-navbar, UI-component]\ntitle: gradio_navbar\nshort_description: Gradio custom navbar component\ncolorFrom: blue\ncolorTo: yellow\nsdk: gradio\npinned: false\napp_file: space.py\n---\n\n# `gradio_navbar`\n<img alt=\"Static Badge\" src=\"https://img.shields.io/badge/version%20-%200.0.1%20-%20orange\"> <a href=\"https://github.com/DigitalKin-ai/gradio_navbar/issues\" target=\"_blank\"><img alt=\"Static Badge\" src=\"https://img.shields.io/badge/Issues-white?logo=github&logoColor=black\"></a> \n\nGradio custom navbar component\n\n## Installation\n\n```bash\npip install gradio_navbar\n```\n\n## Usage\n\n```python\n\"\"\"\nDemo for the NavBar component.\n\"\"\"\n\nimport gradio as gr\nfrom gradio_navbar import NavBar\n\n\nexample = NavBar().example_value()\n\ndemo = gr.Interface(\n lambda x: x,\n [\n NavBar(\n value={\n \"company_logo_url\": \"https://avatars.githubusercontent.com/u/\\\n55248617?v=4\",\n \"company_name\": \"Gradio\",\n \"logout_link\": \"https://www.gradio.app\",\n \"username\": \"gradio\",\n \"profile_photo_url\": \"https://avatars.githubusercontent.com/u/\\\n55248607?v=4\",\n }\n ),\n ], # interactive version of your component\n NavBar(), # static version of your component\n examples=[\n [example]\n ], # uncomment this line to view the \"example version\" of your component\n)\n\n\nif __name__ == \"__main__\":\n demo.launch()\n\n```\n\n## `NavBar`\n\n### Initialization\n\n<table>\n<thead>\n<tr>\n<th align=\"left\">name</th>\n<th align=\"left\" style=\"width: 25%;\">type</th>\n<th align=\"left\">default</th>\n<th align=\"left\">description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td align=\"left\"><code>value</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nDict[str, Any] | Callable | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">None</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>every</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nTimer | float | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">Continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>inputs</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nComponent | Sequence[Component] | set[Component] | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">Components that are used as inputs to calculate `value` if `value` is a function (has no effect otherwise). `value` is recalculated any time the inputs change.</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>visible</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nbool\n```\n\n</td>\n<td align=\"left\"><code>True</code></td>\n<td align=\"left\">If False, component will be hidden.</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>elem_id</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nstr | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>elem_classes</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nlist[str] | str | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>render</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nbool\n```\n\n</td>\n<td align=\"left\"><code>True</code></td>\n<td align=\"left\">If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.</td>\n</tr>\n\n<tr>\n<td align=\"left\"><code>key</code></td>\n<td align=\"left\" style=\"width: 25%;\">\n\n```python\nint | str | None\n```\n\n</td>\n<td align=\"left\"><code>None</code></td>\n<td align=\"left\">if assigned, will be used to assume identity across a re-render. Components that have the same key across a re-render will have their value preserved.</td>\n</tr>\n</tbody></table>\n\n\n\n\n### User function\n\nThe impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).\n\n- When used as an Input, the component only impacts the input signature of the user function.\n- When used as an output, the component only impacts the return signature of the user function.\n\nThe code snippet below is accurate in cases where the component is used as both an input and an output.\n\n- **As output:** Is passed, passes text value as a {str} into the function.\n- **As input:** Should return, expects a {str} returned from function and sets textarea value to it.\n\n ```python\n def predict(\n value: typing.Optional[typing.Dict[str, typing.Any]][\n typing.Dict[str, typing.Any][str, typing.Any], None\n]\n ) -> typing.Optional[typing.Dict[str, typing.Any]][\n typing.Dict[str, typing.Any][str, typing.Any], None\n]:\n return value\n ```\n \n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Gradio custom navbar component",
"version": "0.0.1",
"project_urls": {
"repository": "https://github.com/DigitalKin-ai/gradio_navbar"
},
"split_keywords": [
"ui-component",
" gradio",
" gradio-custom-component",
" gradio-navbar",
" navar-component",
" navbar"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "74ed0ceea9d096f5262219451124ffe2eb90e44aa9397248eb7793e2ff2e4c7c",
"md5": "72f851e5dc13dce8eff90481181cec34",
"sha256": "f8cfc1b7fba2b3c188e32c51a5f6ad65990abe99675bf7b5400cb81a13908e64"
},
"downloads": -1,
"filename": "gradio_navbar-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "72f851e5dc13dce8eff90481181cec34",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 1108474,
"upload_time": "2024-12-09T15:12:31",
"upload_time_iso_8601": "2024-12-09T15:12:31.763602Z",
"url": "https://files.pythonhosted.org/packages/74/ed/0ceea9d096f5262219451124ffe2eb90e44aa9397248eb7793e2ff2e4c7c/gradio_navbar-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "60133186d17c3634ab3a049bad628eec112f5e537a369e686034f8275c710303",
"md5": "dea2ce77dcd16d5d1a93e98d95b78da2",
"sha256": "5e58fab12349c5ed44373a21ec0e7a761047dfcfff904e809a4935c3676ca270"
},
"downloads": -1,
"filename": "gradio_navbar-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "dea2ce77dcd16d5d1a93e98d95b78da2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 1152166,
"upload_time": "2024-12-09T15:12:34",
"upload_time_iso_8601": "2024-12-09T15:12:34.055442Z",
"url": "https://files.pythonhosted.org/packages/60/13/3186d17c3634ab3a049bad628eec112f5e537a369e686034f8275c710303/gradio_navbar-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 15:12:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DigitalKin-ai",
"github_project": "gradio_navbar",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "gradio-navbar"
}