Socket
Socket
Sign inDemoInstall

@material/linear-progress

Package Overview
Dependencies
Maintainers
14
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


Version published
Maintainers
14
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

FAQs

Package last updated on 03 Aug 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc