Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sangelxyz/e1ed5294a60b7e7cd1b01adf7fd5b3ac to your computer and use it in GitHub Desktop.
Save sangelxyz/e1ed5294a60b7e7cd1b01adf7fd5b3ac to your computer and use it in GitHub Desktop.
tradingview leptos component
use leptos::*;
#[component]
pub fn TradingView(symbol: String) -> impl IntoView {
// Creates a reactive value to update the button
view! {
<div class="tradingview-container" style="width:100%;">
<div class="tradingview-widget-container" style="height:100%;width:100%">
<div class="tradingview-widget-container__widget" style="height:calc(100% - 32px);width:100%"></div>
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-advanced-chart.js" async inner_html=r#"
{
"autosize": true,
"symbol": "NASDAQ:NVDA",
"interval": "D",
"timezone": "Etc/UTC",
"theme": "light",
"style": "1",
"locale": "en",
"allow_symbol_change": true,
"calendar": false,
"support_host": "https://www.tradingview.com"
}"#>
</script>
</div>
</div>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment