generated from timelessco/next-ts-app-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e32223d
commit 0de1528
Showing
6 changed files
with
350 additions
and
88 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"spinner": "Spinner", | ||
"circular-progress": "CircularProgress", | ||
"meter": "Meter", | ||
"progress": "Progress", | ||
"circular-progress": "CircularProgress" | ||
"show-more": "Show More", | ||
"spinner": "Spinner" | ||
} |
This file contains 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,129 @@ | ||
import { | ||
ComponentLinks, | ||
InteractiveCodeblock, | ||
PropsTable, | ||
Codeblock, | ||
} from "@/components/index"; | ||
|
||
# Meter | ||
|
||
Meter is used to display finite value that are within a known range eg., CPU | ||
usage. | ||
|
||
<ComponentLinks github="meter" theme="meter" story="feedback-meter" /> | ||
|
||
## Imports | ||
|
||
```js | ||
import { | ||
Meter, | ||
MeterBar, | ||
MeterBarWrapper, | ||
MeterHint, | ||
MeterLabel, | ||
useMeterProps, | ||
useMeterState, | ||
MeterTrack, | ||
MeterWrapper, | ||
} from "@renderlesskit/react-tailwind"; | ||
``` | ||
|
||
## Usage | ||
|
||
<InteractiveCodeblock | ||
children={({ spreadProps }) => | ||
`<Meter value={40} max={100} ${spreadProps} />` | ||
} | ||
themeProps={{ size: "meter.track.size" }} | ||
/> | ||
|
||
## Min max values | ||
|
||
<Codeblock live children={`<Meter value={35} max={100} />`} /> | ||
|
||
## Meter sizes | ||
|
||
Meter comes with 4 sizes `sm` `md` `lg` & `xl` | ||
|
||
<Codeblock | ||
live | ||
children={` | ||
<div className="flex flex-col space-y-2"> | ||
<Meter size="sm" value={20} max={100} /> | ||
<Meter size="md" value={30} max={100} /> | ||
<Meter size="lg" value={40} max={100} /> | ||
<Meter size="xl" value={50} max={100} /> | ||
</div> | ||
`} | ||
/> | ||
|
||
## Meter Label | ||
|
||
Meter also comes with A11y label that can also be used to describe the meter. | ||
|
||
<Codeblock | ||
live | ||
children={`<Meter value={50} max={100} label="Charging..."/>`} | ||
/> | ||
|
||
## Meter Hint | ||
|
||
Meter comes with A11y hint that can be used with label to indicate the meter | ||
status. | ||
|
||
<Codeblock | ||
live | ||
children={`<Meter value={50} max={100} label="Charging..." hint={50}/>`} | ||
/> | ||
|
||
## Meter Interval | ||
|
||
Meter has an interval that can be used to indicate multiple range of the meter. | ||
|
||
<Codeblock | ||
live | ||
children={`<Meter value={50} max={100} label="Charging..." hint={50} intervals={4} /> `} | ||
/> | ||
|
||
## Customizing Meter | ||
|
||
To customize the appearance of the Meter component we can simply pass down | ||
children components (MeterTrack, MeterBar) for more control. | ||
|
||
<Codeblock | ||
live | ||
children={` | ||
<Meter value={40} max={100}> | ||
<MeterTrack className="bg-red-300" /> | ||
<MeterBar className="bg-red-800" /> | ||
</Meter> | ||
`} | ||
/> | ||
|
||
## API Reference | ||
|
||
<PropsTable | ||
data={[ | ||
{ name: "size", themeKey: "meter.track.size", default: "md" }, | ||
{ | ||
name: "intervals", | ||
type: "number", | ||
description: "No of intervals for the meter.", | ||
}, | ||
{ | ||
name: "flatBorders", | ||
type: "boolean", | ||
description: "If true, meter bar intervals will have flat broders", | ||
}, | ||
{ | ||
name: "hint", | ||
type: "React.ReactNode", | ||
description: "Hint component to display info center of the meterbar", | ||
}, | ||
{ | ||
name: "label", | ||
type: "React.ReactNode", | ||
description: "Label slot to pass the label", | ||
}, | ||
|
||
]} /> |
Oops, something went wrong.
0de1528
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.
Successfully deployed to the following URLs: