Created
February 21, 2022 11:32
-
-
Save ibelick/7f4a0a4f1bce2fc3705a8d6d16ed9d01 to your computer and use it in GitHub Desktop.
Progress Bar with Tailwind CSS + TypeScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ProgressProps { | |
label?: string; | |
value: number; | |
} | |
const Progress: React.FC<ProgressProps> = ({ label, value }) => { | |
return ( | |
<> | |
{label ? ( | |
<div className="mb-1 flex justify-between"> | |
<span className="text-base font-medium text-blue-700 dark:text-white"> | |
{label} | |
</span> | |
<span className="text-sm font-medium text-blue-700 dark:text-white"> | |
{value}% | |
</span> | |
</div> | |
) : null} | |
<div className="h-2.5 w-full rounded-full bg-gray-200 dark:bg-gray-700"> | |
<div | |
className="h-2.5 rounded-full bg-blue-600" | |
style={{ width: `${value}%` }} | |
></div> | |
</div> | |
</> | |
); | |
}; | |
export default Progress; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment