{"id":18594762,"url":"https://github.com/vivien000/st-click-detector","last_synced_at":"2025-04-10T16:31:10.624Z","repository":{"id":37674859,"uuid":"472480068","full_name":"vivien000/st-click-detector","owner":"vivien000","description":null,"archived":false,"fork":false,"pushed_at":"2022-03-22T20:15:17.000Z","size":267,"stargazers_count":64,"open_issues_count":7,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T00:42:27.286Z","etag":null,"topics":["streamlit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vivien000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-21T19:19:19.000Z","updated_at":"2025-03-16T17:07:40.000Z","dependencies_parsed_at":"2022-09-16T12:11:07.212Z","dependency_job_id":null,"html_url":"https://github.com/vivien000/st-click-detector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivien000%2Fst-click-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivien000%2Fst-click-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivien000%2Fst-click-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivien000%2Fst-click-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vivien000","download_url":"https://codeload.github.com/vivien000/st-click-detector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248252690,"owners_count":21072700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["streamlit"],"created_at":"2024-11-07T01:17:01.672Z","updated_at":"2025-04-10T16:31:09.498Z","avatar_url":"https://github.com/vivien000.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# st-click-detector\n\n`st-click-detector` is a [Streamlit](https://streamlit.io) component to display some HTML content and detect when hyperlinks are clicked on.\n\n![Screenshot](screenshot.gif)\n\nA more advanced example can be seen live [here](https://huggingface.co/spaces/vivien/semanticsearch).\n\n## Installation\n\n```bash\npip install st-click-detector\n```\n\n## Quickstart\n\nPut your HTML content in a string and make sure that `\u003ca\u003e` tags include an `id` (clicks on links without `id` will be ignored by the component)\n\n```python\nimport streamlit as st\nfrom st_click_detector import click_detector\n\ncontent = \"\"\"\u003cp\u003e\u003ca href='#' id='Link 1'\u003eFirst link\u003c/a\u003e\u003c/p\u003e\n    \u003cp\u003e\u003ca href='#' id='Link 2'\u003eSecond link\u003c/a\u003e\u003c/p\u003e\n    \u003ca href='#' id='Image 1'\u003e\u003cimg width='20%' src='https://images.unsplash.com/photo-1565130838609-c3a86655db61?w=200'\u003e\u003c/a\u003e\n    \u003ca href='#' id='Image 2'\u003e\u003cimg width='20%' src='https://images.unsplash.com/photo-1565372195458-9de0b320ef04?w=200'\u003e\u003c/a\u003e\n    \"\"\"\nclicked = click_detector(content)\n\nst.markdown(f\"**{clicked} clicked**\" if clicked != \"\" else \"**No click**\")\n```\n\n## Usage\n\n**click_detector(html_content, key=None)**\n\nDisplay HTML content and detect when links are clicked on\n\n### Parameters\n\n- `html_content` (str): content to display and from which clicks should be detected\n\n- `key` (str or None): an optional key that uniquely identifies this component. If this is None, and the component's arguments are changed, the component will be re-mounted in the Streamlit frontend and lose its current state\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvivien000%2Fst-click-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvivien000%2Fst-click-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvivien000%2Fst-click-detector/lists"}