Skip to content

Instantly share code, notes, and snippets.

@hugobarauna
Created February 1, 2024 14:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugobarauna/4d329044739ee6be435e93cdb9eb22ed to your computer and use it in GitHub Desktop.
Save hugobarauna/4d329044739ee6be435e93cdb9eb22ed to your computer and use it in GitHub Desktop.
Livebook Kino Spinner component

Kino Spinner component

Mix.install([
  {:kino, "~> 0.12.3"}
])

Section

defmodule Kino.Spinner do
  def new() do
    Kino.HTML.new("""
    <div class="loader"></div>

    <style>
      .loader {
        border: 16px solid #f3f3f3; /* Light grey */
        border-top: 16px solid #3498db; /* Blue */
        border-radius: 50%;
        width: 30px;
        height: 30px;
        animation: spin 2s linear infinite;
      }

      @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
      }
    </style>
    """)
  end
end
Kino.Spinner.new()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment