Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
04cb761
[circularprogress][linearprogress] Improve accessibility
silviuaavram Apr 1, 2026
ad2fc09
add linear query
silviuaavram Apr 1, 2026
c5e47c2
also add visible label to linear
silviuaavram Apr 2, 2026
00a4465
update proptypes
silviuaavram Apr 2, 2026
7a8564d
linear with aria-valuetext
silviuaavram Apr 2, 2026
a0fcd30
docs add example
silviuaavram Apr 2, 2026
f35eec5
prettier
silviuaavram Apr 2, 2026
1f9f030
circular progress add props
silviuaavram Apr 2, 2026
d6868d9
add circular with different scale
silviuaavram Apr 2, 2026
0ddb2bb
pnpm docs:typescript:formatted
silviuaavram Apr 2, 2026
2588f49
no need for proptypes in ts demo
silviuaavram Apr 2, 2026
6c0f534
align examples
silviuaavram Apr 2, 2026
7e254ea
update docs
silviuaavram Apr 2, 2026
a069ed7
improve description
silviuaavram Apr 2, 2026
077eed7
correct grammar
silviuaavram Apr 2, 2026
797350f
docs typecript formatted
silviuaavram Apr 2, 2026
e90e758
code review integration
silviuaavram Apr 6, 2026
4b3da8e
docs changes
silviuaavram Apr 6, 2026
bf5a670
remove default
silviuaavram Apr 6, 2026
bfd8f22
fix prop names
silviuaavram Apr 7, 2026
e7653f2
improve circularprogress test
silviuaavram Apr 8, 2026
51d7654
guard against division by 0
silviuaavram Apr 8, 2026
409a3ea
warn when providing min/max with incorrect variant
silviuaavram Apr 8, 2026
fac9022
improve demos
silviuaavram Apr 8, 2026
3dff108
update values in docs
silviuaavram Apr 8, 2026
1411193
provide better examples in docs
silviuaavram Apr 8, 2026
0fa34ce
prettier
silviuaavram Apr 8, 2026
a042d9a
docs:typescript:formatted
silviuaavram Apr 8, 2026
d99727b
accept both values in test
silviuaavram Apr 8, 2026
489d488
only warn when min or max are provided with wrong variant
silviuaavram Apr 8, 2026
ac8c332
regex for dashoffset too
silviuaavram Apr 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/data/material/components/progress/CircularCustomScale.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from 'react';
import CircularProgress from '@mui/material/CircularProgress';

export default function CircularCustomScale() {
const [progress, setProgress] = React.useState(10);

React.useEffect(() => {
const timer = setInterval(() => {
setProgress((prevProgress) => (prevProgress >= 20 ? 10 : prevProgress + 2));
}, 800);

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

return (
<CircularProgress
variant="determinate"
min={10}
max={20}
value={progress}
aria-label="Loading"
/>
);
}
26 changes: 26 additions & 0 deletions docs/data/material/components/progress/CircularCustomScale.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from 'react';
import CircularProgress from '@mui/material/CircularProgress';

export default function CircularCustomScale() {
const [progress, setProgress] = React.useState(10);

React.useEffect(() => {
const timer = setInterval(() => {
setProgress((prevProgress) => (prevProgress >= 20 ? 10 : prevProgress + 2));
}, 800);

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

return (
<CircularProgress
variant="determinate"
min={10}
max={20}
value={progress}
aria-label="Loading"
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<CircularProgress
variant="determinate"
min={10}
max={20}
value={progress}
aria-label="Loading"
/>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function CircularProgressWithLabel(props) {
CircularProgressWithLabel.propTypes = {
/**
* The value of the progress indicator for the determinate variant.
* Value between 0 and 100.
* Value between `min` and `max`.
* @default 0
*/
value: PropTypes.number.isRequired,
Expand Down
10 changes: 10 additions & 0 deletions docs/data/material/components/progress/LinearQuery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Box from '@mui/material/Box';
import LinearProgress from '@mui/material/LinearProgress';

export default function LinearQuery() {
return (
<Box sx={{ width: '100%' }}>
<LinearProgress aria-label="Loading…" variant="query" />
</Box>
);
}
10 changes: 10 additions & 0 deletions docs/data/material/components/progress/LinearQuery.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Box from '@mui/material/Box';
import LinearProgress from '@mui/material/LinearProgress';

export default function LinearQuery() {
return (
<Box sx={{ width: '100%' }}>
<LinearProgress aria-label="Loading…" variant="query" />
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<LinearProgress aria-label="Loading…" variant="query" />
77 changes: 77 additions & 0 deletions docs/data/material/components/progress/LinearWithAriaValueText.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import LinearProgress from '@mui/material/LinearProgress';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';

function LinearProgressWithLabelAndValue({ max, min, value, ...rest }) {
const progressText = `Elevator at floor ${value} out of ${max}.`;
const progressId = React.useId();
return (
<div>
<Typography
id={progressId}
variant="body2"
color="text.secondary"
sx={{ mr: 1 }}
>
Elevator status
</Typography>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Box sx={{ width: '100%', mr: 1 }}>
<LinearProgress
variant="determinate"
aria-labelledby={progressId}
aria-valuetext={progressText}
min={min}
max={max}
value={value}
{...rest}
/>
</Box>
<Box sx={{ whiteSpace: 'nowrap' }}>
<Typography variant="body2" sx={{ color: 'text.secondary' }}>
{progressText}
</Typography>
</Box>
</Box>
</div>
);
}

LinearProgressWithLabelAndValue.propTypes = {
/**
* The maximum value for the progress indicator for the determinate and buffer variants.
* @default 100
*/
max: PropTypes.number.isRequired,
/**
* The minimum value for the progress indicator for the determinate and buffer variants.
* @default 0
*/
min: PropTypes.number.isRequired,
/**
* The value of the progress indicator for the determinate and buffer variants.
* Value between `min` and `max`.
*/
value: PropTypes.number.isRequired,
};

export default function LinearWithAriaValueText() {
const [progress, setProgress] = React.useState(1);

React.useEffect(() => {
const timer = setInterval(() => {
setProgress((prevProgress) => (prevProgress >= 10 ? 1 : prevProgress + 1));
}, 800);
return () => {
clearInterval(timer);
};
}, []);

return (
<Box sx={{ width: '100%' }}>
<LinearProgressWithLabelAndValue value={progress} min={1} max={10} />
</Box>
);
}
69 changes: 69 additions & 0 deletions docs/data/material/components/progress/LinearWithAriaValueText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import * as React from 'react';
import LinearProgress, { LinearProgressProps } from '@mui/material/LinearProgress';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';

type LinearProgressWithLabelAndValueProps = LinearProgressProps & {
min: number;
max: number;
value: number;
};

function LinearProgressWithLabelAndValue({
max,
min,
value,
...rest
}: LinearProgressWithLabelAndValueProps) {
const progressText = `Elevator at floor ${value} out of ${max}.`;
const progressId = React.useId();
return (
<div>
<Typography
id={progressId}
variant="body2"
color="text.secondary"
sx={{ mr: 1 }}
>
Elevator status
</Typography>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Box sx={{ width: '100%', mr: 1 }}>
<LinearProgress
variant="determinate"
aria-labelledby={progressId}
aria-valuetext={progressText}
min={min}
max={max}
value={value}
{...rest}
/>
</Box>
<Box sx={{ whiteSpace: 'nowrap' }}>
<Typography variant="body2" sx={{ color: 'text.secondary' }}>
{progressText}
</Typography>
</Box>
</Box>
</div>
);
}

export default function LinearWithAriaValueText() {
const [progress, setProgress] = React.useState(1);

React.useEffect(() => {
const timer = setInterval(() => {
setProgress((prevProgress) => (prevProgress >= 10 ? 1 : prevProgress + 1));
}, 800);
return () => {
clearInterval(timer);
};
}, []);

return (
<Box sx={{ width: '100%' }}>
<LinearProgressWithLabelAndValue value={progress} min={1} max={10} />
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<LinearProgressWithLabelAndValue value={progress} min={1} max={10} />
45 changes: 28 additions & 17 deletions docs/data/material/components/progress/LinearWithValueLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,40 @@ import LinearProgress from '@mui/material/LinearProgress';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';

function LinearProgressWithLabel(props) {
function LinearProgressWithLabelAndValue(props) {
const progressId = React.useId();
return (
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Box sx={{ width: '100%', mr: 1 }}>
<LinearProgress
variant="determinate"
aria-label="Upload photos"
{...props}
/>
<div>
<Typography
id={progressId}
variant="body2"
color="text.secondary"
sx={{ mr: 1 }}
>
Uploading photos…
</Typography>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Box sx={{ width: '100%', mr: 1 }}>
<LinearProgress
variant="determinate"
aria-labelledby={progressId}
{...props}
/>
</Box>
<Box sx={{ minWidth: 35 }}>
<Typography variant="body2" sx={{ color: 'text.secondary' }}>
{`${Math.round(props.value)}%`}
</Typography>
</Box>
</Box>
<Box sx={{ minWidth: 35 }}>
<Typography variant="body2" sx={{ color: 'text.secondary' }}>
{`${Math.round(props.value)}%`}
</Typography>
</Box>
</Box>
</div>
);
}

LinearProgressWithLabel.propTypes = {
LinearProgressWithLabelAndValue.propTypes = {
/**
* The value of the progress indicator for the determinate and buffer variants.
* Value between 0 and 100.
* Value between `min` and `max`.
*/
value: PropTypes.number.isRequired,
};
Expand All @@ -45,7 +56,7 @@ export default function LinearWithValueLabel() {

return (
<Box sx={{ width: '100%' }}>
<LinearProgressWithLabel value={progress} />
<LinearProgressWithLabelAndValue value={progress} />
</Box>
);
}
44 changes: 28 additions & 16 deletions docs/data/material/components/progress/LinearWithValueLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,35 @@ import LinearProgress, { LinearProgressProps } from '@mui/material/LinearProgres
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';

function LinearProgressWithLabel(props: LinearProgressProps & { value: number }) {
function LinearProgressWithLabelAndValue(
props: LinearProgressProps & { value: number },
) {
const progressId = React.useId();
return (
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Box sx={{ width: '100%', mr: 1 }}>
<LinearProgress
variant="determinate"
aria-label="Upload photos"
{...props}
/>
<div>
<Typography
id={progressId}
variant="body2"
color="text.secondary"
sx={{ mr: 1 }}
>
Uploading photos…
</Typography>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Box sx={{ width: '100%', mr: 1 }}>
<LinearProgress
variant="determinate"
aria-labelledby={progressId}
{...props}
/>
</Box>
<Box sx={{ minWidth: 35 }}>
<Typography variant="body2" sx={{ color: 'text.secondary' }}>
{`${Math.round(props.value)}%`}
</Typography>
</Box>
</Box>
<Box sx={{ minWidth: 35 }}>
<Typography
variant="body2"
sx={{ color: 'text.secondary' }}
>{`${Math.round(props.value)}%`}</Typography>
</Box>
</Box>
</div>
);
}

Expand All @@ -37,7 +49,7 @@ export default function LinearWithValueLabel() {

return (
<Box sx={{ width: '100%' }}>
<LinearProgressWithLabel value={progress} />
<LinearProgressWithLabelAndValue value={progress} />
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<LinearProgressWithLabel value={progress} />
<LinearProgressWithLabelAndValue value={progress} />
Loading
Loading