🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@material/linear-progress

Package Overview
Dependencies
Maintainers
15
Versions
1675
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/linear-progress

The Material Components for the web linear progress indicator component

14.0.0
latest
Source
npm
Version published
Weekly downloads
450K
-21.35%
Maintainers
15
Weekly downloads
 
Created

What is @material/linear-progress?

@material/linear-progress is a Material Design component for displaying linear progress indicators. It provides a visual representation of the progress of a task, making it easy to integrate with React applications and ensuring a consistent look and feel with other Material Design components.

What are @material/linear-progress's main functionalities?

Indeterminate Progress

This feature allows you to display an indeterminate progress bar, which is useful when the duration of the task is unknown.

import React from 'react';
import { LinearProgress } from '@material-ui/core';

function IndeterminateProgress() {
  return <LinearProgress />;
}

export default IndeterminateProgress;

Determinate Progress

This feature allows you to display a determinate progress bar, which is useful when you can track the progress of a task.

import React, { useState } from 'react';
import { LinearProgress } from '@material-ui/core';

function DeterminateProgress() {
  const [progress, setProgress] = useState(0);

  React.useEffect(() => {
    const timer = setInterval(() => {
      setProgress((oldProgress) => {
        if (oldProgress === 100) {
          return 0;
        }
        const diff = Math.random() * 10;
        return Math.min(oldProgress + diff, 100);
      });
    }, 500);

    return () => {
      clearInterval(timer);
    };
  }, []);

  return <LinearProgress variant="determinate" value={progress} />;
}

export default DeterminateProgress;

Buffer Progress

This feature allows you to display a buffer progress bar, which is useful when you want to show both the progress and the buffer of a task.

import React, { useState } from 'react';
import { LinearProgress } from '@material-ui/core';

function BufferProgress() {
  const [progress, setProgress] = useState(0);
  const [buffer, setBuffer] = useState(10);

  React.useEffect(() => {
    const timer = setInterval(() => {
      setProgress((oldProgress) => {
        if (oldProgress === 100) {
          return 0;
        }
        const diff = Math.random() * 10;
        return Math.min(oldProgress + diff, 100);
      });
      setBuffer((oldBuffer) => {
        if (oldBuffer === 100) {
          return 10;
        }
        const diff = Math.random() * 10;
        return Math.min(oldBuffer + diff, 100);
      });
    }, 500);

    return () => {
      clearInterval(timer);
    };
  }, []);

  return <LinearProgress variant="buffer" value={progress} valueBuffer={buffer} />;
}

export default BufferProgress;

Query Progress

This feature allows you to display a query progress bar, which is useful when you want to indicate that a task is being queried.

import React from 'react';
import { LinearProgress } from '@material-ui/core';

function QueryProgress() {
  return <LinearProgress variant="query" />;
}

export default QueryProgress;

Other packages similar to @material/linear-progress

Keywords

material components

FAQs

Package last updated on 28 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts