Skip to content

Adding Progress Bar to Upload Form

Original guide · All levels

You already know HOW TO CREATE AN UPLOAD FORM and upload files to your server. Sometimes, for large files it is useful to have some kind of indication, that the file is uploading. The progress bar com

We’d like to add the progress bar, below our upload form, so we select add after:

Section titled “We’d like to add the progress bar, below our upload form, so we select add after:”

You already know HOW TO CREATE AN UPLOAD FORM and upload files to your server. Sometimes, for large files it is useful to have some kind of indication, that the file is uploading.
The progress bar component is really useful here!

We’d like to add the progress bar, below our upload form, so we select add after:

And in the content category we select Progress:

Section titled “And in the content category we select Progress:”

Select the progress bar, in the App Structure:

Section titled “Select the progress bar, in the App Structure:”

You can add a label inside it, we add the following text Uploading...

Section titled “You can add a label inside it, we add the following text Uploading...”

Then, we set the default width to 0, as we are going to use dynamic width:

Section titled “Then, we set the default width to 0, as we are going to use dynamic width:”

Then select the style. We set it to primary as blue is our favorite color:

Section titled “Then select the style. We set it to primary as blue is our favorite color:”

Enable the striped and animated options if you want tour progress bar to be animated and striped:

Section titled “Enable the striped and animated options if you want tour progress bar to be animated and striped:”

We’d like to animate the width of the progress bar, so we enter the width css property:

Section titled “We’d like to animate the width of the progress bar, so we enter the width css property:”

Under your upload server action form, open uploadProgress and select percent:

Section titled “Under your upload server action form, open uploadProgress and select percent:”

This sets the dynamic value for the width, but the width property expects the value to be followed by an unit. In our case the unit is % so we just add +'%' to the expression. This is required and the progress bar won’t work if you don’t add it:

Then - we want to show the progress, only when the upload server action runs (nobody likes an empty progress bar) Step 14
So, select the Progress component in the app structure and add new dynamic attribute:

And click the dynamic data picker button, to select when to show the progress:

Section titled “And click the dynamic data picker button, to select when to show the progress:”

We’d like to show it, when the server action is executing, so under your upload server action form open state and select executing:

And you are done. Now you will see a nice, animated progress bar when you upload your files:

Section titled “And you are done. Now you will see a nice, animated progress bar when you upload your files:”

And you are done. Now you will see a nice, animated progress bar when you upload your files: