-
Hi there, My team is building a feature which allows users to preview counts & the list of users while building an audience – Between the progress bar and skeleton loader, which component do you recommend using for the loading state of the preview for this scenario? More details below:
Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Disclaimer: This is a very experimental bot using OpenAI's GPT-4. The answers may not be correct, a human will review the answer and update it if necessary.
import {SkeletonLoader} from '@twilio-paste/core/skeleton-loader';
import {Text} from '@twilio-paste/core/text';
const SkeletonLoaderExample = () => {
const [loaded] = React.useState(false);
return <>{loaded ? <Text as="span">Single line of text</Text> : <SkeletonLoader width="100px" />}</>;
}; However, if you want to provide a sense of progress, you could consider using an indeterminate Progress Bar. An indeterminate Progress Bar is used when progress is being made, but you can't calculate how much progress or you don't know the value. Here's an example of how you can use it: import {ProgressBar, ProgressBarLabel} from '@twilio-paste/core/progress-bar';
import {Box} from '@twilio-paste/core/box';
import {HelpText} from '@twilio-paste/core/help-text';
import {useUID} from '@twilio-paste/core/uid-library';
const AlertDialogExample = () => {
const progressBarId = useUID();
const helpTextId = useUID();
return (
<Box>
<ProgressBarLabel htmlFor={progressBarId}>Downloading more RAM</ProgressBarLabel>
<ProgressBar id={progressBarId} aria-describedby={helpTextId} isIndeterminate />
<HelpText id={helpTextId}>Increasing your RAM helps your computer run faster.</HelpText>
</Box>
);
}; Switching between a determinate and indeterminate state is not explicitly mentioned in the documentation, so it's unclear if this is a recommended practice. Here are some similar discussions:
|
Beta Was this translation helpful? Give feedback.
-
Hi @vanesng We think ultimately the answer is going very dependent on what is feasible from an engineering perspective. If you can detect with accuracy the actual progress, even if it's taking a super long time, you should use a Progress bar with a determinate state. If you cannot determine the progress of the process, then you should only use the indeterminate state of the progress bar. In both cases, some excellent help text explaining that it can take a long time depending on the size of the data set will go a long way to explaining the situation. Skeleton loaders should really only be used in page or content loading situations to improve perceived page load performance. It's not designed to communicate progress or the state of a process. It's effectively not there |
Beta Was this translation helpful? Give feedback.
-
Sounds good, this is helpful. Thanks both! |
Beta Was this translation helpful? Give feedback.
Hi @vanesng
We think ultimately the answer is going very dependent on what is feasible from an engineering perspective.
If you can detect with accuracy the actual progress, even if it's taking a super long time, you should use a Progress bar with a determinate state.
If you cannot determine the progress of the process, then you should only use the indeterminate state of the progress bar.
In both cases, some excellent help text explaining that it can take a long time depending on the size of the data set will go a long way to explaining the situation.
Skeleton loaders should really only be used in page or content loading situations to improve perceived page load performance. It's not desig…