Bravo Studio Help Center
  • Get started with Bravo Studio 👏
  • Get Started
    • 🚀Create your first app
    • 🌟Bravo introduction
      • Get ready to create your app with ChatGPT
      • Create an app
        • Creating an app with Figma
        • Creating an app with Adobe XD
      • Duplicate an app
      • Delete an app
      • Replace linked Figma file
      • The app page
      • Sharing your app
      • Add an editor to your app
      • Fonts
        • Adobe XD - Supported fonts
    • 📱Bravo Vision previewer
    • ✨Unlock power features to create interactive apps
    • 🎓Help and tutorials
      • 📖App guide tutorials
        • Sample app tutorial: Your first binding
        • How to build a Fitness app with Bravo, Xano and RevenueCat
        • Foodgram: Social content sharing
        • Expedition journal: Write and share your adventures
        • My Subscriptions: Display data based on device ID
        • My Notes: using user ID and email from Firebase
        • My Store: Sell physical products with Bravo and Stripe
        • Titan: How to create a Smart Home App with No-Code?
        • n8n: Building an expense tracking app in 10min
      • 📺Learn with videos
      • 📚Learn with articles
      • 🗃️Browse by app feature
        • Save or "bookmark" a page
        • Backend search with Airtable
        • Backend search with Xano
        • Nested lists (list within a list)
        • Create and edit user profile (Firebase + Airtable)
        • Skeleton loader
        • Create albums in your app with Bravo Infinite images
  • Set up your design
    • 🖌️Get your Figma ready for Bravo
      • 🗃️Structuring the design: the layer hierarchy
      • 🪄Bravo Tags: adding functionality to the UI elements
      • 🧱The container
        • Setting up a container on Figma
        • Setting up a container on Adobe XD
      • 📲App navigation
        • Setting up app navigation on Figma
        • Setting up app navigation on Adobe XD
    • 🔌Bravo plugin for Figma
    • 💾Sample design files
    • 🤓Best Practices
  • App components
    • 📒Bravo Tags Master List
    • 🚪Menus
      • Modal Menu
      • Modal pages
      • Tabs Menu
      • Pop Up pages
      • Slide Menu
    • 🍞Pages
      • Modal pages
      • Pop-up pages
      • Swipe page
      • Transitions page
      • Page reveal animations
      • Page tabs
      • 🔮Stateful pages
    • 📦Containers
      • Swipe to delete
      • Top bar
      • Carousel slider
      • Aspect ratio relative to screen
      • Sortable List
      • Layer (sticky element)
    • 👋Intro & Onboarding
      • Intro page
      • Post-login page (Onboarding)
    • ⌛Loading experience
      • Loading page
      • Custom loading page
      • No loading
      • Preload
    • 📝Form & input fields
      • 👁️Password Visibility Toggle
      • 🩷Stateful input
        • ☑️Checkboxes (Multiple select)
        • ✅Required Checkbox
        • 🔘Radio buttons (Single select)
      • ⏳Input time Interval
      • 📄Dropdown selector
      • 🎚️Slider control
      • 🗓️Calendar picker
      • 📄Send form input to a database
    • 💎Components
      • Autoplay Video
      • GIF
      • SVG Component
      • Web view
      • Web Components using AI
      • Web view communication
      • LottieFile
      • Lottie-animated component
      • Flexible text (Flexo)
      • Zoomable image
      • Component states
      • Stateful component (like button)
      • Setting up the backend of Stateful component (like button)
      • Haptic Feedback (Buzzz)
      • Progress bar
      • Rich text
      • Date, Time and Currency Formatter
      • Scrollable text
      • Text Lines & Truncation
      • Status bar
    • ⚡Mobile actions
      • Mobile Actions
      • Play audio
      • Record audio
      • Play video
      • Scan QR code (external URL)
      • Scan codes (remote action)
      • Search & filter
      • Refresh page
      • Share location
    • 📱App Icon & Splash Screen
    • 🗺️Map with markers
    • 📈Charts
  • Data and Backend
    • 🗂️Set up a no-code backend
      • Xano
        • Nested lists (list > list > detail page) with Xano
        • Create a bookmark functionality with remote actions and device ID with Xano
        • Multi-user setup with Xano
        • 🔒Setting up the Xano Log in Snippet
          • ♻️Refresh Token
      • Airtable
        • Nested lists (list > list > detail page) with Airtable
        • Sort list with Airtable
        • Connect multiple tables from Airtable to one app
        • Update Airtable's API key to Access Token
      • Backendless
      • Bubble
      • Notion
        • Getting data from a Notion table
      • Firebase
        • Getting data from Firestore
    • 💾Set up API requests
      • Set up from scratch
        • Airtable
          • Set up an API GET request for list page - Airtable
          • Set up an API GET request for detail page - Airtable
          • Set up an API POST request - Airtable
          • Set up an API DELETE request - Airtable
        • Xano
          • Set up an API GET request for list page - Xano
          • Set up an API GET request for detail page - Xano
          • Set up an API PATCH request - Xano
          • Set up an API POST request - Xano
          • Set up an API DELETE request - Xano
      • Using GraphQL body type
      • Set up with API wizard & importer
        • Using the Airtable API Wizard
        • Using the Xano API wizard
    • 🎲Variables
      • Built-in variables
      • Set Variable
    • 📚Data Collection & Binding: Complete Collection
    • 🗂️Pagination
    • 🐛Debugging API issues
      • ⚙️Debugging requests in the API Collection
      • 📲Event logger
      • 🔗Link property
  • Data binding
    • 🤝Data binding types
      • API binding types
      • Bind multiple API requests to one screen
      • How to connect my API to a mobile actions
      • Remote actions: trigger an API request with a UI element
    • 💡Display data in your app
      • Bind data to design for a list page
      • Bind data to design for a detail page
    • 🆕Create data from your app
    • 🗑️Delete data from your app
    • 🚦Conditional Visibility
    • 🎛️Conditional Actions
  • Integrations & Settings
    • 🖇️Deep Links
      • 🖇️Deep Links for Bravo Vision
      • 🖇️Deep Links for published apps
      • 🖇️Troubleshooting Deep Links
    • 🔔Push Notifications with OneSignal
      • How to get a Bravo page URL
    • ⚙️Firebase Configuration
    • 🔐User Authentication
      • 🔑Authentication with Kinde and Xano
      • 🧙🏽Authentication with OAuth 2.0
        • Using social logins to authenticate users
        • Using AWS Cognito to authenticate users
        • Connecting to Spotify API
      • 📲User login with Firebase
        • ✉️Email and password Login with Firebase
        • 📞Phone Login with Firebase
        • 🍎Social Login with Firebase
        • 👻Anonymous Login with Firebase
      • ⛓️Authentication with custom backend
        • Set up Xano as your user authentication backend
    • 💰Stripe: One-time Payment
    • 💬Chat: CometChat
    • 💸RevenueCat: In-app purchases and subscriptions
    • 📉Bravo Analytics
    • 📳Facebook App Events
    • 📊Google Analytics
    • 🌐Multilingual apps
    • 🕸️How to connect with Webflow API
    • 📡NFC connection
    • 🎯Admob
  • App Publication
    • 🚀Publishing your app
      • iOS Publication: Complete Process
        • 1. Generate Certificates, AppIDs and Provisions
        • 2. Get the IPA
        • 3. Upload IPA to App Store Connect
        • 4. Test your app on TestFlight (optional)
        • 6. App Store publication
        • 7. Updating an app in the App Store
      • Android Publication: Complete Process
        • 1. Create a Keystore File (optional)
        • 2. Get the Debug APK to install
        • 3. Install the Debug APK in your device
        • 4. Get the AAB (Android App Bundle) file to publish
        • 5. Google Play publication
        • 6. Updating an app in Google Play
      • Android APK Installation Guide
      • Rejection from the app stores
    • 🎛️Making changes to your app after publication
    • 🛍️Versioning
    • 🌟App rating alert
  • Good to Know
    • 🤔Troubleshoot
      • Errors when logging in
      • Errors when creating an app
      • Errors in API requests
        • Request timeouts on Bravo
      • Errors after importing
      • Errors in publication form
    • 🧑‍💻Manage your account
    • 💳Billing
      • Bravo Subscription Plans Overview
      • App Add-ons
      • Upgrading a plan
      • Downgrading a plan
      • App allowance
      • Invoices & payment method
      • FAQ
    • ❓FAQs
      • About Bravo Studio
      • Importing a design file
      • Bravo Vision
      • Bravo Tags
      • API & Data Library
      • Login & Account
      • Other Features
  • NEED SOME HELP?
    • 📖Bravo Support Guide
    • 🤝Join the Bravo community
    • 🤖Bravo Assistant
    • 👥Production support
    • 🐞Report an issue
Powered by GitBook
On this page
  • Needed
  • 🥷 How to test
  • 💾 Example files

Was this helpful?

  1. App components
  2. Components

Web Components using AI

PreviousWeb viewNextWeb view communication

Last updated 3 months ago

Was this helpful?

Here we have the docs necessary to build a custom web component using AI (ChatGPT) and add the HTML code into your Bravo Studio web component library. Additionally, you will be able to preview your web component in your app using our web-view Bravo Tag where your newly created web component will live.

Needed

Bravo Studio plan

[component:web-view: URL] (You can see more about web views ).

Paid or Free Chat GPT account. (You can use any AI platform as far as it can create HTML code).

installed to test your app and web component.

🥷 How to test


  1. Create an app page in Figma with a web view tag [component:web-view: URL] tag or you can duplicate our sample .

  1. Now that we have your Figma file ready, we can proceed to import to Bravo Studio.

  1. Once imported, we can see our Bravo project and our web view page where we will be adding our web component.

  1. Now that our app age is ready, we can ask AI to generate our web component code. In our example, we will generate a boxing timer.

This will be our initial prompt:

Im building a mobile app with Bravo Studio and i would like you to help me build a web component for a specific web view page inside my app. Its a boxing training app and i would like to add a boxing round timer. Please build it and include the following:

  • 12 rounds of 3 minutes

  • Countdown timer

  • 1 minute rest time between rounds

  • Round end warning when 10 seconds left to end each round.

  • Play a boxing bell sound to start the round, when 10 seconds left to end the round and when the round finishes.

  • Please style the timer with red colors and use old style squares typography like if it was an old alarm clock. Use neon style for the red color.

  • There should be a start button, a pause button and a reset button.

  1. Chat GPT generates the code for us:

  1. Heres the actual code if you wish to test the same:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Boxing Round Timer</title>
  <style>
    body {
      font-family: 'Courier New', Courier, monospace;
      background-color: #000;
      color: #fff;
      text-align: center;
      margin: 0;
      padding: 0;
    }
    .timer {
      font-size: 4rem;
      color: red;
      text-shadow: 0 0 10px red, 0 0 20px red;
    }
    .controls button {
      font-size: 1.5rem;
      margin: 10px;
      padding: 10px 20px;
      background-color: red;
      color: #fff;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      text-shadow: 0 0 10px red;
    }
    .controls button:hover {
      background-color: darkred;
    }
    .round {
      font-size: 2rem;
      margin-top: 10px;
    }
  </style>
</head>
<body>
  <h1>Boxing Timer</h1>
  <div class="round">Round: <span id="round-number">1</span>/12</div>
  <div class="timer" id="timer">03:00</div>
  <div class="controls">
    <button id="start-btn">Start</button>
    <button id="pause-btn">Pause</button>
    <button id="reset-btn">Reset</button>
  </div>

  <audio id="bell-sound" src="boxing-bell.mp3"></audio>

  <script>
    const timerDisplay = document.getElementById('timer');
    const roundDisplay = document.getElementById('round-number');
    const bellSound = document.getElementById('bell-sound');
    const startBtn = document.getElementById('start-btn');
    const pauseBtn = document.getElementById('pause-btn');
    const resetBtn = document.getElementById('reset-btn');

    let totalRounds = 12;
    let currentRound = 1;
    let roundTime = 3 * 60; // 3 minutes
    let restTime = 60; // 1 minute
    let timeLeft = roundTime;
    let isResting = false;
    let interval;

    function playBell() {
      bellSound.currentTime = 0;
      bellSound.play();
    }

    function updateTimerDisplay() {
      const minutes = String(Math.floor(timeLeft / 60)).padStart(2, '0');
      const seconds = String(timeLeft % 60).padStart(2, '0');
      timerDisplay.textContent = `${minutes}:${seconds}`;
    }

    function startTimer() {
      if (interval) return;

      interval = setInterval(() => {
        if (timeLeft === 10) playBell();
        
        if (timeLeft > 0) {
          timeLeft--;
        } else {
          playBell();

          if (isResting) {
            isResting = false;
            currentRound++;

            if (currentRound > totalRounds) {
              clearInterval(interval);
              interval = null;
              alert('Training complete!');
              return;
            }

            timeLeft = roundTime;
            roundDisplay.textContent = currentRound;
          } else {
            isResting = true;
            timeLeft = restTime;
          }
        }

        updateTimerDisplay();
      }, 1000);
    }

    function pauseTimer() {
      clearInterval(interval);
      interval = null;
    }

    function resetTimer() {
      pauseTimer();
      currentRound = 1;
      isResting = false;
      timeLeft = roundTime;
      roundDisplay.textContent = currentRound;
      updateTimerDisplay();
    }

    startBtn.addEventListener('click', startTimer);
    pauseBtn.addEventListener('click', pauseTimer);
    resetBtn.addEventListener('click', resetTimer);

    updateTimerDisplay();
  </script>
</body>
</html>
  1. Now that we can copied the code to our clipboard, we can go back to Bravo Studio. In our project page, let's move to the new project tab called “Components”.

  1. Once in the components tab, hit the blue + button to create a new component in your components library.

  1. After creating your web component, you will find a small code sample and a preview of how that looks as a webview on the right side. (You can even test changing the word hello in the code to see how it changes in our web component previewer. Make sure you press “Save” in order to see the changes).

  1. Now that we have all set, lets copy the code that Chat GPT generated for our web component and paste it to our code editor. Make sure to first remove the sample data in it first by selecting all the text with Control + A and Delete. Once its all deleted, paste your web component code and press Save.

  2. Now that we have added our code and press Save, you will see your code inside the code editor and the preview of our web component:

  1. Remember, every code generated by Chat GPT will be different therefore you may want to adjust your initial prompt with follow up prompts till you get exactly what you are looking for. 💡TIP: If you want your web component to follow a specific design style, you can also include a screenshot of your app designed in Figma and instruct Chat GPT to respect your overall app design.

  2. Feel free to test your newly generated web component inside the web component previewer:

  1. Before we can test our web component on our phone using Bravo Vision, we must copy the URL link of our web component by pressing the Copy Link button under our code editor.

  1. Once we have copied our web component unique URL, we must add it to our web-view Bravo Tag in Figma. For this example it looks like this:

[component:web-view: https://dev-bravo-apps-assets.s3.eu-central-1.amazonaws.com/U6QB112ECDKCBX5V6N2GGCWRGFYSG9A9F/01JGYQ60TF71JAGBXG53VDQBDX.html]

NOTE: You will need to copy your own link from the "Copy link" button.

🚨 Make sure to sync your Bravo project with Figma to make sure our Bravo project updates with the updated Bravo web-view Tag.

  1. In Figma, we select our web-view Tag container name and replace it with the one above which includes the web component unique URL.

  1. Now we can test our app and web component on our mobile device using Bravo Vision:

Or watch the tutorial:

💾 Example files

Duplicate the files below to see how to set it up!

💡 Learn how to build Advanced web components connecting them to your backend in .

💎
this blog
Solo
here
Bravo Vision
Figma file here