Skip to content

Instantly share code, notes, and snippets.

@ibelick
Created February 21, 2022 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibelick/7f4a0a4f1bce2fc3705a8d6d16ed9d01 to your computer and use it in GitHub Desktop.
Save ibelick/7f4a0a4f1bce2fc3705a8d6d16ed9d01 to your computer and use it in GitHub Desktop.
Progress Bar with Tailwind CSS + TypeScript
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