Logo

dev-resources.site

for different kinds of informations.

Next.js with Shadcn UI Progress Bar Example

Published at
7/8/2024
Categories
nextjs
webdev
shadcnui
Author
aaronnfs
Categories
3 categories in total
nextjs
open
webdev
open
shadcnui
open
Author
8 person written this
aaronnfs
open
Next.js with Shadcn UI Progress Bar Example

In this tutorial, we will learn how to use a progress bar in Next.js with Shadcn UI.

Before using the progress bar in Next.js 13 with Shadcn UI, you need to install it by running npx shadcn-ui@latest add progress.



npx shadcn-ui@latest add progress
# or
npx shadcn-ui@latest add


Enter fullscreen mode Exit fullscreen mode
  1. Create a progress bar in Next.js 13 using the Shadcn UI Progresscomponent. ```jsx

import { Progress } from "@/components/ui/progress"

export default function ProgressDemo() {
return (








)
}
![progress bar](https://frontendshape.com/wp-content/uploads/2024/06/DxqLJBNoWKWhFaNcqjP90APl7QIIqdhHzCfWvGru.png)
2.Implementing a progress bar in Next.js 13 with Shadcn UI using useEffect, useState, and setTimeout.
```jsx


"use client"

import * as React from "react"

import { Progress } from "@/components/ui/progress"

export default function ProgressDemo() {
  const [progress, setProgress] = React.useState(13)

  React.useEffect(() => {
    const timer = setTimeout(() => setProgress(66), 500)
    return () => clearTimeout(timer)
  }, [])

  return <Progress value={progress} className="w-[60%]" />
}


Enter fullscreen mode Exit fullscreen mode

shadcn ui progress
3.NextJS with shadcn ui progress bar with percentage.



import { Progress } from "@/components/ui/progress"

export default function ProgressDemo() {
  return (
    <div className="space-y-4">
      <div>
        <h2 className="text-xl font-semibold mb-2 text-center">Progress Bars</h2>
        <div className="space-y-2">
          {/* 10% Progress */}
          <div className="flex items-center">
            <span className="w-1/6 text-right mr-2">10%</span>
            <div className="w-5/6">
              <Progress value={10} />
            </div>
          </div>

          {/* 25% Progress */}
          <div className="flex items-center">
            <span className="w-1/6 text-right mr-2">25%</span>
            <div className="w-5/6">
              <Progress value={25} />
            </div>
          </div>

          {/* 50% Progress */}
          <div className="flex items-center">
            <span className="w-1/6 text-right mr-2">50%</span>
            <div className="w-5/6">
              <Progress value={50} />
            </div>
          </div>

          {/* 75% Progress */}
          <div className="flex items-center">
            <span className="w-1/6 text-right mr-2">75%</span>
            <div className="w-5/6">
              <Progress value={75} />
            </div>
          </div>

          {/* 100% Progress */}
          <div className="flex items-center">
            <span className="w-1/6 text-right mr-2">100%</span>
            <div className="w-5/6">
              <Progress value={100} />
            </div>
          </div>
        </div>
      </div>
    </div>
  )
}


Enter fullscreen mode Exit fullscreen mode

progress ui percentage
4.NextJS with shadcn ui progress bar with animation.



import { Progress } from "@/components/ui/progress"

export default function ProgressDemo() {
  return (
    <div className="space-y-4">
      <div>
        <h2 className="text-xl font-semibold mb-2 text-center">Progress Bars</h2>
        <div className="space-y-2">
          {/* 10% Progress */}
          <div className="flex items-center">
            <span className="w-1/6 text-right mr-2">10%</span>
            <div className="w-5/6 animate-pulse">
              <Progress value={10} />
            </div>
          </div>

          {/* 25% Progress */}
          <div className="flex items-center">
            <span className="w-1/6 text-right mr-2">25%</span>
            <div className="w-5/6 animate-pulse">
              <Progress value={25} />
            </div>
          </div>

          {/* 50% Progress */}
          <div className="flex items-center">
            <span className="w-1/6 text-right mr-2">50%</span>
            <div className="w-5/6 animate-pulse">
              <Progress value={50} />
            </div>
          </div>

        </div>
      </div>
    </div>
  )
}


Enter fullscreen mode Exit fullscreen mode
shadcnui Article's
30 articles in total
Favicon
Color Highlighting for Tailwind CSS Variables in VS Code
Favicon
Shadcn UI Theme generator, with OKLCH colors and ancient sacred geometry.
Favicon
Next.js Starter Kit: Build Fast & Secure Apps with Auth, Payments & More!
Favicon
Comparing the copyToClipboard implementations in Shadcn-ui/ui and Codehike.
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 3.1
Favicon
Comparison of file and component structures among Shadcn-ui, Plane.so and Gitroom.
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 3.0
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.15
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.14
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.13
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.12
Favicon
Create File Upload UI in Next.js with Shadcn UI
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.11
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.10
Favicon
How to Use Icons in Shadcn UI with Next.js
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.9
Favicon
Next.js with Shadcn UI Progress Bar Example
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.7
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.5
Favicon
How to Use Scroll Area in Next.js with Shadcn UI
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.4
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.3
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.2
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.0
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.1
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 1.1
Favicon
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 1.0
Favicon
shadcn-ui/ui codebase analysis: How is “Blocks” page built — Part 5
Favicon
Next.js Image File Upload and Preview with shadcn/ui
Favicon
shadcn-ui/ui codebase analysis: How is “Blocks” page built — Part 3

Featured ones: