-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Progress circle documentation #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e32a9fb
Progress circle documentation
ross-pfahler 77b124f
Visualization fixes
ross-pfahler d395096
Formatting
ross-pfahler b7e0989
Fix
ross-pfahler 00488f0
Merge branch 'master' of github.com:adobe-private/react-spectrum-v3 i…
ross-pfahler 211f722
Review comments
ross-pfahler a141d9a
More review
ross-pfahler f806aad
Merge branch 'master' of github.com:adobe-private/react-spectrum-v3 i…
ross-pfahler 22a1711
Move Indeterminate section
ross-pfahler 49d9a9e
Merge branch 'master' into progress-circle-docs
devongovett 5630cd7
Merge branch 'master' of github.com:adobe-private/react-spectrum-v3 i…
ross-pfahler 918c97a
Review
ross-pfahler 5b3dcca
Adjust naming
ross-pfahler dcc3da8
Merge branch 'master' of github.com:adobe-private/react-spectrum-v3 i…
ross-pfahler 2501cf8
Merge branch 'master' into progress-circle-docs
LFDanLu 67cdab6
adding no scope hoisting for verification on build server
snowystinger b90278b
Update ProgressCircle.mdx
dannify 4d15824
Merge branch 'master' into progress-circle-docs
dannify File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
packages/@react-spectrum/progress/docs/ProgressCircle.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| import {Layout} from '@react-spectrum/docs'; | ||
| export default Layout; | ||
|
|
||
| import docs from 'docs:@react-spectrum/progress'; | ||
| import {HeaderInfo, PropTable} from '@react-spectrum/docs'; | ||
| import packageData from '../package.json'; | ||
|
|
||
| ```jsx import | ||
| import {ProgressCircle} from '@react-spectrum/progress'; | ||
| import {View} from '@react-spectrum/view'; | ||
| ``` | ||
|
|
||
| # ProgressCircle | ||
|
|
||
| <p>{docs.exports.ProgressCircle.description}</p> | ||
|
|
||
| <HeaderInfo | ||
| packageData={packageData} | ||
| componentNames={['ProgressCircle']} | ||
| sourceData={[ | ||
| {type: 'Spectrum', url: 'https://spectrum.adobe.com/page/circle-loader/'} | ||
| ]} /> | ||
|
|
||
| ## Example | ||
|
|
||
| ```tsx example | ||
| <ProgressCircle aria-label="Loading…" value={50} /> | ||
| ``` | ||
|
|
||
| ## Value | ||
|
|
||
| By default ProgressCircles are controlled with the `value` prop representing current percentage as an integer. | ||
| In this case, the minimum and maximum values default to 0 and 100, respectively. | ||
|
|
||
| ```tsx example | ||
| <ProgressCircle aria-label="Loading…" value={25} /> | ||
| ``` | ||
|
|
||
| Alternatively, a different scale can be used by setting the `minValue` and `maxValue`. | ||
|
|
||
| ```tsx example | ||
| <ProgressCircle aria-label="Loading…" minValue={50} maxValue={150} value={100} /> | ||
| ``` | ||
|
|
||
| ### Indeterminate | ||
| [View guidelines](https://spectrum.adobe.com/page/circle-loader/#Indeterminate) | ||
|
|
||
| By default, ProgressCircles are determinate. Use a determinate ProgressCircle when progress can be calculated against a specific goal. | ||
|
|
||
| ```tsx example | ||
| <ProgressCircle aria-label="Loading…" value={50} /> | ||
| ``` | ||
|
|
||
| Use an indeterminate ProgressCircle when progress is happening but the time or effort to completion can’t be determined. | ||
|
|
||
| ```tsx example | ||
| <ProgressCircle aria-label="Loading…" isIndeterminate /> | ||
| ``` | ||
|
|
||
| ### Accessibility | ||
|
|
||
| ProgressCircle requires an `aria-label` or `aria-labelledby` attribute. | ||
|
|
||
| ```tsx example | ||
| <div> | ||
| <ProgressCircle aria-labelledby="pc-label" isIndeterminate /> | ||
| <label id="pc-label" style={{display: 'block'}}>Loading…</label> | ||
| </div> | ||
| ``` | ||
|
|
||
| If using the `overBackground` variant, ensure the background offers enough contrast for the ProgressCircle to be legible and meets color contrast guidelines. | ||
|
|
||
| ### Internationalization | ||
|
|
||
| To internationalize a ProgressCircle, a localized string should be passed to the `aria-label` prop (or value of the associated `aria-labelledby` element). | ||
|
|
||
| For languages that are read right to left (e.g. Hebrew and Arabic), the fill of both determinate and indeterminate ProgressCircles continues to spin clockwise. | ||
|
|
||
| ## Props | ||
|
|
||
| <PropTable component={docs.exports.ProgressCircle} links={docs.links} /> | ||
|
|
||
| ## Visual Options | ||
|
|
||
| ### Over background | ||
| [View guidelines](https://spectrum.adobe.com/page/circle-loader/#Over-background-variant) | ||
|
|
||
| When a ProgressCircle needs to be placed on top of a colored background, use the `overBackground` variant. | ||
|
|
||
| ```tsx example | ||
| <View backgroundColor="positive" padding="25px"> | ||
| <ProgressCircle aria-label="Loading…" isIndeterminate variant="overBackground" /> | ||
| </View> | ||
| ``` | ||
|
|
||
| ### Size | ||
| [View guidelines](https://spectrum.adobe.com/page/circle-loader/#Size) | ||
|
|
||
| ```tsx example | ||
| <ProgressCircle aria-label="Loading…" marginRight="25px" size="S" value={15} /> | ||
| <ProgressCircle aria-label="Loading…" marginRight="25px" value={30} /> | ||
| <ProgressCircle aria-label="Loading…" size="L" value={60} /> | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very direct and clear, but I like
Meter'sway of saying this.Depending on the visualization being used (i.e. depending on the showValueLabel prop), a label, aria-label, or aria-labelledby attribute are required.