Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
aeca3d7
[circularprogress][linearprogress] Improve accessibility
silviuaavram Apr 1, 2026
c1b867a
add linear query
silviuaavram Apr 1, 2026
b18110c
also add visible label to linear
silviuaavram Apr 2, 2026
0dafb88
update proptypes
silviuaavram Apr 2, 2026
c375981
linear with aria-valuetext
silviuaavram Apr 2, 2026
ad8c0f5
docs add example
silviuaavram Apr 2, 2026
c961d52
prettier
silviuaavram Apr 2, 2026
96cf60a
circular progress add props
silviuaavram Apr 2, 2026
bed4f27
add circular with different scale
silviuaavram Apr 2, 2026
dfa71f5
pnpm docs:typescript:formatted
silviuaavram Apr 2, 2026
3bcc3ee
no need for proptypes in ts demo
silviuaavram Apr 2, 2026
45067ed
align examples
silviuaavram Apr 2, 2026
02a318a
update docs
silviuaavram Apr 2, 2026
19d21ff
improve description
silviuaavram Apr 2, 2026
935f827
correct grammar
silviuaavram Apr 2, 2026
3fb4f2f
docs typecript formatted
silviuaavram Apr 2, 2026
2aef008
code review integration
silviuaavram Apr 6, 2026
c3f70d2
docs changes
silviuaavram Apr 6, 2026
2fe3dd8
remove default
silviuaavram Apr 6, 2026
a7fc26e
fix prop names
silviuaavram Apr 7, 2026
d109422
improve circularprogress test
silviuaavram Apr 8, 2026
89cde5e
guard against division by 0
silviuaavram Apr 8, 2026
2c8acdd
warn when providing min/max with incorrect variant
silviuaavram Apr 8, 2026
a3d921a
improve demos
silviuaavram Apr 8, 2026
3cbd166
update values in docs
silviuaavram Apr 8, 2026
cc5a819
provide better examples in docs
silviuaavram Apr 8, 2026
8135b48
prettier
silviuaavram Apr 8, 2026
78b6482
docs:typescript:formatted
silviuaavram Apr 8, 2026
281d338
accept both values in test
silviuaavram Apr 8, 2026
7ed9b3e
only warn when min or max are provided with wrong variant
silviuaavram Apr 8, 2026
165ac99
regex for dashoffset too
silviuaavram Apr 8, 2026
656d608
fix error messages
silviuaavram Apr 14, 2026
ab46e75
remove not needed margin
silviuaavram Apr 14, 2026
eed6fbe
fix the value default with min
silviuaavram Apr 14, 2026
5704bb0
remove rounding of value
silviuaavram Apr 14, 2026
6a1b88f
fix lint
silviuaavram Apr 14, 2026
8e97de0
update jsdoc
silviuaavram Apr 14, 2026
4f637da
fix again jsdoc
silviuaavram Apr 14, 2026
843ead2
fix jsdoc in examples
silviuaavram Apr 14, 2026
2e29524
update docs
silviuaavram Apr 14, 2026
b36a42d
updates for docs page
silviuaavram Apr 15, 2026
1933116
add MUI error prefix
silviuaavram Apr 15, 2026
6972aba
safer fallbacks for min > max
silviuaavram Apr 15, 2026
c19fc27
fix the other test
silviuaavram Apr 15, 2026
5f8524a
fix jsdoc min reference
silviuaavram Apr 15, 2026
f93b11f
docs:api
silviuaavram Apr 15, 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}
Comment thread
silviuaavram marked this conversation as resolved.
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,8 +39,8 @@ function CircularProgressWithLabel(props) {
CircularProgressWithLabel.propTypes = {
/**
* The value of the progress indicator for the determinate variant.
* Value between 0 and 100.
* @default 0
* Value between `min` and `max`.
* @default props.min ?? 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 }) {
Comment thread
siriwatknp marked this conversation as resolved.
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} />
40 changes: 23 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,35 @@ 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">
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 +51,7 @@ export default function LinearWithValueLabel() {

return (
<Box sx={{ width: '100%' }}>
<LinearProgressWithLabel value={progress} />
<LinearProgressWithLabelAndValue value={progress} />
</Box>
);
}
39 changes: 23 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,30 @@ 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">
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 +44,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